diff options
author | dh155122 <none@none> | 2006-06-08 19:21:20 -0700 |
---|---|---|
committer | dh155122 <none@none> | 2006-06-08 19:21:20 -0700 |
commit | c2934490a71fd1db5f18fa4b6f290718ef053845 (patch) | |
tree | 9282df8138d66360143fa47dbd3539ed14b7256b /usr/src | |
parent | 52d1efee5f53cb9fdefa0a02ae88d6c1822dc712 (diff) | |
download | illumos-gate-c2934490a71fd1db5f18fa4b6f290718ef053845.tar.gz |
6424883 dhcp client can end up idling in INIT if initial packets go unanswered
6425063 dhcp client: edge case can leave interface offer timer running indefinitely
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c | 1 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/sbin/dhcpagent/async.c | 17 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/sbin/dhcpagent/interface.c | 16 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/sbin/dhcpagent/interface.h | 8 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c | 13 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/sbin/dhcpagent/select.c | 11 |
6 files changed, 36 insertions, 30 deletions
diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c index d692509d09..ffd4d14f59 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c @@ -766,7 +766,6 @@ load_option: return; case DHCP_START: - assert(ifsp->if_state == INIT); (void) canonize_ifs(ifsp); /* diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/async.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/async.c index d7fb37970d..9700ca2a0f 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/async.c +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/async.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -181,7 +180,7 @@ async_finish(struct ifslist *ifsp) int async_cancel(struct ifslist *ifsp) { - boolean_t do_reset = B_FALSE; + boolean_t do_restart = B_FALSE; /* * we decide how to cancel the command depending on our @@ -217,11 +216,11 @@ async_cancel(struct ifslist *ifsp) /* * these states imply we're still trying to get a lease. - * just return to a clean slate (INIT) -- but not until + * jump to SELECTING and start from there -- but not until * after we've finished the asynchronous command! */ - do_reset = B_TRUE; + do_restart = B_TRUE; break; default: @@ -233,8 +232,8 @@ async_cancel(struct ifslist *ifsp) async_finish(ifsp); dhcpmsg(MSG_DEBUG, "async_cancel: asynchronous command (%d) aborted", ifsp->if_async.as_cmd); - if (do_reset) - reset_ifs(ifsp); + if (do_restart) + dhcp_selecting(ifsp); return (1); } diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/interface.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/interface.c index e79dcb0582..bdad88a741 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/interface.c +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/interface.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -450,6 +449,7 @@ init_ifs(struct ifslist *ifsp) ifsp->if_timer[DHCP_T1_TIMER] = -1; ifsp->if_timer[DHCP_T2_TIMER] = -1; ifsp->if_timer[DHCP_LEASE_TIMER] = -1; + ifsp->if_offer_timer = -1; set_packet_filter(ifsp->if_dlpi_fd, dhcp_filter, NULL, "DHCP"); @@ -509,6 +509,14 @@ reset_ifs(struct ifslist *ifsp) (void) unregister_acknak(ifsp); /* just in case */ cancel_ifs_timers(ifsp); + + if (ifsp->if_offer_timer != -1) { + if (iu_cancel_timer(tq, ifsp->if_offer_timer, NULL)) + (void) release_ifs(ifsp); + } + + stop_pkt_retransmission(ifsp); + init_ifs(ifsp); } diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/interface.h b/usr/src/cmd/cmd-inet/sbin/dhcpagent/interface.h index c525143060..ce2124a0c9 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/interface.h +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/interface.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -301,6 +300,7 @@ struct ifslist { stop_func_t *if_send_stop_func; uint32_t if_packet_sent; iu_timer_id_t if_retrans_timer; + iu_timer_id_t if_offer_timer; int if_script_fd; pid_t if_script_pid; diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c index ab6ebb78f5..3e8e66572c 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/request.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * REQUESTING state of the client state machine. @@ -73,6 +72,8 @@ dhcp_requesting(iu_tq_t *tqp, void *arg) PKT_LIST *offer; lease_t lease; + ifsp->if_offer_timer = -1; + if (check_ifs(ifsp) == 0) { (void) release_ifs(ifsp); return; @@ -93,8 +94,8 @@ dhcp_requesting(iu_tq_t *tqp, void *arg) * ourselves for callback. */ - if (iu_schedule_timer(tq, ifsp->if_offer_wait, - dhcp_requesting, ifsp) == -1) { + if ((ifsp->if_offer_timer = iu_schedule_timer(tq, + ifsp->if_offer_wait, dhcp_requesting, ifsp)) == -1) { /* * ugh. the best we can do at this point is diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/select.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/select.c index abd4b2def1..a582e7b008 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/select.c +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/select.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * SELECTING state of the client state machine. @@ -126,8 +125,8 @@ dhcp_selecting(struct ifslist *ifsp) hold_ifs(ifsp); - if (iu_schedule_timer(tq, ifsp->if_offer_wait, dhcp_requesting, - ifsp) == -1) { + if ((ifsp->if_offer_timer = iu_schedule_timer(tq, + ifsp->if_offer_wait, dhcp_requesting, ifsp)) == -1) { dhcpmsg(MSG_ERROR, "dhcp_selecting: cannot schedule to read " "OFFER packets"); |