Print this page
dccp: properties

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libipadm/common/ipadm_prop.c
          +++ new/usr/src/lib/libipadm/common/ipadm_prop.c
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
  24   24  
  25   25  /*
  26   26   * This file contains routines that are used to modify/retrieve protocol or
  27   27   * interface property values. It also holds all the supported properties for
  28   28   * both IP interface and protocols in `ipadm_prop_desc_t'. Following protocols
  29      - * are supported: IP, IPv4, IPv6, TCP, SCTP, UDP and ICMP.
       29 + * are supported: IP, IPv4, IPv6, TCP, SCTP, UDP, ICMP and DCCP.
  30   30   *
  31   31   * This file also contains walkers, which walks through the property table and
  32   32   * calls the callback function, of the form `ipadm_prop_wfunc_t' , for every
  33   33   * property in the table.
  34   34   */
  35   35  
  36   36  #include <unistd.h>
  37   37  #include <errno.h>
  38   38  #include <ctype.h>
  39   39  #include <fcntl.h>
↓ open down ↓ 35 lines elided ↑ open up ↑
  75   75   */
  76   76  static ipadm_pd_setf_t  i_ipadm_set_prop, i_ipadm_set_mtu,
  77   77                          i_ipadm_set_ifprop_flags,
  78   78                          i_ipadm_set_metric, i_ipadm_set_usesrc,
  79   79                          i_ipadm_set_forwarding, i_ipadm_set_eprivport,
  80   80                          i_ipadm_set_ecnsack, i_ipadm_set_hostmodel;
  81   81  
  82   82  /* array of protocols we support */
  83   83  static int protocols[] = { MOD_PROTO_IP, MOD_PROTO_RAWIP,
  84   84                              MOD_PROTO_TCP, MOD_PROTO_UDP,
  85      -                            MOD_PROTO_SCTP };
       85 +                            MOD_PROTO_SCTP, MOD_PROTO_DCCP };
  86   86  
  87   87  /*
  88   88   * Supported IP protocol properties.
  89   89   */
  90   90  static ipadm_prop_desc_t ipadm_ip_prop_table[] = {
  91   91          { "arp", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0,
  92   92              i_ipadm_set_ifprop_flags, i_ipadm_get_onoff,
  93   93              i_ipadm_get_ifprop_flags },
  94   94  
  95   95          { "forwarding", IPADMPROP_CLASS_MODIF, MOD_PROTO_IPV4, 0,
↓ open down ↓ 136 lines elided ↑ open up ↑
 232  232  static ipadm_prop_desc_t ipadm_icmp_prop_table[] = {
 233  233          { "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0,
 234  234              i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
 235  235  
 236  236          { "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0,
 237  237              i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
 238  238  
 239  239          { NULL, 0, 0, 0, NULL, NULL, NULL }
 240  240  };
 241  241  
      242 +/* Supported DCCP protocol properties */
      243 +static ipadm_prop_desc_t ipadm_dccp_prop_table[] = {
      244 +        { "extra_priv_ports", IPADMPROP_CLASS_MODULE, MOD_PROTO_DCCP,
      245 +            IPADMPROP_MULVAL, i_ipadm_set_eprivport, i_ipadm_get_prop,
      246 +            i_ipadm_get_prop },
      247 +
      248 +        { "largest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_DCCP, 0,
      249 +            i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
      250 +
      251 +        { "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_DCCP, 0,
      252 +            i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
      253 +
      254 +        { "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_DCCP, 0,
      255 +            i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
      256 +
      257 +        { "smallest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_DCCP, 0,
      258 +            i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
      259 +
      260 +        { "smallest_nonpriv_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_DCCP, 0,
      261 +            i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop },
      262 +
      263 +        { NULL, 0, 0, 0, NULL, NULL, NULL }
      264 +};
      265 +
 242  266  /*
 243  267   * A dummy private property structure, used while handling private
 244  268   * protocol properties (properties not yet supported by libipadm).
 245  269   */
 246  270  static ipadm_prop_desc_t        ipadm_privprop =\
 247  271          { NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_NONE, 0,
 248  272              i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop };
 249  273  
 250  274  /*
 251  275   * Returns the property description table, for the given protocol
↓ open down ↓ 7 lines elided ↑ open up ↑
 259  283          case MOD_PROTO_IPV6:
 260  284                  return (ipadm_ip_prop_table);
 261  285          case MOD_PROTO_RAWIP:
 262  286                  return (ipadm_icmp_prop_table);
 263  287          case MOD_PROTO_TCP:
 264  288                  return (ipadm_tcp_prop_table);
 265  289          case MOD_PROTO_UDP:
 266  290                  return (ipadm_udp_prop_table);
 267  291          case MOD_PROTO_SCTP:
 268  292                  return (ipadm_sctp_prop_table);
      293 +        case MOD_PROTO_DCCP:
      294 +                return (ipadm_dccp_prop_table);
 269  295          }
 270  296  
 271  297          return (NULL);
 272  298  }
 273  299  
 274  300  static ipadm_prop_desc_t *
 275  301  i_ipadm_get_prop_desc(const char *pname, uint_t proto, int *errp)
 276  302  {
 277  303          int             err = 0;
 278  304          boolean_t       matched_name = B_FALSE;
↓ open down ↓ 34 lines elided ↑ open up ↑
 313  339          case MOD_PROTO_IPV6:
 314  340                  return ("ipv6");
 315  341          case MOD_PROTO_RAWIP:
 316  342                  return ("icmp");
 317  343          case MOD_PROTO_TCP:
 318  344                  return ("tcp");
 319  345          case MOD_PROTO_UDP:
 320  346                  return ("udp");
 321  347          case MOD_PROTO_SCTP:
 322  348                  return ("sctp");
      349 +        case MOD_PROTO_DCCP:
      350 +                return ("dccp");
 323  351          }
 324  352  
 325  353          return (NULL);
 326  354  }
 327  355  
 328  356  uint_t
 329  357  ipadm_str2proto(const char *protostr)
 330  358  {
 331  359          if (protostr == NULL)
 332  360                  return (MOD_PROTO_NONE);
↓ open down ↓ 6 lines elided ↑ open up ↑
 339  367          else if (strcmp(protostr, "ipv4") == 0)
 340  368                  return (MOD_PROTO_IPV4);
 341  369          else if (strcmp(protostr, "ipv6") == 0)
 342  370                  return (MOD_PROTO_IPV6);
 343  371          else if (strcmp(protostr, "icmp") == 0)
 344  372                  return (MOD_PROTO_RAWIP);
 345  373          else if (strcmp(protostr, "sctp") == 0)
 346  374                  return (MOD_PROTO_SCTP);
 347  375          else if (strcmp(protostr, "arp") == 0)
 348  376                  return (MOD_PROTO_IP);
      377 +        else if (strcmp(protostr, "dccp") == 0)
      378 +                return (MOD_PROTO_DCCP);
 349  379  
 350  380          return (MOD_PROTO_NONE);
 351  381  }
 352  382  
 353  383  /* ARGSUSED */
 354  384  static ipadm_status_t
 355  385  i_ipadm_set_mtu(ipadm_handle_t iph, const void *arg,
 356  386      ipadm_prop_desc_t *pdp, const void *pval, uint_t proto, uint_t flags)
 357  387  {
 358  388          struct lifreq   lifr;
↓ open down ↓ 1582 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX