Print this page
Commit IPMP changes

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2014 Nexenta Systems, Inc. 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

@@ -143,10 +144,15 @@
 
         { "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,11 +599,12 @@
         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) {
+                } else if (strcmp(pdp->ipd_name, "forwarding") == 0 ||
+                    strcmp(pdp->ipd_name, "standby") == 0) {
                         pval = IPADM_OFFSTR;
                 } else {
                         return (IPADM_PROP_UNKNOWN);
                 }
         }

@@ -627,10 +634,15 @@
         } 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,11 +1007,12 @@
         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) {
+                } 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,10 +1034,13 @@
                         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,12 +1712,11 @@
 
 /*
  * 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
+ * 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,16 +1729,10 @@
         /* 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);