aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpc.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-11-05 01:24:14 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-11-05 01:24:14 +0100
commit2017d48c0d70bef8768efb42909e605ea8eb5a21 (patch)
treedf17440dcaa0c8e74fb63500e7e02094ba6b93ce /networking/udhcp/dhcpc.c
parentc0cae52662ccced9df19f19ec94238d1b1e3bd71 (diff)
downloadbusybox-w32-2017d48c0d70bef8768efb42909e605ea8eb5a21.tar.gz
busybox-w32-2017d48c0d70bef8768efb42909e605ea8eb5a21.tar.bz2
busybox-w32-2017d48c0d70bef8768efb42909e605ea8eb5a21.zip
udhcpc: deprecate --hostname NAME
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r--networking/udhcp/dhcpc.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 3d4c397ff..d0fe94a48 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -29,7 +29,7 @@
29#include <netpacket/packet.h> 29#include <netpacket/packet.h>
30#include <linux/filter.h> 30#include <linux/filter.h>
31 31
32/* struct client_config_t client_config is in bb_common_bufsiz1 */ 32/* "struct client_config_t client_config" is in bb_common_bufsiz1 */
33 33
34 34
35#if ENABLE_LONG_OPTS 35#if ENABLE_LONG_OPTS
@@ -598,6 +598,12 @@ static void add_client_options(struct dhcp_packet *packet)
598// if (client_config.boot_file) 598// if (client_config.boot_file)
599// strncpy((char*)packet->file, client_config.boot_file, sizeof(packet->file) - 1); 599// strncpy((char*)packet->file, client_config.boot_file, sizeof(packet->file) - 1);
600 } 600 }
601
602 // This will be needed if we remove -V VENDOR_STR in favor of
603 // -x vendor:VENDOR_STR
604 //if (!udhcp_find_option(packet.options, DHCP_VENDOR))
605 // /* not set, set the default vendor ID */
606 // ...add (DHCP_VENDOR, "udhcp "BB_VER) opt...
601} 607}
602 608
603/* RFC 2131 609/* RFC 2131
@@ -1086,7 +1092,6 @@ static void client_background(void)
1086//usage: "\n -x lease:3600 - option 51 (lease time)" 1092//usage: "\n -x lease:3600 - option 51 (lease time)"
1087//usage: "\n -x 0x3d:0100BEEFC0FFEE - option 61 (client id)" 1093//usage: "\n -x 0x3d:0100BEEFC0FFEE - option 61 (client id)"
1088//usage: "\n -F,--fqdn NAME Ask server to update DNS mapping for NAME" 1094//usage: "\n -F,--fqdn NAME Ask server to update DNS mapping for NAME"
1089//usage: "\n -H,-h,--hostname NAME Send NAME as client hostname (default none)"
1090//usage: "\n -V,--vendorclass VENDOR Vendor identifier (default 'udhcp VERSION')" 1095//usage: "\n -V,--vendorclass VENDOR Vendor identifier (default 'udhcp VERSION')"
1091//usage: "\n -C,--clientid-none Don't send MAC as client identifier" 1096//usage: "\n -C,--clientid-none Don't send MAC as client identifier"
1092//usage: IF_UDHCP_VERBOSE( 1097//usage: IF_UDHCP_VERBOSE(
@@ -1124,7 +1129,6 @@ static void client_background(void)
1124//usage: "\n -x lease:3600 - option 51 (lease time)" 1129//usage: "\n -x lease:3600 - option 51 (lease time)"
1125//usage: "\n -x 0x3d:0100BEEFC0FFEE - option 61 (client id)" 1130//usage: "\n -x 0x3d:0100BEEFC0FFEE - option 61 (client id)"
1126//usage: "\n -F NAME Ask server to update DNS mapping for NAME" 1131//usage: "\n -F NAME Ask server to update DNS mapping for NAME"
1127//usage: "\n -H,-h NAME Send NAME as client hostname (default none)"
1128//usage: "\n -V VENDOR Vendor identifier (default 'udhcp VERSION')" 1132//usage: "\n -V VENDOR Vendor identifier (default 'udhcp VERSION')"
1129//usage: "\n -C Don't send MAC as client identifier" 1133//usage: "\n -C Don't send MAC as client identifier"
1130//usage: IF_UDHCP_VERBOSE( 1134//usage: IF_UDHCP_VERBOSE(
@@ -1187,8 +1191,11 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1187 IF_FEATURE_UDHCP_PORT(, &str_P) 1191 IF_FEATURE_UDHCP_PORT(, &str_P)
1188 IF_UDHCP_VERBOSE(, &dhcp_verbose) 1192 IF_UDHCP_VERBOSE(, &dhcp_verbose)
1189 ); 1193 );
1190 if (opt & (OPT_h|OPT_H)) 1194 if (opt & (OPT_h|OPT_H)) {
1195 //msg added 2011-11
1196 bb_error_msg("option -h NAME is deprecated, use -x hostname:NAME");
1191 client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0); 1197 client_config.hostname = alloc_dhcp_option(DHCP_HOST_NAME, str_h, 0);
1198 }
1192 if (opt & OPT_F) { 1199 if (opt & OPT_F) {
1193 /* FQDN option format: [0x51][len][flags][0][0]<fqdn> */ 1200 /* FQDN option format: [0x51][len][flags][0][0]<fqdn> */
1194 client_config.fqdn = alloc_dhcp_option(DHCP_FQDN, str_F, 3); 1201 client_config.fqdn = alloc_dhcp_option(DHCP_FQDN, str_F, 3);
@@ -1249,8 +1256,16 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
1249 clientid_mac_ptr = client_config.clientid + OPT_DATA+1; 1256 clientid_mac_ptr = client_config.clientid + OPT_DATA+1;
1250 memcpy(clientid_mac_ptr, client_config.client_mac, 6); 1257 memcpy(clientid_mac_ptr, client_config.client_mac, 6);
1251 } 1258 }
1252 if (str_V[0] != '\0') 1259 if (str_V[0] != '\0') {
1260 // can drop -V, str_V, client_config.vendorclass,
1261 // but need to add "vendor" to the list of recognized
1262 // string opts for this to work;
1263 // and need to tweak add_client_options() too...
1264 // ...so the question is, should we?
1265 //bb_error_msg("option -V VENDOR is deprecated, use -x vendor:VENDOR");
1253 client_config.vendorclass = alloc_dhcp_option(DHCP_VENDOR, str_V, 0); 1266 client_config.vendorclass = alloc_dhcp_option(DHCP_VENDOR, str_V, 0);
1267 }
1268
1254#if !BB_MMU 1269#if !BB_MMU
1255 /* on NOMMU reexec (i.e., background) early */ 1270 /* on NOMMU reexec (i.e., background) early */
1256 if (!(opt & OPT_f)) { 1271 if (!(opt & OPT_f)) {