]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/ipconfig.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/linville/wireles...
[linux-2.6-omap-h63xx.git] / net / ipv4 / ipconfig.c
index b8f7763b2261474e4e5d35961193bcdcbebf26cd..4afce057280600379a5e1960b57686213daf5632 100644 (file)
@@ -140,6 +140,9 @@ __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 */
 
+/* vendor class identifier */
+static char vendor_class_identifier[253] __initdata;
+
 /* Persistent data: */
 
 static int ic_proto_used;                      /* Protocol used, if any */
@@ -288,7 +291,7 @@ static int __init ic_dev_ioctl(unsigned int cmd, struct ifreq *arg)
 
        mm_segment_t oldfs = get_fs();
        set_fs(get_ds());
-       res = devinet_ioctl(cmd, (struct ifreq __user *) arg);
+       res = devinet_ioctl(&init_net, cmd, (struct ifreq __user *) arg);
        set_fs(oldfs);
        return res;
 }
@@ -299,7 +302,7 @@ static int __init ic_route_ioctl(unsigned int cmd, struct rtentry *arg)
 
        mm_segment_t oldfs = get_fs();
        set_fs(get_ds());
-       res = ip_rt_ioctl(cmd, (void __user *) arg);
+       res = ip_rt_ioctl(&init_net, cmd, (void __user *) arg);
        set_fs(oldfs);
        return res;
 }
@@ -456,10 +459,7 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
        if (rarp->ar_pro != htons(ETH_P_IP))
                goto drop;
 
-       if (!pskb_may_pull(skb,
-                          sizeof(struct arphdr) +
-                          (2 * dev->addr_len) +
-                          (2 * 4)))
+       if (!pskb_may_pull(skb, arp_hdr_len(dev)))
                goto drop;
 
        /* OK, it is all there and looks valid, process... */
@@ -588,6 +588,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);
@@ -628,6 +629,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 */
@@ -739,9 +750,9 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d
                printk("Unknown ARP type 0x%04x for device %s\n", dev->type, dev->name);
                b->htype = dev->type; /* can cause undefined behavior */
        }
+
+       /* server_ip and your_ip address are both already zero per RFC2131 */
        b->hlen = dev->addr_len;
-       b->your_ip = NONE;
-       b->server_ip = NONE;
        memcpy(b->hw_addr, dev->dev_addr, dev->addr_len);
        b->secs = htons(jiffies_diff / HZ);
        b->xid = d->xid;
@@ -1376,7 +1387,7 @@ static int __init ip_auto_config(void)
         * Clue in the operator.
         */
        printk("IP-Config: Complete:");
-       printk("\n      device=%s", ic_dev->name);
+       printk("\n     device=%s", ic_dev->name);
        printk(", addr=%u.%u.%u.%u", NIPQUAD(ic_myaddr));
        printk(", mask=%u.%u.%u.%u", NIPQUAD(ic_netmask));
        printk(", gw=%u.%u.%u.%u", NIPQUAD(ic_gateway));
@@ -1513,5 +1524,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);