summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorAnurag S. Maskey <Anurag.Maskey@Oracle.COM>2010-07-26 15:00:52 -0400
committerAnurag S. Maskey <Anurag.Maskey@Oracle.COM>2010-07-26 15:00:52 -0400
commit3dbbe3fb79c81fac93e4001bdf68eb06c8a086e8 (patch)
tree54ffc0396ded0fa0e0fba3cd299bd44bb5a7b068 /usr/src
parent67323fc4f7476c5e8b55a5fe505c6f2dbf00e89a (diff)
downloadillumos-gate-3dbbe3fb79c81fac93e4001bdf68eb06c8a086e8.tar.gz
6969190 nwamd needs to be more persistent in the face of dhcp failures
6939897 /etc/resolv.conf file content is missing when a profile with a static ip address is active
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/cmd-inet/lib/nwamd/ncu_ip.c69
-rw-r--r--usr/src/cmd/cmd-inet/sbin/dhcpagent/inform.c7
2 files changed, 37 insertions, 39 deletions
diff --git a/usr/src/cmd/cmd-inet/lib/nwamd/ncu_ip.c b/usr/src/cmd/cmd-inet/lib/nwamd/ncu_ip.c
index 1953be609f..787c519f31 100644
--- a/usr/src/cmd/cmd-inet/lib/nwamd/ncu_ip.c
+++ b/usr/src/cmd/cmd-inet/lib/nwamd/ncu_ip.c
@@ -1346,63 +1346,64 @@ retry:
}
ipstatus = ipadm_refresh_addr(ipadm_handle, aobjname,
IPADM_OPT_ACTIVE | IPADM_OPT_INFORM);
-
break;
}
case DHCP_START:
- {
ipstatus = ipadm_create_addr(ipadm_handle, ipaddr,
IPADM_OPT_ACTIVE);
+ break;
+ default:
+ nlog(LOG_ERR, "start_dhcp: invalid dhcp_ipc_type_t: %d", type);
+ goto done;
+ }
- if (ipstatus == IPADM_DHCP_IPC_TIMEOUT) {
- /*
- * DHCP timed out: change state for this NCU and enqueue
- * event to check NCU priority-groups. Only care for
- * DHCP requests (not informs).
- */
+ if (ipstatus == IPADM_DHCP_IPC_TIMEOUT) {
+ /*
+ * DHCP timed out: for DHCP_START requests, change state for
+ * this NCU and euqueue event to check NCU priority-groups;
+ * for DHCP_INFORM requests, nothing to do.
+ */
+ if (type == DHCP_START) {
char *object_name;
- nlog(LOG_INFO, "start_dhcp: DHCP timed out for %s",
- name);
+ nlog(LOG_INFO,
+ "start_dhcp: DHCP_START timed out for %s", name);
if (nwam_ncu_name_to_typed_name(name,
NWAM_NCU_TYPE_INTERFACE, &object_name)
!= NWAM_SUCCESS) {
nlog(LOG_ERR, "start_dhcp: "
- "nwam_ncu_name_to_typed_name failed "
- "for %s", name);
+ "nwam_ncu_name_to_typed_name failed for %s",
+ name);
goto done;
}
nwamd_object_set_state(NWAM_OBJECT_TYPE_NCU,
object_name, NWAM_STATE_OFFLINE_TO_ONLINE,
NWAM_AUX_STATE_IF_DHCP_TIMED_OUT);
nwamd_create_ncu_check_event(0);
-
free(object_name);
- goto done;
-
- } else if (ipstatus == IPADM_DHCP_IPC_ERROR &&
- retries++ < NWAMD_DHCP_RETRIES) {
- /*
- * Retry DHCP request as we may have been unplumbing
- * as part of the configuration phase.
- */
- nlog(LOG_ERR, "start_dhcp: will retry on %s in %d sec",
- name, NWAMD_DHCP_RETRY_WAIT_TIME);
- (void) sleep(NWAMD_DHCP_RETRY_WAIT_TIME);
- goto retry;
+ } else {
+ nlog(LOG_INFO,
+ "start_dhcp: DHCP_INFORM timed out for %s", name);
}
- break;
- }
- default:
- nlog(LOG_ERR, "start_dhcp: invalid dhcp_ipc_type_t: %d", type);
- goto done;
- }
- if (ipstatus != IPADM_SUCCESS) {
+ } else if ((ipstatus == IPADM_DHCP_IPC_ERROR ||
+ ipstatus == IPADM_IPC_ERROR) && retries++ < NWAMD_DHCP_RETRIES) {
+ /*
+ * Retry DHCP request as we may have been unplumbing as part
+ * of the configuration phase.
+ */
+ nlog(LOG_ERR, "start_dhcp: ipadm_%s_addr on %s returned: %s, "
+ "retrying in %d sec",
+ (type == DHCP_START ? "create" : "refresh"), name,
+ ipadm_status2str(ipstatus), NWAMD_DHCP_RETRY_WAIT_TIME);
+ (void) sleep(NWAMD_DHCP_RETRY_WAIT_TIME);
+ goto retry;
+
+ } else if (ipstatus != IPADM_SUCCESS) {
nlog(LOG_ERR, "start_dhcp: ipadm_%s_addr failed for %s: %s",
- (type == DHCP_START ? "create" : "refresh"),
- name, ipadm_status2str(ipstatus));
+ (type == DHCP_START ? "create" : "refresh"), name,
+ ipadm_status2str(ipstatus));
}
done:
diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/inform.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/inform.c
index f53944a006..d47125b78a 100644
--- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/inform.c
+++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/inform.c
@@ -19,14 +19,11 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
*
* INFORM_SENT state of the client state machine.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <time.h>
#include <sys/socket.h>
@@ -98,7 +95,7 @@ dhcp_inform(dhcp_smach_t *dsmp)
(void) add_pkt_opt(dpkt, CD_END, NULL, 0);
IN6_V4MAPPED_TO_IPADDR(&dsmp->dsm_server, server);
- if (!send_pkt(dsmp, dpkt, server, NULL)) {
+ if (!send_pkt(dsmp, dpkt, server, stop_informing)) {
dhcpmsg(MSG_ERROR, "dhcp_inform: send_pkt failed");
goto failed;
}