aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipconfig.c
diff options
context:
space:
mode:
authorRainer Jochem <rainer.jochem@mpi-sb.mpg.de>2007-11-14 05:18:39 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:53:59 -0500
commit62013dbb8418eb7231c1577d238cf2e76b7696b0 (patch)
treedfcfab3399f653bdf04a9bec21acba294fcf075b /net/ipv4/ipconfig.c
parent20fea08b5fb639c4c175b5c74a2bb346c5c5bc2e (diff)
[IPV4] ipconfig: Implement DHCP Class-identifier
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>
Diffstat (limited to 'net/ipv4/ipconfig.c')
-rw-r--r--net/ipv4/ipconfig.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index b8f7763b2261..6422422b8e3d 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -140,6 +140,8 @@ __be32 ic_servaddr = NONE; /* Boot server IP address */
140__be32 root_server_addr = NONE; /* Address of NFS server */ 140__be32 root_server_addr = NONE; /* Address of NFS server */
141u8 root_server_path[256] = { 0, }; /* Path to mount as root */ 141u8 root_server_path[256] = { 0, }; /* Path to mount as root */
142 142
143static char vendor_class_identifier[253]; /* vendor class identifier */
144
143/* Persistent data: */ 145/* Persistent data: */
144 146
145static int ic_proto_used; /* Protocol used, if any */ 147static int ic_proto_used; /* Protocol used, if any */
@@ -588,6 +590,7 @@ ic_dhcp_init_options(u8 *options)
588 u8 mt = ((ic_servaddr == NONE) 590 u8 mt = ((ic_servaddr == NONE)
589 ? DHCPDISCOVER : DHCPREQUEST); 591 ? DHCPDISCOVER : DHCPREQUEST);
590 u8 *e = options; 592 u8 *e = options;
593 int len;
591 594
592#ifdef IPCONFIG_DEBUG 595#ifdef IPCONFIG_DEBUG
593 printk("DHCP: Sending message type %d\n", mt); 596 printk("DHCP: Sending message type %d\n", mt);
@@ -628,6 +631,16 @@ ic_dhcp_init_options(u8 *options)
628 *e++ = sizeof(ic_req_params); 631 *e++ = sizeof(ic_req_params);
629 memcpy(e, ic_req_params, sizeof(ic_req_params)); 632 memcpy(e, ic_req_params, sizeof(ic_req_params));
630 e += sizeof(ic_req_params); 633 e += sizeof(ic_req_params);
634
635 if (*vendor_class_identifier) {
636 printk(KERN_INFO "DHCP: sending class identifier \"%s\"\n",
637 vendor_class_identifier);
638 *e++ = 60; /* Class-identifier */
639 len = strlen(vendor_class_identifier);
640 *e++ = len;
641 memcpy(e, vendor_class_identifier, len);
642 e += len;
643 }
631 } 644 }
632 645
633 *e++ = 255; /* End of the list */ 646 *e++ = 255; /* End of the list */
@@ -1513,5 +1526,16 @@ static int __init nfsaddrs_config_setup(char *addrs)
1513 return ip_auto_config_setup(addrs); 1526 return ip_auto_config_setup(addrs);
1514} 1527}
1515 1528
1529static int __init vendor_class_identifier_setup(char *addrs)
1530{
1531 if (strlcpy(vendor_class_identifier, addrs,
1532 sizeof(vendor_class_identifier))
1533 >= sizeof(vendor_class_identifier))
1534 printk(KERN_WARNING "DHCP: vendorclass too long, truncated to \"%s\"",
1535 vendor_class_identifier);
1536 return 1;
1537}
1538
1516__setup("ip=", ip_auto_config_setup); 1539__setup("ip=", ip_auto_config_setup);
1517__setup("nfsaddrs=", nfsaddrs_config_setup); 1540__setup("nfsaddrs=", nfsaddrs_config_setup);
1541__setup("dhcpclass=", vendor_class_identifier_setup);