Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From 53626cd06a3ef05ed847daea802ef0aa9661caa7 Mon Sep 17 00:00:00 2001 |
| 2 | From: Anders Darander <anders@chargestorm.se> |
| 3 | Date: Thu, 3 Nov 2011 08:51:31 +0100 |
| 4 | Subject: [PATCH] busybox-udhcpc-no_deconfig.patch |
| 5 | |
| 6 | Upstream-Status: Pending |
| 7 | |
| 8 | Add a new option -D to the udhcpc client that allows for |
| 9 | dhcp renewal to occur without having to down the interface |
| 10 | in the process. |
| 11 | |
| 12 | Signed-off-by: Greg Moffatt <greg.moffatt@windriver.com> |
| 13 | |
| 14 | Updated to latest Busybox 1.17.3 |
| 15 | |
| 16 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> |
| 17 | |
| 18 | Updated to Busybox 1.18.4 |
| 19 | option spec is changed |
| 20 | |
| 21 | Signed-off-by: Qing He <qing.he@intel.com> |
| 22 | |
| 23 | Updated to Busybox 1.19.3 |
| 24 | |
| 25 | Signed-off-by: Anders Darander <anders@chargestorm.se> |
| 26 | |
| 27 | Fixed options -b, -a and -P. |
| 28 | |
| 29 | Signed-off-by: Andreas Oberritter <obi@opendreambox.org> |
| 30 | --- |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 31 | networking/udhcp/dhcpc.c | 29 ++++++++++++++++------ |
| 32 | 1 file changed, 21 insertions(+), 8 deletions(-) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 33 | |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 34 | Index: busybox-1.34.0/networking/udhcp/dhcpc.c |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 35 | =================================================================== |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 36 | --- busybox-1.34.0.orig/networking/udhcp/dhcpc.c |
| 37 | +++ busybox-1.34.0/networking/udhcp/dhcpc.c |
| 38 | @@ -48,6 +48,8 @@ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 39 | }; |
| 40 | #endif |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 41 | |
| 42 | +/* option whether to down the interface when reconfiguring */ |
| 43 | +static int allow_deconfig = 1; |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 44 | |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 45 | /* "struct client_data_t client_data" is in bb_common_bufsiz1 */ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 47 | @@ -100,8 +102,10 @@ |
| 48 | OPT_x = 1 << 16, |
| 49 | OPT_f = 1 << 17, |
| 50 | OPT_B = 1 << 18, |
| 51 | + OPT_D = 1 << 19, |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 52 | /* The rest has variable bit positions, need to be clever */ |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 53 | OPTBIT_B = 18, |
| 54 | + OPTBIT_D = 19, |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | USE_FOR_MMU( OPTBIT_b,) |
| 56 | IF_FEATURE_UDHCPC_ARPING(OPTBIT_a,) |
| 57 | IF_FEATURE_UDHCP_PORT( OPTBIT_P,) |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 58 | @@ -587,7 +591,8 @@ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 59 | |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 60 | static void d4_run_script_deconfig(void) |
| 61 | { |
| 62 | - d4_run_script(NULL, "deconfig"); |
| 63 | + if (allow_deconfig) |
| 64 | + d4_run_script(NULL, "deconfig"); |
| 65 | } |
| 66 | |
| 67 | /*** Sending/receiving packets ***/ |
| 68 | @@ -1244,7 +1249,7 @@ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 69 | /* Parse command line */ |
| 70 | opt = getopt32long(argv, "^" |
| 71 | /* O,x: list; -T,-t,-A take numeric param */ |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 72 | - "CV:F:i:np:qRr:s:T:+t:+SA:+O:*ox:*fB" |
| 73 | + "CV:F:i:np:qRr:s:T:+t:+SA:+O:*ox:*fBD" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 74 | USE_FOR_MMU("b") |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 75 | IF_FEATURE_UDHCPC_ARPING("a::") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 76 | IF_FEATURE_UDHCP_PORT("P:") |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 77 | @@ -1361,6 +1366,10 @@ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 78 | logmode |= LOGMODE_SYSLOG; |
| 79 | } |
| 80 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 81 | + if (opt & OPT_D) { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 82 | + allow_deconfig = 0; |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 83 | + } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 84 | + |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 85 | /* Create pidfile */ |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 86 | write_pidfile(client_data.pidfile); |
| 87 | /* Goes to stdout (unless NOMMU) and possibly syslog */ |