Skip to content

Commit

Permalink
[IPV4] ipconfig: Implement DHCP Class-identifier
Browse files Browse the repository at this point in the history
From : Rainer Jochem <rainer.jochem@mpi-sb.mpg.de>

Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rainer Jochem authored and David S. Miller committed Jan 28, 2008
1 parent 20fea08 commit 62013db
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions net/ipv4/ipconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ __be32 ic_servaddr = NONE; /* Boot server IP address */
__be32 root_server_addr = NONE; /* Address of NFS server */
u8 root_server_path[256] = { 0, }; /* Path to mount as root */

static char vendor_class_identifier[253]; /* vendor class identifier */

/* Persistent data: */

static int ic_proto_used; /* Protocol used, if any */
Expand Down Expand Up @@ -588,6 +590,7 @@ ic_dhcp_init_options(u8 *options)
u8 mt = ((ic_servaddr == NONE)
? DHCPDISCOVER : DHCPREQUEST);
u8 *e = options;
int len;

#ifdef IPCONFIG_DEBUG
printk("DHCP: Sending message type %d\n", mt);
Expand Down Expand Up @@ -628,6 +631,16 @@ ic_dhcp_init_options(u8 *options)
*e++ = sizeof(ic_req_params);
memcpy(e, ic_req_params, sizeof(ic_req_params));
e += sizeof(ic_req_params);

if (*vendor_class_identifier) {
printk(KERN_INFO "DHCP: sending class identifier \"%s\"\n",
vendor_class_identifier);
*e++ = 60; /* Class-identifier */
len = strlen(vendor_class_identifier);
*e++ = len;
memcpy(e, vendor_class_identifier, len);
e += len;
}
}

*e++ = 255; /* End of the list */
Expand Down Expand Up @@ -1513,5 +1526,16 @@ static int __init nfsaddrs_config_setup(char *addrs)
return ip_auto_config_setup(addrs);
}

static int __init vendor_class_identifier_setup(char *addrs)
{
if (strlcpy(vendor_class_identifier, addrs,
sizeof(vendor_class_identifier))
>= sizeof(vendor_class_identifier))
printk(KERN_WARNING "DHCP: vendorclass too long, truncated to \"%s\"",
vendor_class_identifier);
return 1;
}

__setup("ip=", ip_auto_config_setup);
__setup("nfsaddrs=", nfsaddrs_config_setup);
__setup("dhcpclass=", vendor_class_identifier_setup);

0 comments on commit 62013db

Please sign in to comment.