summaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpc.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-04 13:12:16 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-04 13:12:16 +0000
commitd55fe3e595eb0aad60484d273e251cfee4ef8aa5 (patch)
tree1b9ff57d70411902db36582da8dbaded99485eeb /networking/udhcp/dhcpc.c
parente8ef7ec7de0cd9906b42a94eddb800ed1229a614 (diff)
downloadbusybox-w32-d55fe3e595eb0aad60484d273e251cfee4ef8aa5.tar.gz
busybox-w32-d55fe3e595eb0aad60484d273e251cfee4ef8aa5.tar.bz2
busybox-w32-d55fe3e595eb0aad60484d273e251cfee4ef8aa5.zip
udhcp: optional support for non-standard DHCP ports (+300 bytes when selected)
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r--networking/udhcp/dhcpc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index f54bc08f1..7fca184ab 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -133,6 +133,7 @@ int udhcpc_main(int argc, char **argv)
133{ 133{
134 uint8_t *temp, *message; 134 uint8_t *temp, *message;
135 char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_A, *str_t; 135 char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_A, *str_t;
136 USE_FEATURE_UDHCP_PORT(char *str_P;)
136 llist_t *list_O = NULL; 137 llist_t *list_O = NULL;
137#if ENABLE_FEATURE_UDHCPC_ARPING 138#if ENABLE_FEATURE_UDHCPC_ARPING
138 char *str_W; 139 char *str_W;
@@ -181,6 +182,7 @@ int udhcpc_main(int argc, char **argv)
181 OPT_a = 1 << 20, 182 OPT_a = 1 << 20,
182 OPT_W = 1 << 21, 183 OPT_W = 1 << 21,
183#endif 184#endif
185 OPT_P = 1 << 22,
184 }; 186 };
185#if ENABLE_GETOPT_LONG 187#if ENABLE_GETOPT_LONG
186 static const char udhcpc_longopts[] ALIGN1 = 188 static const char udhcpc_longopts[] ALIGN1 =
@@ -207,9 +209,16 @@ int udhcpc_main(int argc, char **argv)
207 "arping\0" No_argument "a" 209 "arping\0" No_argument "a"
208#endif 210#endif
209 "request-option\0" Required_argument "O" 211 "request-option\0" Required_argument "O"
212#if ENABLE_FEATURE_UDHCP_PORT
213 "client-port\0" Required_argument "P"
214#endif
210 ; 215 ;
211#endif 216#endif
212 /* Default options. */ 217 /* Default options. */
218#if ENABLE_FEATURE_UDHCP_PORT
219 SERVER_PORT = 67;
220 CLIENT_PORT = 68;
221#endif
213 client_config.interface = "eth0"; 222 client_config.interface = "eth0";
214 client_config.script = DEFAULT_SCRIPT; 223 client_config.script = DEFAULT_SCRIPT;
215 224
@@ -220,11 +229,13 @@ int udhcpc_main(int argc, char **argv)
220#endif 229#endif
221 opt = getopt32(argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vSA:" 230 opt = getopt32(argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vSA:"
222 USE_FEATURE_UDHCPC_ARPING("aW:") 231 USE_FEATURE_UDHCPC_ARPING("aW:")
232 USE_FEATURE_UDHCP_PORT("P:")
223 "O:" 233 "O:"
224 , &str_c, &str_V, &str_h, &str_h, &str_F 234 , &str_c, &str_V, &str_h, &str_h, &str_F
225 , &client_config.interface, &client_config.pidfile, &str_r 235 , &client_config.interface, &client_config.pidfile, &str_r
226 , &client_config.script, &str_T, &str_t, &str_A 236 , &client_config.script, &str_T, &str_t, &str_A
227 USE_FEATURE_UDHCPC_ARPING(, &str_W) 237 USE_FEATURE_UDHCPC_ARPING(, &str_W)
238 USE_FEATURE_UDHCP_PORT(, &str_P)
228 , &list_O 239 , &list_O
229 ); 240 );
230 241
@@ -276,6 +287,12 @@ int udhcpc_main(int argc, char **argv)
276 openlog(applet_name, LOG_PID, LOG_LOCAL0); 287 openlog(applet_name, LOG_PID, LOG_LOCAL0);
277 logmode |= LOGMODE_SYSLOG; 288 logmode |= LOGMODE_SYSLOG;
278 } 289 }
290#if ENABLE_FEATURE_UDHCP_PORT
291 if (opt & OPT_P) {
292 CLIENT_PORT = xatou16(str_P);
293 SERVER_PORT = CLIENT_PORT - 1;
294 }
295#endif
279 while (list_O) { 296 while (list_O) {
280 int n = index_in_strings(dhcp_option_strings, list_O->data); 297 int n = index_in_strings(dhcp_option_strings, list_O->data);
281 if (n < 0) 298 if (n < 0)