summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-03-30 02:25:14 +0800
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-04-03 11:39:29 +0800
commitb0660bd84f9cace354383eb7b8fce7ba19fd4992 (patch)
tree732c62d1e93b77b6c9a819acf6e8a499fcbde618 /net
parent7fd2d7658e9454cc166177d64491763568ffde91 (diff)
downloadbarebox-b0660bd84f9cace354383eb7b8fce7ba19fd4992.tar.gz
barebox-b0660bd84f9cace354383eb7b8fce7ba19fd4992.tar.xz
net: dhcp: allow to set transmitted client id
For net boot setups it is useful to submit boot params like server or bootfile over dhcp. To distinguish diffrent type of OS running on the same hardware, a custom client id can be sent in dhcp discover/request messages. E.g. the ISC dhcp server can be configured with | class "at91sam9x5ek" { | match if substring (option vendor-class-identifier,0,20) = "barebox-at91sam9x5ek"; | | filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage"; | if substring (option dhcp-client-identifier,0,7) = "ser2net" { | filename "/tftpboot/atmel/at91sam9x5/sam9x5ek/zImage-ser2net"; | } | option tftp-server-name "192.168.200.98"; | option option-150 192.168.200.98; | next-server 192.168.200.98; | option root-path "192.168.200.98:/opt/work/buildroot/build/sam9x5/target"; | } Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'net')
-rw-r--r--net/dhcp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/net/dhcp.c b/net/dhcp.c
index ed0925420b..cf3e70a9f4 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -234,12 +234,17 @@ static int dhcp_set_string_options(struct dhcp_param *param, u8 *e)
}
#define DHCP_VENDOR_ID 60
+#define DHCP_CLIENT_ID 61
struct dhcp_param dhcp_params[] = {
{
.option = DHCP_VENDOR_ID,
.handle = dhcp_set_string_options,
.barebox_var_name = "dhcp_vendor_id",
+ }, {
+ .option = DHCP_CLIENT_ID,
+ .handle = dhcp_set_string_options,
+ .barebox_var_name = "dhcp_client_id",
}
};
@@ -595,11 +600,14 @@ static int do_dhcp(int argc, char *argv[])
dhcp_reset_env();
- while((opt = getopt(argc, argv, "v:")) > 0) {
+ while((opt = getopt(argc, argv, "v:c:")) > 0) {
switch(opt) {
case 'v':
dhcp_set_param_data(DHCP_VENDOR_ID, optarg);
break;
+ case 'c':
+ dhcp_set_param_data(DHCP_CLIENT_ID, optarg);
+ break;
}
}