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