Print this page
3942 inject sanity into ipadm tcp buffer size properties
3943 _snd_lowat_fraction tcp tunable has no effect
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Peng Dai <peng.dai@delphix.com>

*** 18,27 **** --- 18,28 ---- * * CDDL HEADER END */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ /* * This file contains routines that are used to modify/retrieve protocol or * interface property values. It also holds all the supported properties for
*** 86,252 **** /* * Supported IP protocol properties. */ static ipadm_prop_desc_t ipadm_ip_prop_table[] = { ! { "arp", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0, i_ipadm_set_ifprop_flags, i_ipadm_get_onoff, i_ipadm_get_ifprop_flags }, ! { "forwarding", IPADMPROP_CLASS_MODIF, MOD_PROTO_IPV4, 0, i_ipadm_set_forwarding, i_ipadm_get_onoff, i_ipadm_get_forwarding }, ! { "metric", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0, i_ipadm_set_metric, NULL, i_ipadm_get_metric }, ! { "mtu", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0, i_ipadm_set_mtu, i_ipadm_get_mtu, i_ipadm_get_mtu }, ! { "exchange_routes", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0, i_ipadm_set_ifprop_flags, i_ipadm_get_onoff, i_ipadm_get_ifprop_flags }, ! { "usesrc", IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0, i_ipadm_set_usesrc, NULL, i_ipadm_get_usesrc }, ! { "ttl", IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV4, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "forwarding", IPADMPROP_CLASS_MODIF, MOD_PROTO_IPV6, 0, i_ipadm_set_forwarding, i_ipadm_get_onoff, i_ipadm_get_forwarding }, ! { "hoplimit", IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV6, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "metric", IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0, i_ipadm_set_metric, NULL, i_ipadm_get_metric }, ! { "mtu", IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0, i_ipadm_set_mtu, i_ipadm_get_mtu, i_ipadm_get_mtu }, ! { "nud", IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0, i_ipadm_set_ifprop_flags, i_ipadm_get_onoff, i_ipadm_get_ifprop_flags }, ! { "exchange_routes", IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0, i_ipadm_set_ifprop_flags, i_ipadm_get_onoff, i_ipadm_get_ifprop_flags }, ! { "usesrc", IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0, i_ipadm_set_usesrc, NULL, i_ipadm_get_usesrc }, ! { "hostmodel", IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV6, 0, i_ipadm_set_hostmodel, i_ipadm_get_hostmodel, i_ipadm_get_hostmodel }, ! { "hostmodel", IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV4, 0, i_ipadm_set_hostmodel, i_ipadm_get_hostmodel, i_ipadm_get_hostmodel }, ! { NULL, 0, 0, 0, NULL, NULL, NULL } }; /* possible values for TCP properties `ecn' and `sack' */ static const char *ecn_sack_vals[] = {"never", "passive", "active", NULL}; /* Supported TCP protocol properties */ static ipadm_prop_desc_t ipadm_tcp_prop_table[] = { ! { "ecn", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_ecnsack, i_ipadm_get_ecnsack, i_ipadm_get_ecnsack }, ! { "extra_priv_ports", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, IPADMPROP_MULVAL, i_ipadm_set_eprivport, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "largest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "sack", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_ecnsack, i_ipadm_get_ecnsack, i_ipadm_get_ecnsack }, ! { "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_nonpriv_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, ! i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { NULL, 0, 0, 0, NULL, NULL, NULL } }; /* Supported UDP protocol properties */ static ipadm_prop_desc_t ipadm_udp_prop_table[] = { ! { "extra_priv_ports", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, IPADMPROP_MULVAL, i_ipadm_set_eprivport, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "largest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_nonpriv_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { NULL, 0, 0, 0, NULL, NULL, NULL } }; /* Supported SCTP protocol properties */ static ipadm_prop_desc_t ipadm_sctp_prop_table[] = { ! { "extra_priv_ports", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, IPADMPROP_MULVAL, i_ipadm_set_eprivport, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "largest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_anon_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_nonpriv_port", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { NULL, 0, 0, 0, NULL, NULL, NULL } }; /* Supported ICMP protocol properties */ static ipadm_prop_desc_t ipadm_icmp_prop_table[] = { ! { "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { NULL, 0, 0, 0, NULL, NULL, NULL } }; /* * A dummy private property structure, used while handling private * protocol properties (properties not yet supported by libipadm). */ ! static ipadm_prop_desc_t ipadm_privprop =\ ! { NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_NONE, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }; /* * Returns the property description table, for the given protocol */ --- 87,265 ---- /* * Supported IP protocol properties. */ static ipadm_prop_desc_t ipadm_ip_prop_table[] = { ! { "arp", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0, i_ipadm_set_ifprop_flags, i_ipadm_get_onoff, i_ipadm_get_ifprop_flags }, ! { "forwarding", NULL, IPADMPROP_CLASS_MODIF, MOD_PROTO_IPV4, 0, i_ipadm_set_forwarding, i_ipadm_get_onoff, i_ipadm_get_forwarding }, ! { "metric", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0, i_ipadm_set_metric, NULL, i_ipadm_get_metric }, ! { "mtu", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0, i_ipadm_set_mtu, i_ipadm_get_mtu, i_ipadm_get_mtu }, ! { "exchange_routes", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0, i_ipadm_set_ifprop_flags, i_ipadm_get_onoff, i_ipadm_get_ifprop_flags }, ! { "usesrc", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV4, 0, i_ipadm_set_usesrc, NULL, i_ipadm_get_usesrc }, ! { "ttl", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV4, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "forwarding", NULL, IPADMPROP_CLASS_MODIF, MOD_PROTO_IPV6, 0, i_ipadm_set_forwarding, i_ipadm_get_onoff, i_ipadm_get_forwarding }, ! { "hoplimit", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV6, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "metric", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0, i_ipadm_set_metric, NULL, i_ipadm_get_metric }, ! { "mtu", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0, i_ipadm_set_mtu, i_ipadm_get_mtu, i_ipadm_get_mtu }, ! { "nud", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0, i_ipadm_set_ifprop_flags, i_ipadm_get_onoff, i_ipadm_get_ifprop_flags }, ! { "exchange_routes", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0, i_ipadm_set_ifprop_flags, i_ipadm_get_onoff, i_ipadm_get_ifprop_flags }, ! { "usesrc", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IPV6, 0, i_ipadm_set_usesrc, NULL, i_ipadm_get_usesrc }, ! { "hostmodel", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV6, 0, i_ipadm_set_hostmodel, i_ipadm_get_hostmodel, i_ipadm_get_hostmodel }, ! { "hostmodel", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV4, 0, i_ipadm_set_hostmodel, i_ipadm_get_hostmodel, i_ipadm_get_hostmodel }, ! { NULL, NULL, 0, 0, 0, NULL, NULL, NULL } }; /* possible values for TCP properties `ecn' and `sack' */ static const char *ecn_sack_vals[] = {"never", "passive", "active", NULL}; /* Supported TCP protocol properties */ static ipadm_prop_desc_t ipadm_tcp_prop_table[] = { ! { "ecn", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_ecnsack, i_ipadm_get_ecnsack, i_ipadm_get_ecnsack }, ! { "extra_priv_ports", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, IPADMPROP_MULVAL, i_ipadm_set_eprivport, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "largest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "max_buf", "_max_buf", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "recv_buf", "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, ! i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! ! { "sack", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_ecnsack, i_ipadm_get_ecnsack, i_ipadm_get_ecnsack }, ! { "send_buf", "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_nonpriv_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_TCP, ! 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { NULL, NULL, 0, 0, 0, NULL, NULL, NULL } }; /* Supported UDP protocol properties */ static ipadm_prop_desc_t ipadm_udp_prop_table[] = { ! { "extra_priv_ports", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, IPADMPROP_MULVAL, i_ipadm_set_eprivport, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "largest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "max_buf", "_max_buf", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "recv_buf", "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "send_buf", "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_nonpriv_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_UDP, ! 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! ! { NULL, NULL, 0, 0, 0, NULL, NULL, NULL } }; /* Supported SCTP protocol properties */ static ipadm_prop_desc_t ipadm_sctp_prop_table[] = { ! { "extra_priv_ports", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, IPADMPROP_MULVAL, i_ipadm_set_eprivport, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "largest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "max_buf", "_max_buf", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "recv_buf", "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "send_buf", "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_anon_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "smallest_nonpriv_port", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_SCTP, ! 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! ! { NULL, NULL, 0, 0, 0, NULL, NULL, NULL } }; /* Supported ICMP protocol properties */ static ipadm_prop_desc_t ipadm_icmp_prop_table[] = { ! { "max_buf", "_max_buf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "recv_buf", "recv_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! { "send_buf", "send_maxbuf", IPADMPROP_CLASS_MODULE, MOD_PROTO_RAWIP, 0, ! i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }, ! ! { NULL, NULL, 0, 0, 0, NULL, NULL, NULL } }; /* * A dummy private property structure, used while handling private * protocol properties (properties not yet supported by libipadm). */ ! static ipadm_prop_desc_t ipadm_privprop = ! { NULL, NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_NONE, 0, i_ipadm_set_prop, i_ipadm_get_prop, i_ipadm_get_prop }; /* * Returns the property description table, for the given protocol */
*** 280,296 **** if ((ipdtbl = i_ipadm_get_propdesc_table(proto)) == NULL) { err = EINVAL; goto ret; } for (ipdp = ipdtbl; ipdp->ipd_name != NULL; ipdp++) { ! if (strcmp(pname, ipdp->ipd_name) == 0) { matched_name = B_TRUE; if (ipdp->ipd_proto == proto) break; } } if (ipdp->ipd_name == NULL) { err = ENOENT; /* if we matched name, but failed protocol check */ if (matched_name) err = EPROTO; --- 293,313 ---- if ((ipdtbl = i_ipadm_get_propdesc_table(proto)) == NULL) { err = EINVAL; goto ret; } + for (ipdp = ipdtbl; ipdp->ipd_name != NULL; ipdp++) { ! if (strcmp(pname, ipdp->ipd_name) == 0 || ! (ipdp->ipd_old_name != NULL && ! strcmp(pname, ipdp->ipd_old_name) == 0)) { matched_name = B_TRUE; if (ipdp->ipd_proto == proto) break; } } + if (ipdp->ipd_name == NULL) { err = ENOENT; /* if we matched name, but failed protocol check */ if (matched_name) err = EPROTO;