diff options
author | Mike Frysinger <vapier@gentoo.org> | 2004-12-06 14:59:45 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2004-12-06 14:59:45 +0000 |
commit | d824853de335d969f4d009f445bb6dfb1b18493b (patch) | |
tree | de7b963864e86c6012fb8da1fb64ab780e906af5 /networking/udhcp/dhcpc.c | |
parent | dcc286607c83723f2b05f91da0a6942999576106 (diff) | |
download | busybox-w32-d824853de335d969f4d009f445bb6dfb1b18493b.tar.gz busybox-w32-d824853de335d969f4d009f445bb6dfb1b18493b.tar.bz2 busybox-w32-d824853de335d969f4d009f445bb6dfb1b18493b.zip |
merge from udhcp module
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r-- | networking/udhcp/dhcpc.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 449b51763..95fa8150d 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -67,6 +67,7 @@ struct client_config_t client_config = { | |||
67 | script: DEFAULT_SCRIPT, | 67 | script: DEFAULT_SCRIPT, |
68 | clientid: NULL, | 68 | clientid: NULL, |
69 | hostname: NULL, | 69 | hostname: NULL, |
70 | fqdn: NULL, | ||
70 | ifindex: 0, | 71 | ifindex: 0, |
71 | arp: "\0\0\0\0\0\0", /* appease gcc-3.0 */ | 72 | arp: "\0\0\0\0\0\0", /* appease gcc-3.0 */ |
72 | }; | 73 | }; |
@@ -79,6 +80,7 @@ static void __attribute__ ((noreturn)) show_usage(void) | |||
79 | " -c, --clientid=CLIENTID Client identifier\n" | 80 | " -c, --clientid=CLIENTID Client identifier\n" |
80 | " -H, --hostname=HOSTNAME Client hostname\n" | 81 | " -H, --hostname=HOSTNAME Client hostname\n" |
81 | " -h Alias for -H\n" | 82 | " -h Alias for -H\n" |
83 | " -F, --fqdn=FQDN Client fully qualified domain name\n" | ||
82 | " -f, --foreground Do not fork after getting lease\n" | 84 | " -f, --foreground Do not fork after getting lease\n" |
83 | " -b, --background Fork to background if lease cannot be\n" | 85 | " -b, --background Fork to background if lease cannot be\n" |
84 | " immediately negotiated.\n" | 86 | " immediately negotiated.\n" |
@@ -197,7 +199,8 @@ int main(int argc, char *argv[]) | |||
197 | {"foreground", no_argument, 0, 'f'}, | 199 | {"foreground", no_argument, 0, 'f'}, |
198 | {"background", no_argument, 0, 'b'}, | 200 | {"background", no_argument, 0, 'b'}, |
199 | {"hostname", required_argument, 0, 'H'}, | 201 | {"hostname", required_argument, 0, 'H'}, |
200 | {"hostname", required_argument, 0, 'h'}, | 202 | {"hostname", required_argument, 0, 'h'}, |
203 | {"fqdn", required_argument, 0, 'F'}, | ||
201 | {"interface", required_argument, 0, 'i'}, | 204 | {"interface", required_argument, 0, 'i'}, |
202 | {"now", no_argument, 0, 'n'}, | 205 | {"now", no_argument, 0, 'n'}, |
203 | {"pidfile", required_argument, 0, 'p'}, | 206 | {"pidfile", required_argument, 0, 'p'}, |
@@ -211,7 +214,7 @@ int main(int argc, char *argv[]) | |||
211 | /* get options */ | 214 | /* get options */ |
212 | while (1) { | 215 | while (1) { |
213 | int option_index = 0; | 216 | int option_index = 0; |
214 | c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index); | 217 | c = getopt_long(argc, argv, "c:fbH:h:F:i:np:qr:s:v", arg_options, &option_index); |
215 | if (c == -1) break; | 218 | if (c == -1) break; |
216 | 219 | ||
217 | switch (c) { | 220 | switch (c) { |
@@ -239,6 +242,23 @@ int main(int argc, char *argv[]) | |||
239 | client_config.hostname[OPT_LEN] = len; | 242 | client_config.hostname[OPT_LEN] = len; |
240 | strncpy(client_config.hostname + 2, optarg, len); | 243 | strncpy(client_config.hostname + 2, optarg, len); |
241 | break; | 244 | break; |
245 | case 'F': | ||
246 | len = strlen(optarg) > 255 ? 255 : strlen(optarg); | ||
247 | if (client_config.fqdn) free(client_config.fqdn); | ||
248 | client_config.fqdn = xmalloc(len + 5); | ||
249 | client_config.fqdn[OPT_CODE] = DHCP_FQDN; | ||
250 | client_config.fqdn[OPT_LEN] = len + 3; | ||
251 | /* Flags: 0000NEOS | ||
252 | S: 1 => Client requests Server to update A RR in DNS as well as PTR | ||
253 | O: 1 => Server indicates to client that DNS has been updated regardless | ||
254 | E: 1 => Name data is DNS format, i.e. <4>host<6>domain<4>com<0> not "host.domain.com" | ||
255 | N: 1 => Client requests Server to not update DNS | ||
256 | */ | ||
257 | client_config.fqdn[OPT_LEN + 1] = 0x1; | ||
258 | client_config.fqdn[OPT_LEN + 2] = 0; | ||
259 | client_config.fqdn[OPT_LEN + 3] = 0; | ||
260 | strncpy(client_config.fqdn + 5, optarg, len); | ||
261 | break; | ||
242 | case 'i': | 262 | case 'i': |
243 | client_config.interface = optarg; | 263 | client_config.interface = optarg; |
244 | break; | 264 | break; |