summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/busybox/busybox-1.17.3/busybox-udhcpc-no_deconfig.patch
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2011-02-03 19:29:50 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-07 16:52:41 +0000
commit427472e980cd6254a5e4ef37209b327e15af259b (patch)
tree3e49401693b1b6b0334cd69e90cb763d5bbd660b /meta/recipes-core/busybox/busybox-1.17.3/busybox-udhcpc-no_deconfig.patch
parent5ade6c7de84893b4f94f7c068d775beeaecb9f5f (diff)
downloadpoky-427472e980cd6254a5e4ef37209b327e15af259b.tar.gz
busybox: Support DHCP refresh without restarting the interface
When the kernel is started using ip=dhcp, we want a way to be able to run the udhcp client within busybox and not reset the interface. When using the '-D' option to udhcpc, the defconfig script will be skipped allowing the refresh without changing the network settings. Also provide an initscript that can be used to detect ip=dhcp on the kernel command line, if detected it will refresh the lease and set the proper resolve.conf and related files, but not reset the interface. Original code in Wind River Linux by Greg Moffatt <greg.moffat@windriver.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'meta/recipes-core/busybox/busybox-1.17.3/busybox-udhcpc-no_deconfig.patch')
-rw-r--r--meta/recipes-core/busybox/busybox-1.17.3/busybox-udhcpc-no_deconfig.patch110
1 files changed, 110 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox-1.17.3/busybox-udhcpc-no_deconfig.patch b/meta/recipes-core/busybox/busybox-1.17.3/busybox-udhcpc-no_deconfig.patch
new file mode 100644
index 0000000000..cdf56b826c
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox-1.17.3/busybox-udhcpc-no_deconfig.patch
@@ -0,0 +1,110 @@
1Add a new option -D to the udhcpc client that allows for
2dhcp renewal to occur without having to down the interface
3in the process.
4
5Signed-off-by: Greg Moffatt <greg.moffatt@windriver.com>
6
7Updated to latest Busybox 1.17.3
8
9Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
10
11diff -ur busybox-1.17.3.orig/networking/udhcp/dhcpc.c busybox-1.17.3/networking/udhcp/dhcpc.c
12--- busybox-1.17.3.orig/networking/udhcp/dhcpc.c
13+++ busybox-1.17.3/networking/udhcp/dhcpc.c
14@@ -35,6 +35,9 @@
15 #endif
16 #include <linux/filter.h>
17
18+/* option whether to down the interface when reconfiguring */
19+static int allow_deconfig = 1;
20+
21 /* struct client_config_t client_config is in bb_common_bufsiz1 */
22
23
24@@ -709,7 +712,8 @@
25 state = RENEW_REQUESTED;
26 break;
27 case RENEW_REQUESTED: /* impatient are we? fine, square 1 */
28- udhcp_run_script(NULL, "deconfig");
29+ if (allow_deconfig)
30+ udhcp_run_script(NULL, "deconfig");
31 case REQUESTING:
32 case RELEASED:
33 change_listen_mode(LISTEN_RAW);
34@@ -733,7 +737,8 @@
35 bb_info_msg("Unicasting a release of %s to %s",
36 inet_ntoa(temp_addr), buffer);
37 send_release(server_addr, requested_ip); /* unicast */
38- udhcp_run_script(NULL, "deconfig");
39+ if (allow_deconfig)
40+ udhcp_run_script(NULL, "deconfig");
41 }
42 bb_info_msg("Entering released state");
43
44@@ -836,6 +841,7 @@
45 OPT_o = 1 << 18,
46 OPT_x = 1 << 19,
47 OPT_f = 1 << 20,
48+ OPT_D = 1 << 21,
49 /* The rest has variable bit positions, need to be clever */
50 OPTBIT_f = 20,
51 USE_FOR_MMU( OPTBIT_b,)
52@@ -861,7 +867,7 @@
53 #endif
54 ;
55 IF_LONG_OPTS(applet_long_options = udhcpc_longopts;)
56- opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:f"
57+ opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fD"
58 USE_FOR_MMU("b")
59 IF_FEATURE_UDHCPC_ARPING("a")
60 IF_FEATURE_UDHCP_PORT("P:")
61@@ -950,6 +956,9 @@
62 logmode |= LOGMODE_SYSLOG;
63 }
64
65+ if (opt & OPT_D)
66+ allow_deconfig = 0;
67+
68 /* Make sure fd 0,1,2 are open */
69 bb_sanitize_stdio();
70 /* Equivalent of doing a fflush after every \n */
71@@ -964,7 +973,8 @@
72 srand(monotonic_us());
73
74 state = INIT_SELECTING;
75- udhcp_run_script(NULL, "deconfig");
76+ if (allow_deconfig)
77+ udhcp_run_script(NULL, "deconfig");
78 change_listen_mode(LISTEN_RAW);
79 packet_num = 0;
80 timeout = 0;
81@@ -1100,7 +1110,8 @@
82 }
83 /* Timed out, enter init state */
84 bb_info_msg("Lease lost, entering init state");
85- udhcp_run_script(NULL, "deconfig");
86+ if (allow_deconfig)
87+ udhcp_run_script(NULL, "deconfig");
88 state = INIT_SELECTING;
89 /*timeout = 0; - already is */
90 packet_num = 0;
91@@ -1246,7 +1257,8 @@
92 send_decline(xid, server_addr, packet.yiaddr);
93
94 if (state != REQUESTING)
95- udhcp_run_script(NULL, "deconfig");
96+ if (allow_deconfig)
97+ udhcp_run_script(NULL, "deconfig");
98 change_listen_mode(LISTEN_RAW);
99 state = INIT_SELECTING;
100 requested_ip = 0;
101@@ -1292,7 +1304,8 @@
102 bb_info_msg("Received DHCP NAK");
103 udhcp_run_script(&packet, "nak");
104 if (state != REQUESTING)
105- udhcp_run_script(NULL, "deconfig");
106+ if (allow_deconfig)
107+ udhcp_run_script(NULL, "deconfig");
108 change_listen_mode(LISTEN_RAW);
109 sleep(3); /* avoid excessive network traffic */
110 state = INIT_SELECTING;