changeset 13119:0e16e468e300

6965747 nwam can't deal with more than 16 interfaces on a system 6976821 missing log message argument in nwamd causes core dump 6976825 nwam wants too much information
author Renee Danson Sommerfeld <Renee.Sommerfeld@Oracle.COM>
date Fri, 13 Aug 2010 15:22:18 -0700
parents 98bb3694e858
children 33bb8a0301ab
files usr/src/cmd/cmd-inet/lib/nwamd/ncu_ip.c usr/src/lib/libnwam/common/libnwam_values.c
diffstat 2 files changed, 22 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/lib/nwamd/ncu_ip.c	Fri Aug 13 15:06:10 2010 -0700
+++ b/usr/src/cmd/cmd-inet/lib/nwamd/ncu_ip.c	Fri Aug 13 15:22:18 2010 -0700
@@ -688,7 +688,8 @@
  * finish the job of bringing the NCU online.
  */
 static boolean_t
-add_ip_address(const char *ifname, const struct nwamd_if_address *nifa)
+add_ip_address(const char *ifname, const struct nwamd_if_address *nifa,
+    boolean_t *do_inform)
 {
 	ipadm_status_t ipstatus;
 	ipadm_addr_info_t *addrinfo = NULL;
@@ -755,8 +756,18 @@
 				}
 				return (B_FALSE);
 			}
-			/* Do DHCP_INFORM using async ipadm_refresh_addr() */
-			nwamd_dhcp(ifname, nifa->ipaddr, DHCP_INFORM);
+			/*
+			 * Do DHCP_INFORM using async ipadm_refresh_addr().
+			 * Only need to do this once per interface, and we
+			 * do *not* need to do it if we are also getting a
+			 * dhcp lease; so we only send the INFORM if the
+			 * passed-in flag says to, and we clear the flag
+			 * once we've initiated the INFORM transaction.
+			 */
+			if (*do_inform) {
+				nwamd_dhcp(ifname, nifa->ipaddr, DHCP_INFORM);
+				*do_inform = B_FALSE;
+			}
 		}
 	}
 
@@ -770,6 +781,10 @@
 nwamd_configure_interface_addresses(nwamd_ncu_t *ncu)
 {
 	struct nwamd_if_address *nifap, *nifa = ncu->ncu_if.nwamd_if_list;
+	boolean_t do_inform;
+
+	/* only need an inform if we're not also getting a dhcp lease */
+	do_inform = !ncu->ncu_if.nwamd_if_dhcp_requested;
 
 	nlog(LOG_DEBUG, "nwamd_configure_interface_addresses(%s)",
 	    ncu->ncu_name);
@@ -778,7 +793,8 @@
 		if (nifap->configured)
 			continue;
 
-		nifap->configured = add_ip_address(ncu->ncu_name, nifap);
+		nifap->configured = add_ip_address(ncu->ncu_name, nifap,
+		    &do_inform);
 	}
 }
 
@@ -1319,7 +1335,7 @@
 	/* Make sure the NCU is in appropriate state for DHCP command */
 	ncu_obj = nwamd_ncu_object_find(NWAM_NCU_TYPE_INTERFACE, name);
 	if (ncu_obj == NULL) {
-		nlog(LOG_ERR, "start_dhcp: no IP object %s");
+		nlog(LOG_ERR, "start_dhcp: no IP object %s", name);
 		return (NULL);
 	}
 
--- a/usr/src/lib/libnwam/common/libnwam_values.c	Fri Aug 13 15:06:10 2010 -0700
+++ b/usr/src/lib/libnwam/common/libnwam_values.c	Fri Aug 13 15:22:18 2010 -0700
@@ -20,8 +20,7 @@
  */
 
 /*
- * 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 <assert.h>
@@ -82,9 +81,6 @@
 
 	*valuep = NULL;
 
-	if (numvalues > NWAM_MAX_NUM_VALUES)
-		return (NWAM_INVALID_ARG);
-
 	if ((newvalue = calloc(1, sizeof (struct nwam_value))) == NULL)
 		return (NWAM_NO_MEMORY);