6927499 ipmgmtd will go out of sync when an interface is moved into an IPMP group
authorGirish Moodalbail <Girish.Moodalbail@Sun.COM>
Wed, 31 Mar 2010 14:09:08 -0400
changeset 12048 162e93ccf12f
parent 12047 7c1fcc8419ca
child 12049 5f14b1b5f869
6927499 ipmgmtd will go out of sync when an interface is moved into an IPMP group
usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c
usr/src/lib/libipadm/common/ipadm_if.c
usr/src/lib/libipadm/common/libipadm.h
usr/src/lib/libipadm/common/mapfile-vers
--- a/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c	Wed Mar 31 09:39:29 2010 -0600
+++ b/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c	Wed Mar 31 14:09:08 2010 -0400
@@ -1,6 +1,5 @@
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Copyright (c) 1983 Regents of the University of California.
@@ -2207,6 +2206,15 @@
 	}
 
 	/*
+	 * If the interface being moved is under the control of `ipmgmtd(1M)'
+	 * dameon then we should inform the daemon about this move, so that
+	 * the daemon can delete the state associated with this interface.
+	 *
+	 * This workaround is needed until the IPMP support in ipadm(1M).
+	 */
+	ipadm_if_move(iph, name);
+
+	/*
 	 * If there were addresses that we had to bring down, it's time to
 	 * bring them up again.  As part of bringing them up, the kernel will
 	 * automatically move them to the new IPMP interface.
--- a/usr/src/lib/libipadm/common/ipadm_if.c	Wed Mar 31 09:39:29 2010 -0600
+++ b/usr/src/lib/libipadm/common/ipadm_if.c	Wed Mar 31 14:09:08 2010 -0400
@@ -19,8 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <errno.h>
@@ -1532,3 +1531,20 @@
 		return (IPADM_FAILURE);
 	}
 }
+
+/*
+ * This workaround is until libipadm supports IPMP and is required whenever an
+ * interface is moved into an IPMP group. Since libipadm doesn't support IPMP
+ * yet, we will have to update the daemon's in-memory mapping of
+ * `aobjname' to 'lifnum'.
+ *
+ * For `IPMGMT_ACTIVE' case, i_ipadm_delete_ifobj() would only fail if
+ * door_call(3C) fails. Also, there is no use in returning error because
+ * `ifname' would have been successfuly moved into IPMP group, by this time.
+ */
+void
+ipadm_if_move(ipadm_handle_t iph, const char *ifname)
+{
+	(void) i_ipadm_delete_ifobj(iph, ifname, AF_INET, B_FALSE);
+	(void) i_ipadm_delete_ifobj(iph, ifname, AF_INET6, B_FALSE);
+}
--- a/usr/src/lib/libipadm/common/libipadm.h	Wed Mar 31 09:39:29 2010 -0600
+++ b/usr/src/lib/libipadm/common/libipadm.h	Wed Mar 31 14:09:08 2010 -0400
@@ -19,8 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  */
 #ifndef _LIBIPADM_H
 #define	_LIBIPADM_H
@@ -258,6 +257,7 @@
 extern void		ipadm_free_if_info(ipadm_if_info_t *);
 extern ipadm_status_t	ipadm_delete_if(ipadm_handle_t, const char *,
 			    sa_family_t, uint32_t);
+extern void		ipadm_if_move(ipadm_handle_t, const char *);
 
 /*
  * Address management functions
--- a/usr/src/lib/libipadm/common/mapfile-vers	Wed Mar 31 09:39:29 2010 -0600
+++ b/usr/src/lib/libipadm/common/mapfile-vers	Wed Mar 31 14:09:08 2010 -0400
@@ -19,11 +19,9 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 #
 
-
 #
 # MAPFILE HEADER START
 #
@@ -63,6 +61,7 @@
 	ipadm_get_prop;
 	ipadm_if_enabled;
 	ipadm_if_info;
+	ipadm_if_move;
 	ipadm_init_prop;
 	ipadm_ndpd_read;
 	ipadm_ndpd_write;