Print this page
NEX-7968 libipadm returns reversed value for standby interface property
Reviewed by: Dan Fields <dan.fields@nexenta.com>
OS-161: Integrate IPMP changes

*** 16,28 **** --- 16,30 ---- * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ + /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright 2016 Nexenta Systems, Inc. */ /* * This file contains routines that are used to modify/retrieve protocol or * interface property values. It also holds all the supported properties for
*** 143,152 **** --- 145,159 ---- { "hostmodel", NULL, IPADMPROP_CLASS_MODULE, MOD_PROTO_IPV4, 0, i_ipadm_set_hostmodel, i_ipadm_get_hostmodel, i_ipadm_get_hostmodel }, + { "standby", NULL, IPADMPROP_CLASS_IF, MOD_PROTO_IP, 0, + i_ipadm_set_ifprop_flags, i_ipadm_get_onoff, + i_ipadm_get_ifprop_flags }, + + { 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};
*** 593,603 **** if (flags & IPADM_OPT_DEFAULT) { if (strcmp(pdp->ipd_name, "exchange_routes") == 0 || strcmp(pdp->ipd_name, "arp") == 0 || strcmp(pdp->ipd_name, "nud") == 0) { pval = IPADM_ONSTR; ! } else if (strcmp(pdp->ipd_name, "forwarding") == 0) { pval = IPADM_OFFSTR; } else { return (IPADM_PROP_UNKNOWN); } } --- 600,611 ---- if (flags & IPADM_OPT_DEFAULT) { if (strcmp(pdp->ipd_name, "exchange_routes") == 0 || strcmp(pdp->ipd_name, "arp") == 0 || strcmp(pdp->ipd_name, "nud") == 0) { pval = IPADM_ONSTR; ! } else if (strcmp(pdp->ipd_name, "forwarding") == 0 || ! strcmp(pdp->ipd_name, "standby") == 0) { pval = IPADM_OFFSTR; } else { return (IPADM_PROP_UNKNOWN); } }
*** 627,636 **** --- 635,649 ---- } else if (strcmp(pdp->ipd_name, "forwarding") == 0) { if (on) on_flags = IFF_ROUTER; else off_flags = IFF_ROUTER; + } else if (strcmp(pdp->ipd_name, "standby") == 0) { + if (on) + on_flags = IFF_STANDBY; + else + off_flags = IFF_STANDBY; } if (on_flags || off_flags) { status = i_ipadm_set_flags(iph, ifname, af, on_flags, off_flags);
*** 995,1005 **** case MOD_PROP_DEFAULT: if (strcmp(pdp->ipd_name, "exchange_routes") == 0 || strcmp(pdp->ipd_name, "arp") == 0 || strcmp(pdp->ipd_name, "nud") == 0) { val = IPADM_ONSTR; ! } else if (strcmp(pdp->ipd_name, "forwarding") == 0) { val = IPADM_OFFSTR; } else { return (IPADM_PROP_UNKNOWN); } nbytes = snprintf(buf, *bufsize, "%s", val); --- 1008,1019 ---- case MOD_PROP_DEFAULT: if (strcmp(pdp->ipd_name, "exchange_routes") == 0 || strcmp(pdp->ipd_name, "arp") == 0 || strcmp(pdp->ipd_name, "nud") == 0) { val = IPADM_ONSTR; ! } else if (strcmp(pdp->ipd_name, "forwarding") == 0 || ! strcmp(pdp->ipd_name, "standby") == 0) { val = IPADM_OFFSTR; } else { return (IPADM_PROP_UNKNOWN); } nbytes = snprintf(buf, *bufsize, "%s", val);
*** 1021,1030 **** --- 1035,1047 ---- if (!(intf_flags & IFF_NOARP)) val = IPADM_ONSTR; } else if (strcmp(pdp->ipd_name, "nud") == 0) { if (!(intf_flags & IFF_NONUD)) val = IPADM_ONSTR; + } else if (strcmp(pdp->ipd_name, "standby") == 0) { + if (intf_flags & IFF_STANDBY) + val = IPADM_ONSTR; } nbytes = snprintf(buf, *bufsize, "%s", val); break; default: return (IPADM_INVALID_ARG);
*** 1696,1707 **** /* * This is called from ipadm_set_ifprop() to validate the set operation. * It does the following steps: * 1. Validates the interface name. ! * 2. Fails if it is an IPMP meta-interface or an underlying interface. ! * 3. In case of a persistent operation, verifies that the * interface is persistent. */ static ipadm_status_t i_ipadm_validate_if(ipadm_handle_t iph, const char *ifname, uint_t proto, uint_t flags) --- 1713,1723 ---- /* * This is called from ipadm_set_ifprop() to validate the set operation. * It does the following steps: * 1. Validates the interface name. ! * 2. In case of a persistent operation, verifies that the * interface is persistent. */ static ipadm_status_t i_ipadm_validate_if(ipadm_handle_t iph, const char *ifname, uint_t proto, uint_t flags)
*** 1714,1729 **** /* Check if the interface name is valid. */ if (!i_ipadm_validate_ifname(iph, ifname)) return (IPADM_INVALID_ARG); af = (proto == MOD_PROTO_IPV6 ? AF_INET6 : AF_INET); - /* - * Setting properties on an IPMP meta-interface or underlying - * interface is not supported. - */ - if (i_ipadm_is_ipmp(iph, ifname) || i_ipadm_is_under_ipmp(iph, ifname)) - return (IPADM_NOTSUP); /* Check if interface exists in the persistent configuration. */ status = i_ipadm_if_pexists(iph, ifname, af, &p_exists); if (status != IPADM_SUCCESS) return (status); --- 1730,1739 ----