Print this page
OS-161: Integrate IPMP changes

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libipadm/common/ipadm_ipmgmt.h
          +++ new/usr/src/lib/libipadm/common/ipadm_ipmgmt.h
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
  23   24   * Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
  24   25   */
  25   26  
  26   27  #ifndef _IPADM_IPMGMT_H
  27   28  #define _IPADM_IPMGMT_H
  28   29  
  29   30  #ifdef  __cplusplus
  30   31  extern "C" {
  31   32  #endif
  32   33  #include <sys/types.h>
↓ open down ↓ 17 lines elided ↑ open up ↑
  50   51   */
  51   52  /*
  52   53   * For more information on these definitions please refer to the top of
  53   54   * ipadm_persist.c. These are the name of the nvpairs which hold the
  54   55   * respective values. All nvpairs private to ipadm have names that begin
  55   56   * with "_". Note below that 'prefixlen' and 'reqhost' are address
  56   57   * properties and therefore not a private nvpair name.
  57   58   */
  58   59  #define IPADM_NVP_PROTONAME     "_protocol"     /* protocol name */
  59   60  #define IPADM_NVP_IFNAME        "_ifname"       /* interface name */
       61 +#define IPADM_NVP_IFCLASS       "_ifclass"      /* interface class */
       62 +#define IPADM_NVP_FAMILIES      "_families"     /* interface families */
       63 +#define IPADM_NVP_GIFNAME       "_gifname"      /* IPMP group interface name */
       64 +#define IPADM_NVP_MIFNAMES      "_mifnames"     /* IPMP group members */
  60   65  #define IPADM_NVP_AOBJNAME      "_aobjname"     /* addrobj name */
  61   66  #define IPADM_NVP_FAMILY        "_family"       /* address family */
  62   67  #define IPADM_NVP_IPV4ADDR      "_ipv4addr"     /* name of IPv4 addr nvlist */
  63   68  #define IPADM_NVP_IPNUMADDR     "_addr"         /* local address */
  64   69  #define IPADM_NVP_IPADDRHNAME   "_aname"        /* local hostname */
  65   70  #define IPADM_NVP_IPDADDRHNAME  "_dname"        /* remote hostname */
  66   71  #define IPADM_NVP_PREFIXLEN     "prefixlen"     /* prefixlen */
  67   72  #define IPADM_NVP_REQHOST       "reqhost"       /* requested hostname */
  68   73  #define IPADM_NVP_IPV6ADDR      "_ipv6addr"     /* name of IPv6 addr nvlist */
  69   74  #define IPADM_NVP_DHCP          "_dhcp"         /* name of DHCP nvlist */
↓ open down ↓ 31 lines elided ↑ open up ↑
 101  106  } ipadm_dbwrite_cbarg_t;
 102  107  
 103  108  /*
 104  109   * door related function declarations and data structures.
 105  110   */
 106  111  
 107  112  /* The door file for the ipmgmt (ip-interface management) daemon */
 108  113  #define IPMGMT_DOOR             "/etc/svc/volatile/ipadm/ipmgmt_door"
 109  114  #define MAXPROTONAMELEN         32
 110  115  
      116 +/*
      117 + * ia_flags used inside the arguments for interface/address commands
      118 + *
      119 + *      - APPEND updates the multi-valued ipadm DB entry with a new value
      120 + *      - REMOVE updates the multi-valued ipadm DB entry by removing a value
      121 + *      - ACTIVE updates the running configuration
      122 + *      - PERSIST updates the permanent data store
      123 + *      - INIT  indicates that operation being performed is under init
      124 + *              context
      125 + *      - PROPS_ONLY indicates the update changes the running configuration of
      126 + *                  "props" data on the interface/address object. The props are
      127 + *                  cached there on the parent, so a PROPS_ONLY change does not
      128 + *                  affect the ACTIVE/PERSIST state of the parent.
      129 + *
      130 + * These two flags are used by ipmgmt_db_update_if function,
      131 + * because it can be used to update more that one DB line
      132 + * and we need to be sure that we finished all operations,
      133 + * after the operation has finished the related flag is cleared
      134 + *
      135 + *  - UPDATE_IF - used when we need to update IPADM_NVP_FAMILIES and
      136 + *                IPADM_NVP_MIFNAMES fields
      137 + *  - UPDATE_IPMP - used when we need to update IPADM_NVP_GIFNAME
      138 + */
      139 +#define IPMGMT_APPEND   0x00000001
      140 +#define IPMGMT_REMOVE   0x00000002
      141 +#define IPMGMT_ACTIVE   0x00000004
      142 +#define IPMGMT_PERSIST  0x00000008
      143 +#define IPMGMT_INIT     0x00000010
      144 +#define IPMGMT_PROPS_ONLY   0x00000020
      145 +#define IPMGMT_UPDATE_IF    0x00000040
      146 +#define IPMGMT_UPDATE_IPMP  0x00000080
      147 +
      148 +
 111  149  /* door call command type */
 112  150  typedef enum {
 113  151          IPMGMT_CMD_SETPROP = 1,         /* persist property */
 114  152          IPMGMT_CMD_SETIF,               /* persist interface */
 115  153          IPMGMT_CMD_SETADDR,             /* persist address */
 116  154          IPMGMT_CMD_GETPROP,             /* retrieve persisted property value */
 117  155          IPMGMT_CMD_GETIF,               /* retrieve persisted interface conf. */
 118  156          IPMGMT_CMD_GETADDR,             /* retrieve persisted addresses */
 119  157          IPMGMT_CMD_RESETIF,             /* purge interface configuration */
 120  158          IPMGMT_CMD_RESETADDR,           /* purge address configuration */
 121  159          IPMGMT_CMD_RESETPROP,           /* purge property configuration */
 122  160          IPMGMT_CMD_INITIF,              /* retrieve interfaces to initialize */
 123  161          IPMGMT_CMD_ADDROBJ_LOOKUPADD,   /* addr. object lookup & add */
 124  162          IPMGMT_CMD_ADDROBJ_SETLIFNUM,   /* set lifnum on the addrobj */
 125  163          IPMGMT_CMD_ADDROBJ_ADD,         /* add addr. object to addrobj map */
 126  164          IPMGMT_CMD_LIF2ADDROBJ,         /* lifname to addrobj mapping */
 127      -        IPMGMT_CMD_AOBJNAME2ADDROBJ     /* aobjname to addrobj mapping */
      165 +        IPMGMT_CMD_AOBJNAME2ADDROBJ,    /* aobjname to addrobj mapping */
      166 +        IPMGMT_CMD_IPMP_UPDATE  /* update IPMP group members */
 128  167  } ipmgmt_door_cmd_type_t;
 129  168  
 130  169  /*
 131  170   * Note: We need to keep the size of the structure the same on amd64 and i386
 132  171   * for all door_call arguments and door_return structures.
 133  172   */
 134  173  /* door_call argument */
 135  174  typedef struct ipmgmt_arg {
 136  175          ipmgmt_door_cmd_type_t  ia_cmd;
 137  176  } ipmgmt_arg_t;
↓ open down ↓ 1 lines elided ↑ open up ↑
 139  178  /* IPMGMT_CMD_{SETPROP|GETPROP|RESETPROP} door_call argument */
 140  179  typedef struct ipmgmt_prop_arg_s {
 141  180          ipmgmt_door_cmd_type_t  ia_cmd;
 142  181          uint32_t                ia_flags;
 143  182          char                    ia_ifname[LIFNAMSIZ];
 144  183          char                    ia_aobjname[IPADM_AOBJSIZ];
 145  184          char                    ia_module[MAXPROTONAMELEN];
 146  185          char                    ia_pname[MAXPROPNAMELEN];
 147  186          char                    ia_pval[MAXPROPVALLEN];
 148  187  } ipmgmt_prop_arg_t;
 149      -/*
 150      - * ia_flags used in ipmgmt_prop_arg_t.
 151      - *      - APPEND updates the multi-valued property entry with a new value
 152      - *      - REDUCE updates the multi-valued property entry by removing a value
 153      - */
 154      -#define IPMGMT_APPEND   0x00000001
 155      -#define IPMGMT_REMOVE   0x00000002
 156  188  
 157  189  /*
 158  190   * ipadm_addr_type_t-specific values that are cached in ipmgmtd and can
 159  191   * make a round-trip back to client programs
 160  192   */
 161  193  typedef union {
 162  194          struct {
 163  195                  boolean_t               ipmgmt_linklocal;
 164  196                  struct sockaddr_in6             ipmgmt_ifid;
 165  197          } ipmgmt_ipv6_cache_s;
↓ open down ↓ 8 lines elided ↑ open up ↑
 174  206          uint32_t        ia_flags;
 175  207          char            ia_ifname[LIFNAMSIZ];
 176  208  } ipmgmt_getif_arg_t;
 177  209  
 178  210  /* IPMGMT_CMD_RESETIF, IPMGMT_CMD_SETIF door_call argument structure */
 179  211  typedef struct ipmgmt_if_arg_s {
 180  212          ipmgmt_door_cmd_type_t  ia_cmd;
 181  213          uint32_t                ia_flags;
 182  214          char                    ia_ifname[LIFNAMSIZ];
 183  215          sa_family_t             ia_family;
      216 +        ipadm_if_class_t        ia_ifclass;
 184  217  } ipmgmt_if_arg_t;
 185  218  
 186  219  /* IPMGMT_CMD_INITIF door_call argument structure */
 187  220  typedef struct ipmgmt_initif_arg_s {
 188  221          ipmgmt_door_cmd_type_t  ia_cmd;
 189  222          uint32_t        ia_flags;
 190  223          sa_family_t     ia_family;
 191  224          size_t          ia_nvlsize;
 192  225          /* packed nvl follows */
 193  226  } ipmgmt_initif_arg_t;
 194  227  
      228 +/* IPMGMT_CMD_IPMP_UPDATE door_call argument structure */
      229 +typedef struct ipmgmt_ipmp_update_arg_s {
      230 +        ipmgmt_door_cmd_type_t  ia_cmd;
      231 +        uint32_t        ia_flags;
      232 +        char            ia_gifname[LIFNAMSIZ]; /* group interface name */
      233 +        char    ia_mifname[LIFNAMSIZ]; /* group's member interface name */
      234 +} ipmgmt_ipmp_update_arg_t;
      235 +
 195  236  /* IPMGMT_CMD_SETADDR door_call argument */
 196  237  typedef struct ipmgmt_setaddr_arg_s {
 197  238          ipmgmt_door_cmd_type_t  ia_cmd;
 198  239          uint32_t                ia_flags;
 199  240          size_t                  ia_nvlsize;
 200  241          /* packed nvl follows */
 201  242  } ipmgmt_setaddr_arg_t;
 202  243  
 203  244  /* IPMGMT_CMD_GETADDR door_call argument */
 204  245  typedef struct ipmgmt_getaddr_arg_s {
↓ open down ↓ 19 lines elided ↑ open up ↑
 224  265  typedef struct ipmgmt_aobjop_arg_s {
 225  266          ipmgmt_door_cmd_type_t  ia_cmd;
 226  267          uint32_t                ia_flags;
 227  268          char                    ia_aobjname[IPADM_AOBJSIZ];
 228  269          char                    ia_ifname[LIFNAMSIZ];
 229  270          int32_t                 ia_lnum;
 230  271          sa_family_t             ia_family;
 231  272          ipadm_addr_type_t       ia_atype;
 232  273  } ipmgmt_aobjop_arg_t;
 233  274  
 234      -/*
 235      - * ia_flags used inside the arguments for interface/address commands
 236      - *      - ACTIVE updates the running configuration
 237      - *      - PERSIST updates the permanent data store
 238      - *      - INIT  indicates that operation being performed is under init
 239      - *                  context
 240      - *      - PROPS_ONLY indicates the update changes the running configuration of
 241      - *                  "props" data on the interface/address object. The props are
 242      - *                  cached there on the parent, so a PROPS_ONLY change does not
 243      - *                  affect the ACTIVE/PERSIST state of the parent.
 244      - */
 245      -#define IPMGMT_ACTIVE           0x00000001
 246      -#define IPMGMT_PERSIST          0x00000002
 247      -#define IPMGMT_INIT             0x00000004
 248      -#define IPMGMT_PROPS_ONLY               0x00000008
 249      -
 250  275  /* door call return value */
 251  276  typedef struct ipmgmt_retval_s {
 252  277          int32_t ir_err;
 253  278  } ipmgmt_retval_t;
 254  279  
 255  280  /* IPMGMT_CMD_GETADDR door_return value */
 256  281  typedef struct ipmgmt_get_rval_s {
 257  282          int32_t         ir_err;
 258  283          size_t          ir_nvlsize;
 259  284          /* packed nvl follows */
↓ open down ↓ 53 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX