lkml.org 
[lkml]   [2007]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
From
SubjectRe: [PATCH] ipconfig.c : implement DHCP Class-identifier

Corrected version below.

> >+ printk(KERN_INFO "Sending class identifier \"%s\"\n",
> >+ vendor_class_identifier);
>
> Seems like useless noise.

This information is only sent in the case that the option is actually used.
And in this case it might be useful for the user to see to which string the
option was set.


--- net/ipv4/ipconfig.c.orig 2007-11-14 09:16:15.800566536 +0100
+++ net/ipv4/ipconfig.c 2007-11-14 09:16:20.200403710 +0100
@@ -139,6 +139,8 @@ __be32 ic_servaddr = NONE; /* Boot serve
__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 */
@@ -580,6 +582,7 @@ ic_dhcp_init_options(u8 *options)
u8 mt = ((ic_servaddr == NONE)
? DHCPDISCOVER : DHCPREQUEST);
u8 *e = options;
+ int len = 0;

#ifdef IPCONFIG_DEBUG
printk("DHCP: Sending message type %d\n", mt);
@@ -620,6 +623,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 "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 */
@@ -1507,5 +1520,16 @@ static int __init nfsaddrs_config_setup(
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 "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);



----


--- ../linux-2.6.23.1/Documentation/kernel-parameters.txt 2007-10-12 18:43:44.000000000 +0200
+++ Documentation/kernel-parameters.txt 2007-10-24 17:02:22.441454955 +0200
@@ -533,6 +533,10 @@ and is between 256 and 4096 characters.
dhash_entries= [KNL]
Set number of hash buckets for dentry cache.

+ dhcpclass= [IP_PNP]
+ Set DHCP Vendor Class Identifier to be sent
+ by the client.
+
digi= [HW,SERIAL]
IO parameters + enable/disable command.

Signed-off-by: Rainer Jochem <rainer.jochem@mpi-sb.mpg.de>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-11-14 09:47    [W:0.211 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site