summaryrefslogtreecommitdiff
path: root/networking/udhcp
diff options
context:
space:
mode:
authorMike Frysinger2004-12-06 14:59:45 +0000
committerMike Frysinger2004-12-06 14:59:45 +0000
commitd824853de335d969f4d009f445bb6dfb1b18493b (patch)
treede7b963864e86c6012fb8da1fb64ab780e906af5 /networking/udhcp
parentdcc286607c83723f2b05f91da0a6942999576106 (diff)
downloadbusybox-d824853de335d969f4d009f445bb6dfb1b18493b.zip
busybox-d824853de335d969f4d009f445bb6dfb1b18493b.tar.gz
merge from udhcp module
Diffstat (limited to 'networking/udhcp')
-rw-r--r--networking/udhcp/README.udhcpc3
-rw-r--r--networking/udhcp/clientpacket.c1
-rw-r--r--networking/udhcp/dhcpc.c24
-rw-r--r--networking/udhcp/dhcpc.h1
-rw-r--r--networking/udhcp/dhcpd.h1
-rw-r--r--networking/udhcp/options.c4
6 files changed, 30 insertions, 4 deletions
diff --git a/networking/udhcp/README.udhcpc b/networking/udhcp/README.udhcpc
index d720a37..e19bf37 100644
--- a/networking/udhcp/README.udhcpc
+++ b/networking/udhcp/README.udhcpc
@@ -12,7 +12,8 @@ The command line options for the udhcp client are:
-c, --clientid=CLIENTID Client identifier
-H, --hostname=HOSTNAME Client hostname
--h, Alias for -H
+-h, Alias for -H
+-F, --fqdn=FQDN Client fully qualified domain name
-f, --foreground Do not fork after getting lease
-b, --background Fork to background if lease cannot be
immediately negotiated.
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c
index ec96601..c5e1c21 100644
--- a/networking/udhcp/clientpacket.c
+++ b/networking/udhcp/clientpacket.c
@@ -78,6 +78,7 @@ static void init_packet(struct dhcpMessage *packet, char type)
memcpy(packet->chaddr, client_config.arp, 6);
add_option_string(packet->options, client_config.clientid);
if (client_config.hostname) add_option_string(packet->options, client_config.hostname);
+ if (client_config.fqdn) add_option_string(packet->options, client_config.fqdn);
add_option_string(packet->options, (uint8_t *) &vendor_id);
}
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 449b517..95fa815 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -67,6 +67,7 @@ struct client_config_t client_config = {
script: DEFAULT_SCRIPT,
clientid: NULL,
hostname: NULL,
+ fqdn: NULL,
ifindex: 0,
arp: "\0\0\0\0\0\0", /* appease gcc-3.0 */
};
@@ -79,6 +80,7 @@ static void __attribute__ ((noreturn)) show_usage(void)
" -c, --clientid=CLIENTID Client identifier\n"
" -H, --hostname=HOSTNAME Client hostname\n"
" -h Alias for -H\n"
+" -F, --fqdn=FQDN Client fully qualified domain name\n"
" -f, --foreground Do not fork after getting lease\n"
" -b, --background Fork to background if lease cannot be\n"
" immediately negotiated.\n"
@@ -197,7 +199,8 @@ int main(int argc, char *argv[])
{"foreground", no_argument, 0, 'f'},
{"background", no_argument, 0, 'b'},
{"hostname", required_argument, 0, 'H'},
- {"hostname", required_argument, 0, 'h'},
+ {"hostname", required_argument, 0, 'h'},
+ {"fqdn", required_argument, 0, 'F'},
{"interface", required_argument, 0, 'i'},
{"now", no_argument, 0, 'n'},
{"pidfile", required_argument, 0, 'p'},
@@ -211,7 +214,7 @@ int main(int argc, char *argv[])
/* get options */
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index);
+ c = getopt_long(argc, argv, "c:fbH:h:F:i:np:qr:s:v", arg_options, &option_index);
if (c == -1) break;
switch (c) {
@@ -239,6 +242,23 @@ int main(int argc, char *argv[])
client_config.hostname[OPT_LEN] = len;
strncpy(client_config.hostname + 2, optarg, len);
break;
+ case 'F':
+ len = strlen(optarg) > 255 ? 255 : strlen(optarg);
+ if (client_config.fqdn) free(client_config.fqdn);
+ client_config.fqdn = xmalloc(len + 5);
+ client_config.fqdn[OPT_CODE] = DHCP_FQDN;
+ client_config.fqdn[OPT_LEN] = len + 3;
+ /* Flags: 0000NEOS
+ S: 1 => Client requests Server to update A RR in DNS as well as PTR
+ O: 1 => Server indicates to client that DNS has been updated regardless
+ E: 1 => Name data is DNS format, i.e. <4>host<6>domain<4>com<0> not "host.domain.com"
+ N: 1 => Client requests Server to not update DNS
+ */
+ client_config.fqdn[OPT_LEN + 1] = 0x1;
+ client_config.fqdn[OPT_LEN + 2] = 0;
+ client_config.fqdn[OPT_LEN + 3] = 0;
+ strncpy(client_config.fqdn + 5, optarg, len);
+ break;
case 'i':
client_config.interface = optarg;
break;
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index 9c4aa95..77c1809 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -27,6 +27,7 @@ struct client_config_t {
char *script; /* User script to run at dhcp events */
uint8_t *clientid; /* Optional client id to use */
uint8_t *hostname; /* Optional hostname to use */
+ uint8_t *fqdn; /* Optional fully qualified domain name to use */
int ifindex; /* Index number of the interface to use */
uint8_t arp[6]; /* Our arp address */
};
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h
index c47f6aa..65c8348 100644
--- a/networking/udhcp/dhcpd.h
+++ b/networking/udhcp/dhcpd.h
@@ -63,6 +63,7 @@
#define DHCP_T2 0x3b
#define DHCP_VENDOR 0x3c
#define DHCP_CLIENT_ID 0x3d
+#define DHCP_FQDN 0x51
#define DHCP_END 0xFF
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c
index d75bc5a..ae98194 100644
--- a/networking/udhcp/options.c
+++ b/networking/udhcp/options.c
@@ -32,7 +32,9 @@ struct dhcp_option dhcp_options[] = {
{"ipttl", OPTION_U8, 0x17},
{"mtu", OPTION_U16, 0x1a},
{"broadcast", OPTION_IP | OPTION_REQ, 0x1c},
- {"ntpsrv", OPTION_IP | OPTION_LIST, 0x2a},
+ {"nisdomain", OPTION_STRING | OPTION_REQ, 0x28},
+ {"nissrv", OPTION_IP | OPTION_LIST | OPTION_REQ, 0x29},
+ {"ntpsrv", OPTION_IP | OPTION_LIST | OPTION_REQ, 0x2a},
{"wins", OPTION_IP | OPTION_LIST, 0x2c},
{"requestip", OPTION_IP, 0x32},
{"lease", OPTION_U32, 0x33},