summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
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
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')
-rw-r--r--meta/recipes-core/busybox/busybox-1.17.3/busybox-udhcpc-no_deconfig.patch110
-rw-r--r--meta/recipes-core/busybox/busybox.inc4
-rw-r--r--meta/recipes-core/busybox/busybox_1.17.3.bb4
-rwxr-xr-xmeta/recipes-core/busybox/files/busybox-udhcpc25
4 files changed, 141 insertions, 2 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;
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index 142c72f4e5..55f056c4c0 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -18,11 +18,12 @@ FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
18FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd" 18FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
19 19
20FILES_${PN} += "${datadir}/udhcpc" 20FILES_${PN} += "${datadir}/udhcpc"
21FILES_${PN} += "${sysconfdir}/init.d/busybox-udhcpc"
21 22
22INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd" 23INITSCRIPT_PACKAGES = "${PN} ${PN}-httpd ${PN}-udhcpd"
23INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd" 24INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
24INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd" 25INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd"
25INITSCRIPT_NAME_${PN} = "syslog" 26INITSCRIPT_NAME_${PN} = "syslog busybox-udhcpc"
26CONFFILES_${PN} = "${sysconfdir}/syslog.conf.${PN}" 27CONFFILES_${PN} = "${sysconfdir}/syslog.conf.${PN}"
27 28
28# This disables the syslog startup links in slugos (see slugos-init) 29# This disables the syslog startup links in slugos (see slugos-init)
@@ -97,6 +98,7 @@ do_install () {
97 install -d ${D}${datadir}/udhcpc 98 install -d ${D}${datadir}/udhcpc
98 install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default 99 install -m 0755 ${S}/examples/udhcp/simple.script ${D}${sysconfdir}/udhcpc.d/50default
99 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script 100 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
101 install -m 0755 ${WORKDIR}/busybox-udhcpc ${D}${sysconfdir}/init.d/
100 fi 102 fi
101 103
102 install -m 0644 ${S}/busybox.links ${D}${sysconfdir} 104 install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
diff --git a/meta/recipes-core/busybox/busybox_1.17.3.bb b/meta/recipes-core/busybox/busybox_1.17.3.bb
index 9ecb36d647..c5fbe9c7b0 100644
--- a/meta/recipes-core/busybox/busybox_1.17.3.bb
+++ b/meta/recipes-core/busybox/busybox_1.17.3.bb
@@ -1,5 +1,5 @@
1require busybox.inc 1require busybox.inc
2PR = "r0" 2PR = "r1"
3 3
4SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ 4SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
5 file://udhcpscript.patch \ 5 file://udhcpscript.patch \
@@ -9,10 +9,12 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
9 file://busybox-appletlib-dependency.patch \ 9 file://busybox-appletlib-dependency.patch \
10 file://run-parts.in.usr-bin.patch \ 10 file://run-parts.in.usr-bin.patch \
11 file://make-382-fix.patch \ 11 file://make-382-fix.patch \
12 file://busybox-udhcpc-no_deconfig.patch \
12 file://find-touchscreen.sh \ 13 file://find-touchscreen.sh \
13 file://busybox-cron \ 14 file://busybox-cron \
14 file://busybox-httpd \ 15 file://busybox-httpd \
15 file://busybox-udhcpd \ 16 file://busybox-udhcpd \
17 file://busybox-udhcpc \
16 file://default.script \ 18 file://default.script \
17 file://simple.script \ 19 file://simple.script \
18 file://hwclock.sh \ 20 file://hwclock.sh \
diff --git a/meta/recipes-core/busybox/files/busybox-udhcpc b/meta/recipes-core/busybox/files/busybox-udhcpc
new file mode 100755
index 0000000000..2c43f8da2e
--- /dev/null
+++ b/meta/recipes-core/busybox/files/busybox-udhcpc
@@ -0,0 +1,25 @@
1#!/bin/sh
2#
3# (c) 2010-2011 Wind River Systems, Inc.
4#
5# Busybox udhcpc init script
6#
7# script to start the udpchc DHCP client on boots where
8# the parameter 'ip=dhcp' was included in the kernel parameters
9
10# ensure the required binaries are present
11[ -x /sbin/udhcpc ] || exit 1
12[ -x /bin/grep ] || exit 1
13[ -x /bin/mount ] || exit 1
14
15# ensure /proc is mounted
16if ! mount | grep -q "/proc "; then
17 exit 2
18fi
19
20rc=0
21if grep -q -E "\bip=dhcp\b" /proc/cmdline; then
22 /sbin/udhcpc -D -s /usr/share/udhcpc/default.script
23 rc=$?
24fi
25exit $rc