summaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpc.c
diff options
context:
space:
mode:
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 f54bc08..7fca184 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -133,6 +133,7 @@ int udhcpc_main(int argc, char **argv)
{
uint8_t *temp, *message;
char *str_c, *str_V, *str_h, *str_F, *str_r, *str_T, *str_A, *str_t;
+ USE_FEATURE_UDHCP_PORT(char *str_P;)
llist_t *list_O = NULL;
#if ENABLE_FEATURE_UDHCPC_ARPING
char *str_W;
@@ -181,6 +182,7 @@ int udhcpc_main(int argc, char **argv)
OPT_a = 1 << 20,
OPT_W = 1 << 21,
#endif
+ OPT_P = 1 << 22,
};
#if ENABLE_GETOPT_LONG
static const char udhcpc_longopts[] ALIGN1 =
@@ -207,9 +209,16 @@ int udhcpc_main(int argc, char **argv)
"arping\0" No_argument "a"
#endif
"request-option\0" Required_argument "O"
+#if ENABLE_FEATURE_UDHCP_PORT
+ "client-port\0" Required_argument "P"
+#endif
;
#endif
/* Default options. */
+#if ENABLE_FEATURE_UDHCP_PORT
+ SERVER_PORT = 67;
+ CLIENT_PORT = 68;
+#endif
client_config.interface = "eth0";
client_config.script = DEFAULT_SCRIPT;
@@ -220,11 +229,13 @@ int udhcpc_main(int argc, char **argv)
#endif
opt = getopt32(argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vSA:"
USE_FEATURE_UDHCPC_ARPING("aW:")
+ USE_FEATURE_UDHCP_PORT("P:")
"O:"
, &str_c, &str_V, &str_h, &str_h, &str_F
, &client_config.interface, &client_config.pidfile, &str_r
, &client_config.script, &str_T, &str_t, &str_A
USE_FEATURE_UDHCPC_ARPING(, &str_W)
+ USE_FEATURE_UDHCP_PORT(, &str_P)
, &list_O
);
@@ -276,6 +287,12 @@ int udhcpc_main(int argc, char **argv)
openlog(applet_name, LOG_PID, LOG_LOCAL0);
logmode |= LOGMODE_SYSLOG;
}
+#if ENABLE_FEATURE_UDHCP_PORT
+ if (opt & OPT_P) {
+ CLIENT_PORT = xatou16(str_P);
+ SERVER_PORT = CLIENT_PORT - 1;
+ }
+#endif
while (list_O) {
int n = index_in_strings(dhcp_option_strings, list_O->data);
if (n < 0)