diff --git a/net/dhcp.c b/net/dhcp.c index c7c6271..ad32b53 100644 --- a/net/dhcp.c +++ b/net/dhcp.c @@ -235,6 +235,7 @@ #define DHCP_VENDOR_ID 60 #define DHCP_CLIENT_ID 61 +#define DHCP_USER_CLASS 77 #define DHCP_CLIENT_UUID 97 struct dhcp_param dhcp_params[] = { @@ -247,6 +248,10 @@ .handle = dhcp_set_string_options, .barebox_var_name = "dhcp_client_id", }, { + .option = DHCP_USER_CLASS, + .handle = dhcp_set_string_options, + .barebox_var_name = "dhcp_user_class", + }, { .option = DHCP_CLIENT_UUID, .handle = dhcp_set_string_options, .barebox_var_name = "dhcp_client_uuid", @@ -605,7 +610,7 @@ dhcp_reset_env(); - while((opt = getopt(argc, argv, "v:c:u:")) > 0) { + while((opt = getopt(argc, argv, "v:c:u:U:")) > 0) { switch(opt) { case 'v': dhcp_set_param_data(DHCP_VENDOR_ID, optarg); @@ -616,6 +621,9 @@ case 'u': dhcp_set_param_data(DHCP_CLIENT_UUID, optarg); break; + case 'U': + dhcp_set_param_data(DHCP_USER_CLASS, optarg); + break; } } @@ -671,6 +679,10 @@ BAREBOX_CMD_HELP_OPT ("-u ", "DHCP Client UUID (code 97) submitted in DHCP requests. It can\n" "be used in the DHCP server's configuration to select options\n" +"(e.g. bootfile or server) which are valid for barebox clients only.\n") +BAREBOX_CMD_HELP_OPT ("-U ", +"DHCP User class (code 77) submitted in DHCP requests. It can\n" +"be used in the DHCP server's configuration to select options\n" "(e.g. bootfile or server) which are valid for barebox clients only.\n"); BAREBOX_CMD_HELP_END @@ -688,4 +700,5 @@ BAREBOX_MAGICVAR(dhcp_vendor_id, "vendor id to send to the DHCP server"); BAREBOX_MAGICVAR(dhcp_client_uuid, "cliend uuid to send to the DHCP server"); BAREBOX_MAGICVAR(dhcp_client_id, "cliend id to send to the DHCP server"); +BAREBOX_MAGICVAR(dhcp_user_class, "user class to send to the DHCP server"); BAREBOX_MAGICVAR(dhcp_tftp_server_name, "TFTP server Name returned from DHCP request");