aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Korsgaard <peter@korsgaard.com>2016-08-26 18:46:34 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-08-26 18:46:34 +0200
commitb6355e2bb5c931413735b7df2964e20e050bbc07 (patch)
tree3b05bb9db066f33c267adb4b2b607f725cb06eb6
parent0dddbc1a59795a77679d8c5ef48a2795cb470563 (diff)
downloadbusybox-w32-b6355e2bb5c931413735b7df2964e20e050bbc07.tar.gz
busybox-w32-b6355e2bb5c931413735b7df2964e20e050bbc07.tar.bz2
busybox-w32-b6355e2bb5c931413735b7df2964e20e050bbc07.zip
udhcpc: Unconditionally call deconfig script, not only if lease is active
The udhcpc script may be used to setup fallback configuration (E.G. IPv4LL, fixed IP address, ..) that also needs to be cleaned up on release (E.G. when SIGUSR2 is called or on shutdown with -R), so unconditionally call deconfig. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/d6_dhcpc.c9
-rw-r--r--networking/udhcp/dhcpc.c13
2 files changed, 16 insertions, 6 deletions
diff --git a/networking/udhcp/d6_dhcpc.c b/networking/udhcp/d6_dhcpc.c
index 6ff040d9e..ddf3412a0 100644
--- a/networking/udhcp/d6_dhcpc.c
+++ b/networking/udhcp/d6_dhcpc.c
@@ -800,10 +800,15 @@ static void perform_d6_release(struct in6_addr *server_ipv6, struct in6_addr *ou
800 ) { 800 ) {
801 bb_error_msg("unicasting a release"); 801 bb_error_msg("unicasting a release");
802 send_d6_release(server_ipv6, our_cur_ipv6); /* unicast */ 802 send_d6_release(server_ipv6, our_cur_ipv6); /* unicast */
803 d6_run_script(NULL, "deconfig");
804 } 803 }
805 bb_error_msg("entering released state"); 804 bb_error_msg("entering released state");
806 805/*
806 * We can be here on: SIGUSR2,
807 * or on exit (SIGTERM) and -R "release on quit" is specified.
808 * Users requested to be notified in all cases, even if not in one
809 * of the states above.
810 */
811 d6_run_script(NULL, "deconfig");
807 change_listen_mode(LISTEN_NONE); 812 change_listen_mode(LISTEN_NONE);
808 state = RELEASED; 813 state = RELEASED;
809} 814}
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 8a16e987d..bef73277a 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1129,9 +1129,15 @@ static void perform_release(uint32_t server_addr, uint32_t requested_ip)
1129 bb_error_msg("unicasting a release of %s to %s", 1129 bb_error_msg("unicasting a release of %s to %s",
1130 inet_ntoa(temp_addr), buffer); 1130 inet_ntoa(temp_addr), buffer);
1131 send_release(server_addr, requested_ip); /* unicast */ 1131 send_release(server_addr, requested_ip); /* unicast */
1132 udhcp_run_script(NULL, "deconfig");
1133 } 1132 }
1134 bb_error_msg("entering released state"); 1133 bb_error_msg("entering released state");
1134/*
1135 * We can be here on: SIGUSR2,
1136 * or on exit (SIGTERM) and -R "release on quit" is specified.
1137 * Users requested to be notified in all cases, even if not in one
1138 * of the states above.
1139 */
1140 udhcp_run_script(NULL, "deconfig");
1135 1141
1136 change_listen_mode(LISTEN_NONE); 1142 change_listen_mode(LISTEN_NONE);
1137 state = RELEASED; 1143 state = RELEASED;
@@ -1813,9 +1819,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1813 temp = udhcp_get_option(&packet, DHCP_SERVER_ID); 1819 temp = udhcp_get_option(&packet, DHCP_SERVER_ID);
1814 if (!temp) { 1820 if (!temp) {
1815 non_matching_svid: 1821 non_matching_svid:
1816 log1("%s with wrong server ID, ignoring packet", 1822 log1("received DHCP NAK with wrong"
1817 "Received DHCP NAK" 1823 " server ID, ignoring packet");
1818 );
1819 continue; 1824 continue;
1820 } 1825 }
1821 move_from_unaligned32(svid, temp); 1826 move_from_unaligned32(svid, temp);