aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-02-17 15:09:59 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-17 15:09:59 -0500
commit48c871c1f6a7c7044dd76774fb469e65c7e2e4e8 (patch)
treeda3aa535c98cc0957851354ceb0fbff7482d7a9d /net/core
parent1a1689344add3333d28d1b5495d8043a3877d01c (diff)
parent4409d28140d9a6e6e3f4f1fdaf7234c4b965d954 (diff)
Merge branch 'gfar' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc into upstream
Diffstat (limited to 'net/core')
-rw-r--r--net/core/datagram.c2
-rw-r--r--net/core/dev.c100
-rw-r--r--net/core/dev_mcast.c30
-rw-r--r--net/core/dst.c9
-rw-r--r--net/core/ethtool.c10
-rw-r--r--net/core/filter.c8
-rw-r--r--net/core/gen_estimator.c6
-rw-r--r--net/core/gen_stats.c2
-rw-r--r--net/core/iovec.c10
-rw-r--r--net/core/link_watch.c4
-rw-r--r--net/core/neighbour.c58
-rw-r--r--net/core/net-sysfs.c10
-rw-r--r--net/core/netpoll.c18
-rw-r--r--net/core/pktgen.c68
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/core/scm.c12
-rw-r--r--net/core/skbuff.c14
-rw-r--r--net/core/sock.c150
-rw-r--r--net/core/stream.c4
-rw-r--r--net/core/user_dma.c8
-rw-r--r--net/core/utils.c4
-rw-r--r--net/core/wireless.c22
22 files changed, 274 insertions, 277 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 797fdd4352ce..186212b5b7da 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -430,7 +430,7 @@ EXPORT_SYMBOL(__skb_checksum_complete);
430 * @skb: skbuff 430 * @skb: skbuff
431 * @hlen: hardware length 431 * @hlen: hardware length
432 * @iov: io vector 432 * @iov: io vector
433 * 433 *
434 * Caller _must_ check that skb will fit to this iovec. 434 * Caller _must_ check that skb will fit to this iovec.
435 * 435 *
436 * Returns: 0 - success. 436 * Returns: 0 - success.
diff --git a/net/core/dev.c b/net/core/dev.c
index 1e94a1b9a0f4..cf71614dae93 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -255,7 +255,7 @@ static int netdev_nit;
255 * is linked into kernel lists and may not be freed until it has been 255 * is linked into kernel lists and may not be freed until it has been
256 * removed from the kernel lists. 256 * removed from the kernel lists.
257 * 257 *
258 * This call does not sleep therefore it can not 258 * This call does not sleep therefore it can not
259 * guarantee all CPU's that are in middle of receiving packets 259 * guarantee all CPU's that are in middle of receiving packets
260 * will see the new packet type (until the next received packet). 260 * will see the new packet type (until the next received packet).
261 */ 261 */
@@ -282,7 +282,7 @@ void dev_add_pack(struct packet_type *pt)
282 * Remove a protocol handler that was previously added to the kernel 282 * Remove a protocol handler that was previously added to the kernel
283 * protocol handlers by dev_add_pack(). The passed &packet_type is removed 283 * protocol handlers by dev_add_pack(). The passed &packet_type is removed
284 * from the kernel lists and can be freed or reused once this function 284 * from the kernel lists and can be freed or reused once this function
285 * returns. 285 * returns.
286 * 286 *
287 * The packet type might still be in use by receivers 287 * The packet type might still be in use by receivers
288 * and must not be freed until after all the CPU's have gone 288 * and must not be freed until after all the CPU's have gone
@@ -327,7 +327,7 @@ out:
327void dev_remove_pack(struct packet_type *pt) 327void dev_remove_pack(struct packet_type *pt)
328{ 328{
329 __dev_remove_pack(pt); 329 __dev_remove_pack(pt);
330 330
331 synchronize_net(); 331 synchronize_net();
332} 332}
333 333
@@ -607,7 +607,7 @@ EXPORT_SYMBOL(dev_getfirstbyhwtype);
607 * @mask: bitmask of bits in if_flags to check 607 * @mask: bitmask of bits in if_flags to check
608 * 608 *
609 * Search for any interface with the given flags. Returns NULL if a device 609 * Search for any interface with the given flags. Returns NULL if a device
610 * is not found or a pointer to the device. The device returned has 610 * is not found or a pointer to the device. The device returned has
611 * had a reference added and the pointer is safe until the user calls 611 * had a reference added and the pointer is safe until the user calls
612 * dev_put to indicate they have finished with it. 612 * dev_put to indicate they have finished with it.
613 */ 613 */
@@ -802,7 +802,7 @@ void netdev_state_change(struct net_device *dev)
802 802
803void dev_load(const char *name) 803void dev_load(const char *name)
804{ 804{
805 struct net_device *dev; 805 struct net_device *dev;
806 806
807 read_lock(&dev_base_lock); 807 read_lock(&dev_base_lock);
808 dev = __dev_get_by_name(name); 808 dev = __dev_get_by_name(name);
@@ -860,7 +860,7 @@ int dev_open(struct net_device *dev)
860 clear_bit(__LINK_STATE_START, &dev->state); 860 clear_bit(__LINK_STATE_START, &dev->state);
861 } 861 }
862 862
863 /* 863 /*
864 * If it went open OK then: 864 * If it went open OK then:
865 */ 865 */
866 866
@@ -964,7 +964,7 @@ int dev_close(struct net_device *dev)
964 * is returned on a failure. 964 * is returned on a failure.
965 * 965 *
966 * When registered all registration and up events are replayed 966 * When registered all registration and up events are replayed
967 * to the new notifier to allow device to have a race free 967 * to the new notifier to allow device to have a race free
968 * view of the network device list. 968 * view of the network device list.
969 */ 969 */
970 970
@@ -979,7 +979,7 @@ int register_netdevice_notifier(struct notifier_block *nb)
979 for (dev = dev_base; dev; dev = dev->next) { 979 for (dev = dev_base; dev; dev = dev->next) {
980 nb->notifier_call(nb, NETDEV_REGISTER, dev); 980 nb->notifier_call(nb, NETDEV_REGISTER, dev);
981 981
982 if (dev->flags & IFF_UP) 982 if (dev->flags & IFF_UP)
983 nb->notifier_call(nb, NETDEV_UP, dev); 983 nb->notifier_call(nb, NETDEV_UP, dev);
984 } 984 }
985 } 985 }
@@ -1157,7 +1157,7 @@ void netif_device_attach(struct net_device *dev)
1157 if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) && 1157 if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
1158 netif_running(dev)) { 1158 netif_running(dev)) {
1159 netif_wake_queue(dev); 1159 netif_wake_queue(dev);
1160 __netdev_watchdog_up(dev); 1160 __netdev_watchdog_up(dev);
1161 } 1161 }
1162} 1162}
1163EXPORT_SYMBOL(netif_device_attach); 1163EXPORT_SYMBOL(netif_device_attach);
@@ -1197,7 +1197,7 @@ int skb_checksum_help(struct sk_buff *skb)
1197 1197
1198out_set_summed: 1198out_set_summed:
1199 skb->ip_summed = CHECKSUM_NONE; 1199 skb->ip_summed = CHECKSUM_NONE;
1200out: 1200out:
1201 return ret; 1201 return ret;
1202} 1202}
1203 1203
@@ -1258,7 +1258,7 @@ EXPORT_SYMBOL(skb_gso_segment);
1258void netdev_rx_csum_fault(struct net_device *dev) 1258void netdev_rx_csum_fault(struct net_device *dev)
1259{ 1259{
1260 if (net_ratelimit()) { 1260 if (net_ratelimit()) {
1261 printk(KERN_ERR "%s: hw csum failure.\n", 1261 printk(KERN_ERR "%s: hw csum failure.\n",
1262 dev ? dev->name : "<unknown>"); 1262 dev ? dev->name : "<unknown>");
1263 dump_stack(); 1263 dump_stack();
1264 } 1264 }
@@ -1372,7 +1372,7 @@ gso:
1372 if (unlikely(netif_queue_stopped(dev) && skb->next)) 1372 if (unlikely(netif_queue_stopped(dev) && skb->next))
1373 return NETDEV_TX_BUSY; 1373 return NETDEV_TX_BUSY;
1374 } while (skb->next); 1374 } while (skb->next);
1375 1375
1376 skb->destructor = DEV_GSO_CB(skb)->destructor; 1376 skb->destructor = DEV_GSO_CB(skb)->destructor;
1377 1377
1378out_kfree_skb: 1378out_kfree_skb:
@@ -1449,25 +1449,25 @@ int dev_queue_xmit(struct sk_buff *skb)
1449 (!(dev->features & NETIF_F_GEN_CSUM) && 1449 (!(dev->features & NETIF_F_GEN_CSUM) &&
1450 (!(dev->features & NETIF_F_IP_CSUM) || 1450 (!(dev->features & NETIF_F_IP_CSUM) ||
1451 skb->protocol != htons(ETH_P_IP)))) 1451 skb->protocol != htons(ETH_P_IP))))
1452 if (skb_checksum_help(skb)) 1452 if (skb_checksum_help(skb))
1453 goto out_kfree_skb; 1453 goto out_kfree_skb;
1454 1454
1455gso: 1455gso:
1456 spin_lock_prefetch(&dev->queue_lock); 1456 spin_lock_prefetch(&dev->queue_lock);
1457 1457
1458 /* Disable soft irqs for various locks below. Also 1458 /* Disable soft irqs for various locks below. Also
1459 * stops preemption for RCU. 1459 * stops preemption for RCU.
1460 */ 1460 */
1461 rcu_read_lock_bh(); 1461 rcu_read_lock_bh();
1462 1462
1463 /* Updates of qdisc are serialized by queue_lock. 1463 /* Updates of qdisc are serialized by queue_lock.
1464 * The struct Qdisc which is pointed to by qdisc is now a 1464 * The struct Qdisc which is pointed to by qdisc is now a
1465 * rcu structure - it may be accessed without acquiring 1465 * rcu structure - it may be accessed without acquiring
1466 * a lock (but the structure may be stale.) The freeing of the 1466 * a lock (but the structure may be stale.) The freeing of the
1467 * qdisc will be deferred until it's known that there are no 1467 * qdisc will be deferred until it's known that there are no
1468 * more references to it. 1468 * more references to it.
1469 * 1469 *
1470 * If the qdisc has an enqueue function, we still need to 1470 * If the qdisc has an enqueue function, we still need to
1471 * hold the queue_lock before calling it, since queue_lock 1471 * hold the queue_lock before calling it, since queue_lock
1472 * also serializes access to the device queue. 1472 * also serializes access to the device queue.
1473 */ 1473 */
@@ -1715,8 +1715,8 @@ static __inline__ int handle_bridge(struct sk_buff **pskb,
1715 if (*pt_prev) { 1715 if (*pt_prev) {
1716 *ret = deliver_skb(*pskb, *pt_prev, orig_dev); 1716 *ret = deliver_skb(*pskb, *pt_prev, orig_dev);
1717 *pt_prev = NULL; 1717 *pt_prev = NULL;
1718 } 1718 }
1719 1719
1720 return br_handle_frame_hook(port, pskb); 1720 return br_handle_frame_hook(port, pskb);
1721} 1721}
1722#else 1722#else
@@ -1728,16 +1728,16 @@ static __inline__ int handle_bridge(struct sk_buff **pskb,
1728 * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions 1728 * when CONFIG_NET_CLS_ACT is? otherwise some useless instructions
1729 * a compare and 2 stores extra right now if we dont have it on 1729 * a compare and 2 stores extra right now if we dont have it on
1730 * but have CONFIG_NET_CLS_ACT 1730 * but have CONFIG_NET_CLS_ACT
1731 * NOTE: This doesnt stop any functionality; if you dont have 1731 * NOTE: This doesnt stop any functionality; if you dont have
1732 * the ingress scheduler, you just cant add policies on ingress. 1732 * the ingress scheduler, you just cant add policies on ingress.
1733 * 1733 *
1734 */ 1734 */
1735static int ing_filter(struct sk_buff *skb) 1735static int ing_filter(struct sk_buff *skb)
1736{ 1736{
1737 struct Qdisc *q; 1737 struct Qdisc *q;
1738 struct net_device *dev = skb->dev; 1738 struct net_device *dev = skb->dev;
1739 int result = TC_ACT_OK; 1739 int result = TC_ACT_OK;
1740 1740
1741 if (dev->qdisc_ingress) { 1741 if (dev->qdisc_ingress) {
1742 __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); 1742 __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd);
1743 if (MAX_RED_LOOP < ttl++) { 1743 if (MAX_RED_LOOP < ttl++) {
@@ -1801,7 +1801,7 @@ int netif_receive_skb(struct sk_buff *skb)
1801 1801
1802 list_for_each_entry_rcu(ptype, &ptype_all, list) { 1802 list_for_each_entry_rcu(ptype, &ptype_all, list) {
1803 if (!ptype->dev || ptype->dev == skb->dev) { 1803 if (!ptype->dev || ptype->dev == skb->dev) {
1804 if (pt_prev) 1804 if (pt_prev)
1805 ret = deliver_skb(skb, pt_prev, orig_dev); 1805 ret = deliver_skb(skb, pt_prev, orig_dev);
1806 pt_prev = ptype; 1806 pt_prev = ptype;
1807 } 1807 }
@@ -1833,7 +1833,7 @@ ncls:
1833 list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) { 1833 list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) {
1834 if (ptype->type == type && 1834 if (ptype->type == type &&
1835 (!ptype->dev || ptype->dev == skb->dev)) { 1835 (!ptype->dev || ptype->dev == skb->dev)) {
1836 if (pt_prev) 1836 if (pt_prev)
1837 ret = deliver_skb(skb, pt_prev, orig_dev); 1837 ret = deliver_skb(skb, pt_prev, orig_dev);
1838 pt_prev = ptype; 1838 pt_prev = ptype;
1839 } 1839 }
@@ -2061,7 +2061,7 @@ static int dev_ifconf(char __user *arg)
2061 total += done; 2061 total += done;
2062 } 2062 }
2063 } 2063 }
2064 } 2064 }
2065 2065
2066 /* 2066 /*
2067 * All done. Write the updated control block back to the caller. 2067 * All done. Write the updated control block back to the caller.
@@ -2154,7 +2154,7 @@ static struct netif_rx_stats *softnet_get_online(loff_t *pos)
2154 struct netif_rx_stats *rc = NULL; 2154 struct netif_rx_stats *rc = NULL;
2155 2155
2156 while (*pos < NR_CPUS) 2156 while (*pos < NR_CPUS)
2157 if (cpu_online(*pos)) { 2157 if (cpu_online(*pos)) {
2158 rc = &per_cpu(netdev_rx_stat, *pos); 2158 rc = &per_cpu(netdev_rx_stat, *pos);
2159 break; 2159 break;
2160 } else 2160 } else
@@ -2200,7 +2200,7 @@ static int dev_seq_open(struct inode *inode, struct file *file)
2200 return seq_open(file, &dev_seq_ops); 2200 return seq_open(file, &dev_seq_ops);
2201} 2201}
2202 2202
2203static struct file_operations dev_seq_fops = { 2203static const struct file_operations dev_seq_fops = {
2204 .owner = THIS_MODULE, 2204 .owner = THIS_MODULE,
2205 .open = dev_seq_open, 2205 .open = dev_seq_open,
2206 .read = seq_read, 2206 .read = seq_read,
@@ -2220,7 +2220,7 @@ static int softnet_seq_open(struct inode *inode, struct file *file)
2220 return seq_open(file, &softnet_seq_ops); 2220 return seq_open(file, &softnet_seq_ops);
2221} 2221}
2222 2222
2223static struct file_operations softnet_seq_fops = { 2223static const struct file_operations softnet_seq_fops = {
2224 .owner = THIS_MODULE, 2224 .owner = THIS_MODULE,
2225 .open = softnet_seq_open, 2225 .open = softnet_seq_open,
2226 .read = seq_read, 2226 .read = seq_read,
@@ -2282,7 +2282,7 @@ int netdev_set_master(struct net_device *slave, struct net_device *master)
2282 } 2282 }
2283 2283
2284 slave->master = master; 2284 slave->master = master;
2285 2285
2286 synchronize_net(); 2286 synchronize_net();
2287 2287
2288 if (old) 2288 if (old)
@@ -2319,13 +2319,13 @@ void dev_set_promiscuity(struct net_device *dev, int inc)
2319 dev_mc_upload(dev); 2319 dev_mc_upload(dev);
2320 printk(KERN_INFO "device %s %s promiscuous mode\n", 2320 printk(KERN_INFO "device %s %s promiscuous mode\n",
2321 dev->name, (dev->flags & IFF_PROMISC) ? "entered" : 2321 dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
2322 "left"); 2322 "left");
2323 audit_log(current->audit_context, GFP_ATOMIC, 2323 audit_log(current->audit_context, GFP_ATOMIC,
2324 AUDIT_ANOM_PROMISCUOUS, 2324 AUDIT_ANOM_PROMISCUOUS,
2325 "dev=%s prom=%d old_prom=%d auid=%u", 2325 "dev=%s prom=%d old_prom=%d auid=%u",
2326 dev->name, (dev->flags & IFF_PROMISC), 2326 dev->name, (dev->flags & IFF_PROMISC),
2327 (old_flags & IFF_PROMISC), 2327 (old_flags & IFF_PROMISC),
2328 audit_get_loginuid(current->audit_context)); 2328 audit_get_loginuid(current->audit_context));
2329 } 2329 }
2330} 2330}
2331 2331
@@ -2816,7 +2816,7 @@ int dev_ioctl(unsigned int cmd, void __user *arg)
2816 rtnl_unlock(); 2816 rtnl_unlock();
2817 if (IW_IS_GET(cmd) && 2817 if (IW_IS_GET(cmd) &&
2818 copy_to_user(arg, &ifr, 2818 copy_to_user(arg, &ifr,
2819 sizeof(struct ifreq))) 2819 sizeof(struct ifreq)))
2820 ret = -EFAULT; 2820 ret = -EFAULT;
2821 return ret; 2821 return ret;
2822 } 2822 }
@@ -2906,7 +2906,7 @@ int register_netdevice(struct net_device *dev)
2906 goto out; 2906 goto out;
2907 } 2907 }
2908 } 2908 }
2909 2909
2910 if (!dev_valid_name(dev->name)) { 2910 if (!dev_valid_name(dev->name)) {
2911 ret = -EINVAL; 2911 ret = -EINVAL;
2912 goto out; 2912 goto out;
@@ -2923,9 +2923,9 @@ int register_netdevice(struct net_device *dev)
2923 = hlist_entry(p, struct net_device, name_hlist); 2923 = hlist_entry(p, struct net_device, name_hlist);
2924 if (!strncmp(d->name, dev->name, IFNAMSIZ)) { 2924 if (!strncmp(d->name, dev->name, IFNAMSIZ)) {
2925 ret = -EEXIST; 2925 ret = -EEXIST;
2926 goto out; 2926 goto out;
2927 } 2927 }
2928 } 2928 }
2929 2929
2930 /* Fix illegal SG+CSUM combinations. */ 2930 /* Fix illegal SG+CSUM combinations. */
2931 if ((dev->features & NETIF_F_SG) && 2931 if ((dev->features & NETIF_F_SG) &&
@@ -3024,7 +3024,7 @@ int register_netdev(struct net_device *dev)
3024 if (err < 0) 3024 if (err < 0)
3025 goto out; 3025 goto out;
3026 } 3026 }
3027 3027
3028 err = register_netdevice(dev); 3028 err = register_netdevice(dev);
3029out: 3029out:
3030 rtnl_unlock(); 3030 rtnl_unlock();
@@ -3041,7 +3041,7 @@ EXPORT_SYMBOL(register_netdev);
3041 * for netdevice notification, and cleanup and put back the 3041 * for netdevice notification, and cleanup and put back the
3042 * reference if they receive an UNREGISTER event. 3042 * reference if they receive an UNREGISTER event.
3043 * We can get stuck here if buggy protocols don't correctly 3043 * We can get stuck here if buggy protocols don't correctly
3044 * call dev_put. 3044 * call dev_put.
3045 */ 3045 */
3046static void netdev_wait_allrefs(struct net_device *dev) 3046static void netdev_wait_allrefs(struct net_device *dev)
3047{ 3047{
@@ -3205,8 +3205,8 @@ EXPORT_SYMBOL(alloc_netdev);
3205 * free_netdev - free network device 3205 * free_netdev - free network device
3206 * @dev: device 3206 * @dev: device
3207 * 3207 *
3208 * This function does the last stage of destroying an allocated device 3208 * This function does the last stage of destroying an allocated device
3209 * interface. The reference to the device object is released. 3209 * interface. The reference to the device object is released.
3210 * If this is the last reference then it will be freed. 3210 * If this is the last reference then it will be freed.
3211 */ 3211 */
3212void free_netdev(struct net_device *dev) 3212void free_netdev(struct net_device *dev)
@@ -3227,9 +3227,9 @@ void free_netdev(struct net_device *dev)
3227 kfree((char *)dev - dev->padded); 3227 kfree((char *)dev - dev->padded);
3228#endif 3228#endif
3229} 3229}
3230 3230
3231/* Synchronize with packet receive processing. */ 3231/* Synchronize with packet receive processing. */
3232void synchronize_net(void) 3232void synchronize_net(void)
3233{ 3233{
3234 might_sleep(); 3234 might_sleep();
3235 synchronize_rcu(); 3235 synchronize_rcu();
@@ -3291,12 +3291,12 @@ void unregister_netdevice(struct net_device *dev)
3291 /* Shutdown queueing discipline. */ 3291 /* Shutdown queueing discipline. */
3292 dev_shutdown(dev); 3292 dev_shutdown(dev);
3293 3293
3294 3294
3295 /* Notify protocols, that we are about to destroy 3295 /* Notify protocols, that we are about to destroy
3296 this device. They should clean all the things. 3296 this device. They should clean all the things.
3297 */ 3297 */
3298 raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); 3298 raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev);
3299 3299
3300 /* 3300 /*
3301 * Flush the multicast chain 3301 * Flush the multicast chain
3302 */ 3302 */
@@ -3483,7 +3483,7 @@ static int __init net_dev_init(void)
3483 goto out; 3483 goto out;
3484 3484
3485 INIT_LIST_HEAD(&ptype_all); 3485 INIT_LIST_HEAD(&ptype_all);
3486 for (i = 0; i < 16; i++) 3486 for (i = 0; i < 16; i++)
3487 INIT_LIST_HEAD(&ptype_base[i]); 3487 INIT_LIST_HEAD(&ptype_base[i]);
3488 3488
3489 for (i = 0; i < ARRAY_SIZE(dev_name_head); i++) 3489 for (i = 0; i < ARRAY_SIZE(dev_name_head); i++)
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index b22648d04d36..c4e754e86e96 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -1,12 +1,12 @@
1/* 1/*
2 * Linux NET3: Multicast List maintenance. 2 * Linux NET3: Multicast List maintenance.
3 * 3 *
4 * Authors: 4 * Authors:
5 * Tim Kordas <tjk@nostromo.eeap.cwru.edu> 5 * Tim Kordas <tjk@nostromo.eeap.cwru.edu>
6 * Richard Underwood <richard@wuzz.demon.co.uk> 6 * Richard Underwood <richard@wuzz.demon.co.uk>
7 * 7 *
8 * Stir fried together from the IP multicast and CAP patches above 8 * Stir fried together from the IP multicast and CAP patches above
9 * Alan Cox <Alan.Cox@linux.org> 9 * Alan Cox <Alan.Cox@linux.org>
10 * 10 *
11 * Fixes: 11 * Fixes:
12 * Alan Cox : Update the device on a real delete 12 * Alan Cox : Update the device on a real delete
@@ -50,11 +50,11 @@
50 50
51 51
52/* 52/*
53 * Device multicast list maintenance. 53 * Device multicast list maintenance.
54 * 54 *
55 * This is used both by IP and by the user level maintenance functions. 55 * This is used both by IP and by the user level maintenance functions.
56 * Unlike BSD we maintain a usage count on a given multicast address so 56 * Unlike BSD we maintain a usage count on a given multicast address so
57 * that a casual user application can add/delete multicasts used by 57 * that a casual user application can add/delete multicasts used by
58 * protocols without doing damage to the protocols when it deletes the 58 * protocols without doing damage to the protocols when it deletes the
59 * entries. It also helps IP as it tracks overlapping maps. 59 * entries. It also helps IP as it tracks overlapping maps.
60 * 60 *
@@ -67,7 +67,7 @@
67/* 67/*
68 * Update the multicast list into the physical NIC controller. 68 * Update the multicast list into the physical NIC controller.
69 */ 69 */
70 70
71static void __dev_mc_upload(struct net_device *dev) 71static void __dev_mc_upload(struct net_device *dev)
72{ 72{
73 /* Don't do anything till we up the interface 73 /* Don't do anything till we up the interface
@@ -100,7 +100,7 @@ void dev_mc_upload(struct net_device *dev)
100/* 100/*
101 * Delete a device level multicast 101 * Delete a device level multicast
102 */ 102 */
103 103
104int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl) 104int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
105{ 105{
106 int err = 0; 106 int err = 0;
@@ -137,7 +137,7 @@ int dev_mc_delete(struct net_device *dev, void *addr, int alen, int glbl)
137 * loaded filter is now wrong. Fix it 137 * loaded filter is now wrong. Fix it
138 */ 138 */
139 __dev_mc_upload(dev); 139 __dev_mc_upload(dev);
140 140
141 netif_tx_unlock_bh(dev); 141 netif_tx_unlock_bh(dev);
142 return 0; 142 return 0;
143 } 143 }
@@ -151,7 +151,7 @@ done:
151/* 151/*
152 * Add a device level multicast 152 * Add a device level multicast
153 */ 153 */
154 154
155int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl) 155int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
156{ 156{
157 int err = 0; 157 int err = 0;
@@ -187,7 +187,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
187 dev->mc_count++; 187 dev->mc_count++;
188 188
189 __dev_mc_upload(dev); 189 __dev_mc_upload(dev);
190 190
191 netif_tx_unlock_bh(dev); 191 netif_tx_unlock_bh(dev);
192 return 0; 192 return 0;
193 193
@@ -204,7 +204,7 @@ done:
204void dev_mc_discard(struct net_device *dev) 204void dev_mc_discard(struct net_device *dev)
205{ 205{
206 netif_tx_lock_bh(dev); 206 netif_tx_lock_bh(dev);
207 207
208 while (dev->mc_list != NULL) { 208 while (dev->mc_list != NULL) {
209 struct dev_mc_list *tmp = dev->mc_list; 209 struct dev_mc_list *tmp = dev->mc_list;
210 dev->mc_list = tmp->next; 210 dev->mc_list = tmp->next;
@@ -225,7 +225,7 @@ static void *dev_mc_seq_start(struct seq_file *seq, loff_t *pos)
225 225
226 read_lock(&dev_base_lock); 226 read_lock(&dev_base_lock);
227 for (dev = dev_base; dev; dev = dev->next) { 227 for (dev = dev_base; dev; dev = dev->next) {
228 if (off++ == *pos) 228 if (off++ == *pos)
229 return dev; 229 return dev;
230 } 230 }
231 return NULL; 231 return NULL;
@@ -277,7 +277,7 @@ static int dev_mc_seq_open(struct inode *inode, struct file *file)
277 return seq_open(file, &dev_mc_seq_ops); 277 return seq_open(file, &dev_mc_seq_ops);
278} 278}
279 279
280static struct file_operations dev_mc_seq_fops = { 280static const struct file_operations dev_mc_seq_fops = {
281 .owner = THIS_MODULE, 281 .owner = THIS_MODULE,
282 .open = dev_mc_seq_open, 282 .open = dev_mc_seq_open,
283 .read = seq_read, 283 .read = seq_read,
diff --git a/net/core/dst.c b/net/core/dst.c
index 1a53fb39b7e0..61dd9d3951f1 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -29,7 +29,7 @@
29 * 4) All operations modify state, so a spinlock is used. 29 * 4) All operations modify state, so a spinlock is used.
30 */ 30 */
31static struct dst_entry *dst_garbage_list; 31static struct dst_entry *dst_garbage_list;
32#if RT_CACHE_DEBUG >= 2 32#if RT_CACHE_DEBUG >= 2
33static atomic_t dst_total = ATOMIC_INIT(0); 33static atomic_t dst_total = ATOMIC_INIT(0);
34#endif 34#endif
35static DEFINE_SPINLOCK(dst_lock); 35static DEFINE_SPINLOCK(dst_lock);
@@ -132,17 +132,16 @@ void * dst_alloc(struct dst_ops * ops)
132 if (ops->gc()) 132 if (ops->gc())
133 return NULL; 133 return NULL;
134 } 134 }
135 dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC); 135 dst = kmem_cache_zalloc(ops->kmem_cachep, GFP_ATOMIC);
136 if (!dst) 136 if (!dst)
137 return NULL; 137 return NULL;
138 memset(dst, 0, ops->entry_size);
139 atomic_set(&dst->__refcnt, 0); 138 atomic_set(&dst->__refcnt, 0);
140 dst->ops = ops; 139 dst->ops = ops;
141 dst->lastuse = jiffies; 140 dst->lastuse = jiffies;
142 dst->path = dst; 141 dst->path = dst;
143 dst->input = dst_discard_in; 142 dst->input = dst_discard_in;
144 dst->output = dst_discard_out; 143 dst->output = dst_discard_out;
145#if RT_CACHE_DEBUG >= 2 144#if RT_CACHE_DEBUG >= 2
146 atomic_inc(&dst_total); 145 atomic_inc(&dst_total);
147#endif 146#endif
148 atomic_inc(&ops->entries); 147 atomic_inc(&ops->entries);
@@ -203,7 +202,7 @@ again:
203 dst->ops->destroy(dst); 202 dst->ops->destroy(dst);
204 if (dst->dev) 203 if (dst->dev)
205 dev_put(dst->dev); 204 dev_put(dst->dev);
206#if RT_CACHE_DEBUG >= 2 205#if RT_CACHE_DEBUG >= 2
207 atomic_dec(&dst_total); 206 atomic_dec(&dst_total);
208#endif 207#endif
209 kmem_cache_free(dst->ops->kmem_cachep, dst); 208 kmem_cache_free(dst->ops->kmem_cachep, dst);
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 87dc556fd9d6..6168edd137dd 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -17,7 +17,7 @@
17#include <linux/netdevice.h> 17#include <linux/netdevice.h>
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19 19
20/* 20/*
21 * Some useful ethtool_ops methods that're device independent. 21 * Some useful ethtool_ops methods that're device independent.
22 * If we find that all drivers want to do the same thing here, 22 * If we find that all drivers want to do the same thing here,
23 * we can turn these into dev_() function calls. 23 * we can turn these into dev_() function calls.
@@ -87,12 +87,12 @@ int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *a
87 unsigned char len = dev->addr_len; 87 unsigned char len = dev->addr_len;
88 if ( addr->size < len ) 88 if ( addr->size < len )
89 return -ETOOSMALL; 89 return -ETOOSMALL;
90 90
91 addr->size = len; 91 addr->size = len;
92 memcpy(data, dev->perm_addr, len); 92 memcpy(data, dev->perm_addr, len);
93 return 0; 93 return 0;
94} 94}
95 95
96 96
97u32 ethtool_op_get_ufo(struct net_device *dev) 97u32 ethtool_op_get_ufo(struct net_device *dev)
98{ 98{
@@ -550,7 +550,7 @@ static int ethtool_set_sg(struct net_device *dev, char __user *useraddr)
550 if (copy_from_user(&edata, useraddr, sizeof(edata))) 550 if (copy_from_user(&edata, useraddr, sizeof(edata)))
551 return -EFAULT; 551 return -EFAULT;
552 552
553 if (edata.data && 553 if (edata.data &&
554 !(dev->features & NETIF_F_ALL_CSUM)) 554 !(dev->features & NETIF_F_ALL_CSUM))
555 return -EINVAL; 555 return -EINVAL;
556 556
@@ -951,7 +951,7 @@ int dev_ethtool(struct ifreq *ifr)
951 default: 951 default:
952 rc = -EOPNOTSUPP; 952 rc = -EOPNOTSUPP;
953 } 953 }
954 954
955 if(dev->ethtool_ops->complete) 955 if(dev->ethtool_ops->complete)
956 dev->ethtool_ops->complete(dev); 956 dev->ethtool_ops->complete(dev);
957 957
diff --git a/net/core/filter.c b/net/core/filter.c
index 0df843b667f4..8123a31d919d 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -53,7 +53,7 @@ static void *__load_pointer(struct sk_buff *skb, int k)
53} 53}
54 54
55static inline void *load_pointer(struct sk_buff *skb, int k, 55static inline void *load_pointer(struct sk_buff *skb, int k,
56 unsigned int size, void *buffer) 56 unsigned int size, void *buffer)
57{ 57{
58 if (k >= 0) 58 if (k >= 0)
59 return skb_header_pointer(skb, k, size, buffer); 59 return skb_header_pointer(skb, k, size, buffer);
@@ -91,7 +91,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int
91 */ 91 */
92 for (pc = 0; pc < flen; pc++) { 92 for (pc = 0; pc < flen; pc++) {
93 fentry = &filter[pc]; 93 fentry = &filter[pc];
94 94
95 switch (fentry->code) { 95 switch (fentry->code) {
96 case BPF_ALU|BPF_ADD|BPF_X: 96 case BPF_ALU|BPF_ADD|BPF_X:
97 A += X; 97 A += X;
@@ -399,7 +399,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
399 */ 399 */
400int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) 400int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
401{ 401{
402 struct sk_filter *fp; 402 struct sk_filter *fp;
403 unsigned int fsize = sizeof(struct sock_filter) * fprog->len; 403 unsigned int fsize = sizeof(struct sock_filter) * fprog->len;
404 int err; 404 int err;
405 405
@@ -411,7 +411,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
411 if (!fp) 411 if (!fp)
412 return -ENOMEM; 412 return -ENOMEM;
413 if (copy_from_user(fp->insns, fprog->filter, fsize)) { 413 if (copy_from_user(fp->insns, fprog->filter, fsize)) {
414 sock_kfree_s(sk, fp, fsize+sizeof(*fp)); 414 sock_kfree_s(sk, fp, fsize+sizeof(*fp));
415 return -EFAULT; 415 return -EFAULT;
416 } 416 }
417 417
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 3cad026764f0..17daf4c9f793 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -144,7 +144,7 @@ static void est_timer(unsigned long arg)
144 * configuration TLV is created. Upon each interval, the latest statistics 144 * configuration TLV is created. Upon each interval, the latest statistics
145 * will be read from &bstats and the estimated rate will be stored in 145 * will be read from &bstats and the estimated rate will be stored in
146 * &rate_est with the statistics lock grabed during this period. 146 * &rate_est with the statistics lock grabed during this period.
147 * 147 *
148 * Returns 0 on success or a negative error code. 148 * Returns 0 on success or a negative error code.
149 */ 149 */
150int gen_new_estimator(struct gnet_stats_basic *bstats, 150int gen_new_estimator(struct gnet_stats_basic *bstats,
@@ -231,7 +231,7 @@ void gen_kill_estimator(struct gnet_stats_basic *bstats,
231 * 231 *
232 * Replaces the configuration of a rate estimator by calling 232 * Replaces the configuration of a rate estimator by calling
233 * gen_kill_estimator() and gen_new_estimator(). 233 * gen_kill_estimator() and gen_new_estimator().
234 * 234 *
235 * Returns 0 on success or a negative error code. 235 * Returns 0 on success or a negative error code.
236 */ 236 */
237int 237int
@@ -242,7 +242,7 @@ gen_replace_estimator(struct gnet_stats_basic *bstats,
242 gen_kill_estimator(bstats, rate_est); 242 gen_kill_estimator(bstats, rate_est);
243 return gen_new_estimator(bstats, rate_est, stats_lock, opt); 243 return gen_new_estimator(bstats, rate_est, stats_lock, opt);
244} 244}
245 245
246 246
247EXPORT_SYMBOL(gen_kill_estimator); 247EXPORT_SYMBOL(gen_kill_estimator);
248EXPORT_SYMBOL(gen_new_estimator); 248EXPORT_SYMBOL(gen_new_estimator);
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index 8f21490355fa..259473d0559d 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -57,7 +57,7 @@ gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
57 int xstats_type, spinlock_t *lock, struct gnet_dump *d) 57 int xstats_type, spinlock_t *lock, struct gnet_dump *d)
58{ 58{
59 memset(d, 0, sizeof(*d)); 59 memset(d, 0, sizeof(*d));
60 60
61 spin_lock_bh(lock); 61 spin_lock_bh(lock);
62 d->lock = lock; 62 d->lock = lock;
63 if (type) 63 if (type)
diff --git a/net/core/iovec.c b/net/core/iovec.c
index 04b249c40b5b..4fb1cb9b79b9 100644
--- a/net/core/iovec.c
+++ b/net/core/iovec.c
@@ -40,7 +40,7 @@
40int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode) 40int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode)
41{ 41{
42 int size, err, ct; 42 int size, err, ct;
43 43
44 if (m->msg_namelen) { 44 if (m->msg_namelen) {
45 if (mode == VERIFY_READ) { 45 if (mode == VERIFY_READ) {
46 err = move_addr_to_kernel(m->msg_name, m->msg_namelen, 46 err = move_addr_to_kernel(m->msg_name, m->msg_namelen,
@@ -79,7 +79,7 @@ int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode)
79 * 79 *
80 * Note: this modifies the original iovec. 80 * Note: this modifies the original iovec.
81 */ 81 */
82 82
83int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len) 83int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
84{ 84{
85 while (len > 0) { 85 while (len > 0) {
@@ -103,7 +103,7 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
103 * 103 *
104 * Note: this modifies the original iovec. 104 * Note: this modifies the original iovec.
105 */ 105 */
106 106
107int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len) 107int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len)
108{ 108{
109 while (len > 0) { 109 while (len > 0) {
@@ -209,7 +209,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
209 if (partial_cnt) { 209 if (partial_cnt) {
210 copy -= partial_cnt; 210 copy -= partial_cnt;
211 if (copy_from_user(kdata + copy, base + copy, 211 if (copy_from_user(kdata + copy, base + copy,
212 partial_cnt)) 212 partial_cnt))
213 goto out_fault; 213 goto out_fault;
214 } 214 }
215 } 215 }
@@ -224,7 +224,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
224 kdata += copy + partial_cnt; 224 kdata += copy + partial_cnt;
225 iov++; 225 iov++;
226 } 226 }
227 *csump = csum; 227 *csump = csum;
228out: 228out:
229 return err; 229 return err;
230 230
diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 549a2ce951b0..8b45c9d3b249 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -124,7 +124,7 @@ void linkwatch_run_queue(void)
124 124
125 dev_put(dev); 125 dev_put(dev);
126 } 126 }
127} 127}
128 128
129 129
130static void linkwatch_event(struct work_struct *dummy) 130static void linkwatch_event(struct work_struct *dummy)
@@ -133,7 +133,7 @@ static void linkwatch_event(struct work_struct *dummy)
133 * per second so that a runaway driver does not 133 * per second so that a runaway driver does not
134 * cause a storm of messages on the netlink 134 * cause a storm of messages on the netlink
135 * socket 135 * socket
136 */ 136 */
137 linkwatch_nextevent = jiffies + HZ; 137 linkwatch_nextevent = jiffies + HZ;
138 clear_bit(LW_RUNNING, &linkwatch_flags); 138 clear_bit(LW_RUNNING, &linkwatch_flags);
139 139
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 054d46493d2b..512eed91785d 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -63,7 +63,7 @@ void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev);
63 63
64static struct neigh_table *neigh_tables; 64static struct neigh_table *neigh_tables;
65#ifdef CONFIG_PROC_FS 65#ifdef CONFIG_PROC_FS
66static struct file_operations neigh_stat_seq_fops; 66static const struct file_operations neigh_stat_seq_fops;
67#endif 67#endif
68 68
69/* 69/*
@@ -251,12 +251,10 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl)
251 goto out_entries; 251 goto out_entries;
252 } 252 }
253 253
254 n = kmem_cache_alloc(tbl->kmem_cachep, GFP_ATOMIC); 254 n = kmem_cache_zalloc(tbl->kmem_cachep, GFP_ATOMIC);
255 if (!n) 255 if (!n)
256 goto out_entries; 256 goto out_entries;
257 257
258 memset(n, 0, tbl->entry_size);
259
260 skb_queue_head_init(&n->arp_queue); 258 skb_queue_head_init(&n->arp_queue);
261 rwlock_init(&n->lock); 259 rwlock_init(&n->lock);
262 n->updated = n->used = now; 260 n->updated = n->used = now;
@@ -345,7 +343,7 @@ struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey,
345 struct neighbour *n; 343 struct neighbour *n;
346 int key_len = tbl->key_len; 344 int key_len = tbl->key_len;
347 u32 hash_val = tbl->hash(pkey, dev); 345 u32 hash_val = tbl->hash(pkey, dev);
348 346
349 NEIGH_CACHE_STAT_INC(tbl, lookups); 347 NEIGH_CACHE_STAT_INC(tbl, lookups);
350 348
351 read_lock_bh(&tbl->lock); 349 read_lock_bh(&tbl->lock);
@@ -687,9 +685,9 @@ next_elt:
687 np = &n->next; 685 np = &n->next;
688 } 686 }
689 687
690 /* Cycle through all hash buckets every base_reachable_time/2 ticks. 688 /* Cycle through all hash buckets every base_reachable_time/2 ticks.
691 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2 689 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2
692 * base_reachable_time. 690 * base_reachable_time.
693 */ 691 */
694 expire = tbl->parms.base_reachable_time >> 1; 692 expire = tbl->parms.base_reachable_time >> 1;
695 expire /= (tbl->hash_mask + 1); 693 expire /= (tbl->hash_mask + 1);
@@ -744,7 +742,7 @@ static void neigh_timer_handler(unsigned long arg)
744 } 742 }
745 743
746 if (state & NUD_REACHABLE) { 744 if (state & NUD_REACHABLE) {
747 if (time_before_eq(now, 745 if (time_before_eq(now,
748 neigh->confirmed + neigh->parms->reachable_time)) { 746 neigh->confirmed + neigh->parms->reachable_time)) {
749 NEIGH_PRINTK2("neigh %p is still alive.\n", neigh); 747 NEIGH_PRINTK2("neigh %p is still alive.\n", neigh);
750 next = neigh->confirmed + neigh->parms->reachable_time; 748 next = neigh->confirmed + neigh->parms->reachable_time;
@@ -763,7 +761,7 @@ static void neigh_timer_handler(unsigned long arg)
763 notify = 1; 761 notify = 1;
764 } 762 }
765 } else if (state & NUD_DELAY) { 763 } else if (state & NUD_DELAY) {
766 if (time_before_eq(now, 764 if (time_before_eq(now,
767 neigh->confirmed + neigh->parms->delay_probe_time)) { 765 neigh->confirmed + neigh->parms->delay_probe_time)) {
768 NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh); 766 NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh);
769 neigh->nud_state = NUD_REACHABLE; 767 neigh->nud_state = NUD_REACHABLE;
@@ -849,7 +847,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
849 goto out_unlock_bh; 847 goto out_unlock_bh;
850 848
851 now = jiffies; 849 now = jiffies;
852 850
853 if (!(neigh->nud_state & (NUD_STALE | NUD_INCOMPLETE))) { 851 if (!(neigh->nud_state & (NUD_STALE | NUD_INCOMPLETE))) {
854 if (neigh->parms->mcast_probes + neigh->parms->app_probes) { 852 if (neigh->parms->mcast_probes + neigh->parms->app_probes) {
855 atomic_set(&neigh->probes, neigh->parms->ucast_probes); 853 atomic_set(&neigh->probes, neigh->parms->ucast_probes);
@@ -917,13 +915,13 @@ static void neigh_update_hhs(struct neighbour *neigh)
917 NEIGH_UPDATE_F_OVERRIDE allows to override existing lladdr, 915 NEIGH_UPDATE_F_OVERRIDE allows to override existing lladdr,
918 if it is different. 916 if it is different.
919 NEIGH_UPDATE_F_WEAK_OVERRIDE will suspect existing "connected" 917 NEIGH_UPDATE_F_WEAK_OVERRIDE will suspect existing "connected"
920 lladdr instead of overriding it 918 lladdr instead of overriding it
921 if it is different. 919 if it is different.
922 It also allows to retain current state 920 It also allows to retain current state
923 if lladdr is unchanged. 921 if lladdr is unchanged.
924 NEIGH_UPDATE_F_ADMIN means that the change is administrative. 922 NEIGH_UPDATE_F_ADMIN means that the change is administrative.
925 923
926 NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing 924 NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing
927 NTF_ROUTER flag. 925 NTF_ROUTER flag.
928 NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as 926 NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as
929 a router. 927 a router.
@@ -946,7 +944,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
946 old = neigh->nud_state; 944 old = neigh->nud_state;
947 err = -EPERM; 945 err = -EPERM;
948 946
949 if (!(flags & NEIGH_UPDATE_F_ADMIN) && 947 if (!(flags & NEIGH_UPDATE_F_ADMIN) &&
950 (old & (NUD_NOARP | NUD_PERMANENT))) 948 (old & (NUD_NOARP | NUD_PERMANENT)))
951 goto out; 949 goto out;
952 950
@@ -970,7 +968,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
970 - compare new & old 968 - compare new & old
971 - if they are different, check override flag 969 - if they are different, check override flag
972 */ 970 */
973 if ((old & NUD_VALID) && 971 if ((old & NUD_VALID) &&
974 !memcmp(lladdr, neigh->ha, dev->addr_len)) 972 !memcmp(lladdr, neigh->ha, dev->addr_len))
975 lladdr = neigh->ha; 973 lladdr = neigh->ha;
976 } else { 974 } else {
@@ -1014,8 +1012,8 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
1014 neigh_del_timer(neigh); 1012 neigh_del_timer(neigh);
1015 if (new & NUD_IN_TIMER) { 1013 if (new & NUD_IN_TIMER) {
1016 neigh_hold(neigh); 1014 neigh_hold(neigh);
1017 neigh_add_timer(neigh, (jiffies + 1015 neigh_add_timer(neigh, (jiffies +
1018 ((new & NUD_REACHABLE) ? 1016 ((new & NUD_REACHABLE) ?
1019 neigh->parms->reachable_time : 1017 neigh->parms->reachable_time :
1020 0))); 1018 0)));
1021 } 1019 }
@@ -1077,7 +1075,7 @@ struct neighbour *neigh_event_ns(struct neigh_table *tbl,
1077 struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev, 1075 struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev,
1078 lladdr || !dev->addr_len); 1076 lladdr || !dev->addr_len);
1079 if (neigh) 1077 if (neigh)
1080 neigh_update(neigh, lladdr, NUD_STALE, 1078 neigh_update(neigh, lladdr, NUD_STALE,
1081 NEIGH_UPDATE_F_OVERRIDE); 1079 NEIGH_UPDATE_F_OVERRIDE);
1082 return neigh; 1080 return neigh;
1083} 1081}
@@ -1129,7 +1127,7 @@ int neigh_compat_output(struct sk_buff *skb)
1129 1127
1130 if (dev->hard_header && 1128 if (dev->hard_header &&
1131 dev->hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL, 1129 dev->hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL,
1132 skb->len) < 0 && 1130 skb->len) < 0 &&
1133 dev->rebuild_header(skb)) 1131 dev->rebuild_header(skb))
1134 return 0; 1132 return 0;
1135 1133
@@ -1349,10 +1347,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
1349 tbl->stats = alloc_percpu(struct neigh_statistics); 1347 tbl->stats = alloc_percpu(struct neigh_statistics);
1350 if (!tbl->stats) 1348 if (!tbl->stats)
1351 panic("cannot create neighbour cache statistics"); 1349 panic("cannot create neighbour cache statistics");
1352 1350
1353#ifdef CONFIG_PROC_FS 1351#ifdef CONFIG_PROC_FS
1354 tbl->pde = create_proc_entry(tbl->id, 0, proc_net_stat); 1352 tbl->pde = create_proc_entry(tbl->id, 0, proc_net_stat);
1355 if (!tbl->pde) 1353 if (!tbl->pde)
1356 panic("cannot create neighbour proc dir entry"); 1354 panic("cannot create neighbour proc dir entry");
1357 tbl->pde->proc_fops = &neigh_stat_seq_fops; 1355 tbl->pde->proc_fops = &neigh_stat_seq_fops;
1358 tbl->pde->data = tbl; 1356 tbl->pde->data = tbl;
@@ -1567,7 +1565,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1567 err = -ENOENT; 1565 err = -ENOENT;
1568 goto out_dev_put; 1566 goto out_dev_put;
1569 } 1567 }
1570 1568
1571 neigh = __neigh_lookup_errno(tbl, dst, dev); 1569 neigh = __neigh_lookup_errno(tbl, dst, dev);
1572 if (IS_ERR(neigh)) { 1570 if (IS_ERR(neigh)) {
1573 err = PTR_ERR(neigh); 1571 err = PTR_ERR(neigh);
@@ -1744,12 +1742,12 @@ errout:
1744 nlmsg_cancel(skb, nlh); 1742 nlmsg_cancel(skb, nlh);
1745 return -EMSGSIZE; 1743 return -EMSGSIZE;
1746} 1744}
1747 1745
1748static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl, 1746static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl,
1749 int ifindex) 1747 int ifindex)
1750{ 1748{
1751 struct neigh_parms *p; 1749 struct neigh_parms *p;
1752 1750
1753 for (p = &tbl->parms; p; p = p->next) 1751 for (p = &tbl->parms; p; p = p->next)
1754 if ((p->dev && p->dev->ifindex == ifindex) || 1752 if ((p->dev && p->dev->ifindex == ifindex) ||
1755 (!p->dev && !ifindex)) 1753 (!p->dev && !ifindex))
@@ -1815,7 +1813,7 @@ int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1815 goto errout_locked; 1813 goto errout_locked;
1816 } 1814 }
1817 1815
1818 /* 1816 /*
1819 * We acquire tbl->lock to be nice to the periodic timers and 1817 * We acquire tbl->lock to be nice to the periodic timers and
1820 * make sure they always see a consistent set of values. 1818 * make sure they always see a consistent set of values.
1821 */ 1819 */
@@ -2323,7 +2321,7 @@ static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos)
2323 2321
2324 if (*pos == 0) 2322 if (*pos == 0)
2325 return SEQ_START_TOKEN; 2323 return SEQ_START_TOKEN;
2326 2324
2327 for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) { 2325 for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) {
2328 if (!cpu_possible(cpu)) 2326 if (!cpu_possible(cpu))
2329 continue; 2327 continue;
@@ -2405,7 +2403,7 @@ static int neigh_stat_seq_open(struct inode *inode, struct file *file)
2405 return ret; 2403 return ret;
2406}; 2404};
2407 2405
2408static struct file_operations neigh_stat_seq_fops = { 2406static const struct file_operations neigh_stat_seq_fops = {
2409 .owner = THIS_MODULE, 2407 .owner = THIS_MODULE,
2410 .open = neigh_stat_seq_open, 2408 .open = neigh_stat_seq_open,
2411 .read = seq_read, 2409 .read = seq_read,
@@ -2631,7 +2629,7 @@ static struct neigh_sysctl_table {
2631}; 2629};
2632 2630
2633int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, 2631int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
2634 int p_id, int pdev_id, char *p_name, 2632 int p_id, int pdev_id, char *p_name,
2635 proc_handler *handler, ctl_handler *strategy) 2633 proc_handler *handler, ctl_handler *strategy)
2636{ 2634{
2637 struct neigh_sysctl_table *t = kmemdup(&neigh_sysctl_template, 2635 struct neigh_sysctl_table *t = kmemdup(&neigh_sysctl_template,
@@ -2663,7 +2661,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
2663 t->neigh_vars[14].procname = NULL; 2661 t->neigh_vars[14].procname = NULL;
2664 t->neigh_vars[15].procname = NULL; 2662 t->neigh_vars[15].procname = NULL;
2665 } else { 2663 } else {
2666 dev_name_source = t->neigh_dev[0].procname; 2664 dev_name_source = t->neigh_dev[0].procname;
2667 t->neigh_vars[12].data = (int *)(p + 1); 2665 t->neigh_vars[12].data = (int *)(p + 1);
2668 t->neigh_vars[13].data = (int *)(p + 1) + 1; 2666 t->neigh_vars[13].data = (int *)(p + 1) + 1;
2669 t->neigh_vars[14].data = (int *)(p + 1) + 2; 2667 t->neigh_vars[14].data = (int *)(p + 1) + 2;
@@ -2698,7 +2696,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
2698 goto free; 2696 goto free;
2699 } 2697 }
2700 2698
2701 t->neigh_dev[0].procname = dev_name; 2699 t->neigh_dev[0].procname = dev_name;
2702 2700
2703 t->neigh_neigh_dir[0].ctl_name = pdev_id; 2701 t->neigh_neigh_dir[0].ctl_name = pdev_id;
2704 2702
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index cd59ac620092..4cbb1290a6a3 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -2,7 +2,7 @@
2 * net-sysfs.c - network device class and attributes 2 * net-sysfs.c - network device class and attributes
3 * 3 *
4 * Copyright (c) 2003 Stephen Hemminger <shemminger@osdl.org> 4 * Copyright (c) 2003 Stephen Hemminger <shemminger@osdl.org>
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
@@ -23,7 +23,7 @@ static const char fmt_long_hex[] = "%#lx\n";
23static const char fmt_dec[] = "%d\n"; 23static const char fmt_dec[] = "%d\n";
24static const char fmt_ulong[] = "%lu\n"; 24static const char fmt_ulong[] = "%lu\n";
25 25
26static inline int dev_isalive(const struct net_device *dev) 26static inline int dev_isalive(const struct net_device *dev)
27{ 27{
28 return dev->reg_state <= NETREG_REGISTERED; 28 return dev->reg_state <= NETREG_REGISTERED;
29} 29}
@@ -265,7 +265,7 @@ static ssize_t netstat_show(const struct device *d,
265 265
266 read_lock(&dev_base_lock); 266 read_lock(&dev_base_lock);
267 if (dev_isalive(dev) && dev->get_stats && 267 if (dev_isalive(dev) && dev->get_stats &&
268 (stats = (*dev->get_stats)(dev))) 268 (stats = (*dev->get_stats)(dev)))
269 ret = sprintf(buf, fmt_ulong, 269 ret = sprintf(buf, fmt_ulong,
270 *(unsigned long *)(((u8 *) stats) + offset)); 270 *(unsigned long *)(((u8 *) stats) + offset));
271 271
@@ -349,7 +349,7 @@ static ssize_t wireless_show(struct device *d, char *buf,
349 struct net_device *dev = to_net_dev(d); 349 struct net_device *dev = to_net_dev(d);
350 const struct iw_statistics *iw = NULL; 350 const struct iw_statistics *iw = NULL;
351 ssize_t ret = -EINVAL; 351 ssize_t ret = -EINVAL;
352 352
353 read_lock(&dev_base_lock); 353 read_lock(&dev_base_lock);
354 if (dev_isalive(dev)) { 354 if (dev_isalive(dev)) {
355 if(dev->wireless_handlers && 355 if(dev->wireless_handlers &&
@@ -430,7 +430,7 @@ static int netdev_uevent(struct device *d, char **envp,
430#endif 430#endif
431 431
432/* 432/*
433 * netdev_release -- destroy and free a dead device. 433 * netdev_release -- destroy and free a dead device.
434 * Called when last reference to device kobject is gone. 434 * Called when last reference to device kobject is gone.
435 */ 435 */
436static void netdev_release(struct device *d) 436static void netdev_release(struct device *d)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 823215d8e90f..da1019451ccb 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -237,13 +237,13 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
237{ 237{
238 int status = NETDEV_TX_BUSY; 238 int status = NETDEV_TX_BUSY;
239 unsigned long tries; 239 unsigned long tries;
240 struct net_device *dev = np->dev; 240 struct net_device *dev = np->dev;
241 struct netpoll_info *npinfo = np->dev->npinfo; 241 struct netpoll_info *npinfo = np->dev->npinfo;
242 242
243 if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) { 243 if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) {
244 __kfree_skb(skb); 244 __kfree_skb(skb);
245 return; 245 return;
246 } 246 }
247 247
248 /* don't get messages out of order, and no recursion */ 248 /* don't get messages out of order, and no recursion */
249 if (skb_queue_len(&npinfo->txq) == 0 && 249 if (skb_queue_len(&npinfo->txq) == 0 &&
@@ -676,7 +676,7 @@ int netpoll_setup(struct netpoll *np)
676 } 676 }
677 677
678 atleast = jiffies + HZ/10; 678 atleast = jiffies + HZ/10;
679 atmost = jiffies + 4*HZ; 679 atmost = jiffies + 4*HZ;
680 while (!netif_carrier_ok(ndev)) { 680 while (!netif_carrier_ok(ndev)) {
681 if (time_after(jiffies, atmost)) { 681 if (time_after(jiffies, atmost)) {
682 printk(KERN_NOTICE 682 printk(KERN_NOTICE
@@ -772,9 +772,9 @@ void netpoll_cleanup(struct netpoll *np)
772 np->dev->npinfo = NULL; 772 np->dev->npinfo = NULL;
773 if (atomic_dec_and_test(&npinfo->refcnt)) { 773 if (atomic_dec_and_test(&npinfo->refcnt)) {
774 skb_queue_purge(&npinfo->arp_tx); 774 skb_queue_purge(&npinfo->arp_tx);
775 skb_queue_purge(&npinfo->txq); 775 skb_queue_purge(&npinfo->txq);
776 cancel_rearming_delayed_work(&npinfo->tx_work); 776 cancel_rearming_delayed_work(&npinfo->tx_work);
777 flush_scheduled_work(); 777 flush_scheduled_work();
778 778
779 kfree(npinfo); 779 kfree(npinfo);
780 } 780 }
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 04d4b93c68eb..74a9a32b906d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -15,7 +15,7 @@
15 * 15 *
16 * 16 *
17 * A tool for loading the network with preconfigurated packets. 17 * A tool for loading the network with preconfigurated packets.
18 * The tool is implemented as a linux module. Parameters are output 18 * The tool is implemented as a linux module. Parameters are output
19 * device, delay (to hard_xmit), number of packets, and whether 19 * device, delay (to hard_xmit), number of packets, and whether
20 * to use multiple SKBs or just the same one. 20 * to use multiple SKBs or just the same one.
21 * pktgen uses the installed interface's output routine. 21 * pktgen uses the installed interface's output routine.
@@ -44,14 +44,14 @@
44 * * Add IOCTL interface to easily get counters & configuration. 44 * * Add IOCTL interface to easily get counters & configuration.
45 * --Ben Greear <greearb@candelatech.com> 45 * --Ben Greear <greearb@candelatech.com>
46 * 46 *
47 * Renamed multiskb to clone_skb and cleaned up sending core for two distinct 47 * Renamed multiskb to clone_skb and cleaned up sending core for two distinct
48 * skb modes. A clone_skb=0 mode for Ben "ranges" work and a clone_skb != 0 48 * skb modes. A clone_skb=0 mode for Ben "ranges" work and a clone_skb != 0
49 * as a "fastpath" with a configurable number of clones after alloc's. 49 * as a "fastpath" with a configurable number of clones after alloc's.
50 * clone_skb=0 means all packets are allocated this also means ranges time 50 * clone_skb=0 means all packets are allocated this also means ranges time
51 * stamps etc can be used. clone_skb=100 means 1 malloc is followed by 100 51 * stamps etc can be used. clone_skb=100 means 1 malloc is followed by 100
52 * clones. 52 * clones.
53 * 53 *
54 * Also moved to /proc/net/pktgen/ 54 * Also moved to /proc/net/pktgen/
55 * --ro 55 * --ro
56 * 56 *
57 * Sept 10: Fixed threading/locking. Lots of bone-headed and more clever 57 * Sept 10: Fixed threading/locking. Lots of bone-headed and more clever
@@ -60,28 +60,28 @@
60 * 60 *
61 * Integrated to 2.5.x 021029 --Lucio Maciel (luciomaciel@zipmail.com.br) 61 * Integrated to 2.5.x 021029 --Lucio Maciel (luciomaciel@zipmail.com.br)
62 * 62 *
63 * 63 *
64 * 021124 Finished major redesign and rewrite for new functionality. 64 * 021124 Finished major redesign and rewrite for new functionality.
65 * See Documentation/networking/pktgen.txt for how to use this. 65 * See Documentation/networking/pktgen.txt for how to use this.
66 * 66 *
67 * The new operation: 67 * The new operation:
68 * For each CPU one thread/process is created at start. This process checks 68 * For each CPU one thread/process is created at start. This process checks
69 * for running devices in the if_list and sends packets until count is 0 it 69 * for running devices in the if_list and sends packets until count is 0 it
70 * also the thread checks the thread->control which is used for inter-process 70 * also the thread checks the thread->control which is used for inter-process
71 * communication. controlling process "posts" operations to the threads this 71 * communication. controlling process "posts" operations to the threads this
72 * way. The if_lock should be possible to remove when add/rem_device is merged 72 * way. The if_lock should be possible to remove when add/rem_device is merged
73 * into this too. 73 * into this too.
74 * 74 *
75 * By design there should only be *one* "controlling" process. In practice 75 * By design there should only be *one* "controlling" process. In practice
76 * multiple write accesses gives unpredictable result. Understood by "write" 76 * multiple write accesses gives unpredictable result. Understood by "write"
77 * to /proc gives result code thats should be read be the "writer". 77 * to /proc gives result code thats should be read be the "writer".
78 * For practical use this should be no problem. 78 * For practical use this should be no problem.
79 * 79 *
80 * Note when adding devices to a specific CPU there good idea to also assign 80 * Note when adding devices to a specific CPU there good idea to also assign
81 * /proc/irq/XX/smp_affinity so TX-interrupts gets bound to the same CPU. 81 * /proc/irq/XX/smp_affinity so TX-interrupts gets bound to the same CPU.
82 * --ro 82 * --ro
83 * 83 *
84 * Fix refcount off by one if first packet fails, potential null deref, 84 * Fix refcount off by one if first packet fails, potential null deref,
85 * memleak 030710- KJP 85 * memleak 030710- KJP
86 * 86 *
87 * First "ranges" functionality for ipv6 030726 --ro 87 * First "ranges" functionality for ipv6 030726 --ro
@@ -89,22 +89,22 @@
89 * Included flow support. 030802 ANK. 89 * Included flow support. 030802 ANK.
90 * 90 *
91 * Fixed unaligned access on IA-64 Grant Grundler <grundler@parisc-linux.org> 91 * Fixed unaligned access on IA-64 Grant Grundler <grundler@parisc-linux.org>
92 * 92 *
93 * Remove if fix from added Harald Welte <laforge@netfilter.org> 040419 93 * Remove if fix from added Harald Welte <laforge@netfilter.org> 040419
94 * ia64 compilation fix from Aron Griffis <aron@hp.com> 040604 94 * ia64 compilation fix from Aron Griffis <aron@hp.com> 040604
95 * 95 *
96 * New xmit() return, do_div and misc clean up by Stephen Hemminger 96 * New xmit() return, do_div and misc clean up by Stephen Hemminger
97 * <shemminger@osdl.org> 040923 97 * <shemminger@osdl.org> 040923
98 * 98 *
99 * Randy Dunlap fixed u64 printk compiler waring 99 * Randy Dunlap fixed u64 printk compiler waring
100 * 100 *
101 * Remove FCS from BW calculation. Lennert Buytenhek <buytenh@wantstofly.org> 101 * Remove FCS from BW calculation. Lennert Buytenhek <buytenh@wantstofly.org>
102 * New time handling. Lennert Buytenhek <buytenh@wantstofly.org> 041213 102 * New time handling. Lennert Buytenhek <buytenh@wantstofly.org> 041213
103 * 103 *
104 * Corrections from Nikolai Malykh (nmalykh@bilim.com) 104 * Corrections from Nikolai Malykh (nmalykh@bilim.com)
105 * Removed unused flags F_SET_SRCMAC & F_SET_SRCIP 041230 105 * Removed unused flags F_SET_SRCMAC & F_SET_SRCIP 041230
106 * 106 *
107 * interruptible_sleep_on_timeout() replaced Nishanth Aravamudan <nacc@us.ibm.com> 107 * interruptible_sleep_on_timeout() replaced Nishanth Aravamudan <nacc@us.ibm.com>
108 * 050103 108 * 050103
109 * 109 *
110 * MPLS support by Steven Whitehouse <steve@chygwyn.com> 110 * MPLS support by Steven Whitehouse <steve@chygwyn.com>
@@ -456,7 +456,7 @@ static inline __u64 pg_div64(__u64 n, __u64 base)
456/* 456/*
457 * How do we know if the architecture we are running on 457 * How do we know if the architecture we are running on
458 * supports division with 64 bit base? 458 * supports division with 64 bit base?
459 * 459 *
460 */ 460 */
461#if defined(__sparc_v9__) || defined(__powerpc64__) || defined(__alpha__) || defined(__x86_64__) || defined(__ia64__) 461#if defined(__sparc_v9__) || defined(__powerpc64__) || defined(__alpha__) || defined(__x86_64__) || defined(__ia64__)
462 462
@@ -529,7 +529,7 @@ static struct notifier_block pktgen_notifier_block = {
529}; 529};
530 530
531/* 531/*
532 * /proc handling functions 532 * /proc handling functions
533 * 533 *
534 */ 534 */
535 535
@@ -579,7 +579,7 @@ static int pgctrl_open(struct inode *inode, struct file *file)
579 return single_open(file, pgctrl_show, PDE(inode)->data); 579 return single_open(file, pgctrl_show, PDE(inode)->data);
580} 580}
581 581
582static struct file_operations pktgen_fops = { 582static const struct file_operations pktgen_fops = {
583 .owner = THIS_MODULE, 583 .owner = THIS_MODULE,
584 .open = pgctrl_open, 584 .open = pgctrl_open,
585 .read = seq_read, 585 .read = seq_read,
@@ -1672,7 +1672,7 @@ static int pktgen_if_open(struct inode *inode, struct file *file)
1672 return single_open(file, pktgen_if_show, PDE(inode)->data); 1672 return single_open(file, pktgen_if_show, PDE(inode)->data);
1673} 1673}
1674 1674
1675static struct file_operations pktgen_if_fops = { 1675static const struct file_operations pktgen_if_fops = {
1676 .owner = THIS_MODULE, 1676 .owner = THIS_MODULE,
1677 .open = pktgen_if_open, 1677 .open = pktgen_if_open,
1678 .read = seq_read, 1678 .read = seq_read,
@@ -1815,7 +1815,7 @@ static int pktgen_thread_open(struct inode *inode, struct file *file)
1815 return single_open(file, pktgen_thread_show, PDE(inode)->data); 1815 return single_open(file, pktgen_thread_show, PDE(inode)->data);
1816} 1816}
1817 1817
1818static struct file_operations pktgen_thread_fops = { 1818static const struct file_operations pktgen_thread_fops = {
1819 .owner = THIS_MODULE, 1819 .owner = THIS_MODULE,
1820 .open = pktgen_thread_open, 1820 .open = pktgen_thread_open,
1821 .read = seq_read, 1821 .read = seq_read,
@@ -1979,7 +1979,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
1979 1979
1980 if (pkt_dev->flags & F_IPV6) { 1980 if (pkt_dev->flags & F_IPV6) {
1981 /* 1981 /*
1982 * Skip this automatic address setting until locks or functions 1982 * Skip this automatic address setting until locks or functions
1983 * gets exported 1983 * gets exported
1984 */ 1984 */
1985 1985
@@ -2477,10 +2477,10 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
2477} 2477}
2478 2478
2479/* 2479/*
2480 * scan_ip6, fmt_ip taken from dietlibc-0.21 2480 * scan_ip6, fmt_ip taken from dietlibc-0.21
2481 * Author Felix von Leitner <felix-dietlibc@fefe.de> 2481 * Author Felix von Leitner <felix-dietlibc@fefe.de>
2482 * 2482 *
2483 * Slightly modified for kernel. 2483 * Slightly modified for kernel.
2484 * Should be candidate for net/ipv4/utils.c 2484 * Should be candidate for net/ipv4/utils.c
2485 * --ro 2485 * --ro
2486 */ 2486 */
@@ -3256,7 +3256,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
3256out:; 3256out:;
3257} 3257}
3258 3258
3259/* 3259/*
3260 * Main loop of the thread goes here 3260 * Main loop of the thread goes here
3261 */ 3261 */
3262 3262
@@ -3365,8 +3365,8 @@ static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t,
3365 return pkt_dev; 3365 return pkt_dev;
3366} 3366}
3367 3367
3368/* 3368/*
3369 * Adds a dev at front of if_list. 3369 * Adds a dev at front of if_list.
3370 */ 3370 */
3371 3371
3372static int add_dev_to_thread(struct pktgen_thread *t, 3372static int add_dev_to_thread(struct pktgen_thread *t,
@@ -3510,8 +3510,8 @@ static int __init pktgen_create_thread(int cpu)
3510 return 0; 3510 return 0;
3511} 3511}
3512 3512
3513/* 3513/*
3514 * Removes a device from the thread if_list. 3514 * Removes a device from the thread if_list.
3515 */ 3515 */
3516static void _rem_dev_from_if_list(struct pktgen_thread *t, 3516static void _rem_dev_from_if_list(struct pktgen_thread *t,
3517 struct pktgen_dev *pkt_dev) 3517 struct pktgen_dev *pkt_dev)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 9bf9ae05f157..ee5a787271f6 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -874,7 +874,7 @@ void __init rtnetlink_init(void)
874 panic("rtnetlink_init: cannot allocate rta_buf\n"); 874 panic("rtnetlink_init: cannot allocate rta_buf\n");
875 875
876 rtnl = netlink_kernel_create(NETLINK_ROUTE, RTNLGRP_MAX, rtnetlink_rcv, 876 rtnl = netlink_kernel_create(NETLINK_ROUTE, RTNLGRP_MAX, rtnetlink_rcv,
877 THIS_MODULE); 877 THIS_MODULE);
878 if (rtnl == NULL) 878 if (rtnl == NULL)
879 panic("rtnetlink_init: cannot initialize rtnetlink\n"); 879 panic("rtnetlink_init: cannot initialize rtnetlink\n");
880 netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV); 880 netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV);
diff --git a/net/core/scm.c b/net/core/scm.c
index 271cf060ef8c..292ad8d5ad76 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -36,7 +36,7 @@
36 36
37 37
38/* 38/*
39 * Only allow a user to send credentials, that they could set with 39 * Only allow a user to send credentials, that they could set with
40 * setu(g)id. 40 * setu(g)id.
41 */ 41 */
42 42
@@ -79,11 +79,11 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)
79 79
80 if (fpl->count + num > SCM_MAX_FD) 80 if (fpl->count + num > SCM_MAX_FD)
81 return -EINVAL; 81 return -EINVAL;
82 82
83 /* 83 /*
84 * Verify the descriptors and increment the usage count. 84 * Verify the descriptors and increment the usage count.
85 */ 85 */
86 86
87 for (i=0; i< num; i++) 87 for (i=0; i< num; i++)
88 { 88 {
89 int fd = fdp[i]; 89 int fd = fdp[i];
@@ -123,7 +123,7 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p)
123 /* The first check was omitted in <= 2.2.5. The reasoning was 123 /* The first check was omitted in <= 2.2.5. The reasoning was
124 that parser checks cmsg_len in any case, so that 124 that parser checks cmsg_len in any case, so that
125 additional check would be work duplication. 125 additional check would be work duplication.
126 But if cmsg_level is not SOL_SOCKET, we do not check 126 But if cmsg_level is not SOL_SOCKET, we do not check
127 for too short ancillary data object at all! Oops. 127 for too short ancillary data object at all! Oops.
128 OK, let's add it... 128 OK, let's add it...
129 */ 129 */
@@ -159,7 +159,7 @@ int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *p)
159 p->fp = NULL; 159 p->fp = NULL;
160 } 160 }
161 return 0; 161 return 0;
162 162
163error: 163error:
164 scm_destroy(p); 164 scm_destroy(p);
165 return err; 165 return err;
@@ -189,7 +189,7 @@ int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data)
189 189
190 err = -EFAULT; 190 err = -EFAULT;
191 if (copy_to_user(cm, &cmhdr, sizeof cmhdr)) 191 if (copy_to_user(cm, &cmhdr, sizeof cmhdr))
192 goto out; 192 goto out;
193 if (copy_to_user(CMSG_DATA(cm), data, cmlen - sizeof(struct cmsghdr))) 193 if (copy_to_user(CMSG_DATA(cm), data, cmlen - sizeof(struct cmsghdr)))
194 goto out; 194 goto out;
195 cmlen = CMSG_SPACE(len); 195 cmlen = CMSG_SPACE(len);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f3404ae9f190..3d5646869022 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -88,7 +88,7 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly;
88void skb_over_panic(struct sk_buff *skb, int sz, void *here) 88void skb_over_panic(struct sk_buff *skb, int sz, void *here)
89{ 89{
90 printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p " 90 printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p "
91 "data:%p tail:%p end:%p dev:%s\n", 91 "data:%p tail:%p end:%p dev:%s\n",
92 here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, 92 here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end,
93 skb->dev ? skb->dev->name : "<NULL>"); 93 skb->dev ? skb->dev->name : "<NULL>");
94 BUG(); 94 BUG();
@@ -106,7 +106,7 @@ void skb_over_panic(struct sk_buff *skb, int sz, void *here)
106void skb_under_panic(struct sk_buff *skb, int sz, void *here) 106void skb_under_panic(struct sk_buff *skb, int sz, void *here)
107{ 107{
108 printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p " 108 printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p "
109 "data:%p tail:%p end:%p dev:%s\n", 109 "data:%p tail:%p end:%p dev:%s\n",
110 here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end, 110 here, skb->len, sz, skb->head, skb->data, skb->tail, skb->end,
111 skb->dev ? skb->dev->name : "<NULL>"); 111 skb->dev ? skb->dev->name : "<NULL>");
112 BUG(); 112 BUG();
@@ -271,7 +271,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
271 int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1; 271 int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1;
272 struct sk_buff *skb; 272 struct sk_buff *skb;
273 273
274 skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node); 274 skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node);
275 if (likely(skb)) { 275 if (likely(skb)) {
276 skb_reserve(skb, NET_SKB_PAD); 276 skb_reserve(skb, NET_SKB_PAD);
277 skb->dev = dev; 277 skb->dev = dev;
@@ -819,12 +819,12 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
819 * 819 *
820 * May return error in out of memory cases. The skb is freed on error. 820 * May return error in out of memory cases. The skb is freed on error.
821 */ 821 */
822 822
823int skb_pad(struct sk_buff *skb, int pad) 823int skb_pad(struct sk_buff *skb, int pad)
824{ 824{
825 int err; 825 int err;
826 int ntail; 826 int ntail;
827 827
828 /* If the skbuff is non linear tailroom is always zero.. */ 828 /* If the skbuff is non linear tailroom is always zero.. */
829 if (!skb_cloned(skb) && skb_tailroom(skb) >= pad) { 829 if (!skb_cloned(skb) && skb_tailroom(skb) >= pad) {
830 memset(skb->data+skb->len, 0, pad); 830 memset(skb->data+skb->len, 0, pad);
@@ -851,8 +851,8 @@ int skb_pad(struct sk_buff *skb, int pad)
851free_skb: 851free_skb:
852 kfree_skb(skb); 852 kfree_skb(skb);
853 return err; 853 return err;
854} 854}
855 855
856/* Trims skb to length len. It can change skb pointers. 856/* Trims skb to length len. It can change skb pointers.
857 */ 857 */
858 858
diff --git a/net/core/sock.c b/net/core/sock.c
index 0ed5b4f0bc40..e9986acdd0ab 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -34,7 +34,7 @@
34 * Alan Cox : TCP ack handling is buggy, the DESTROY timer 34 * Alan Cox : TCP ack handling is buggy, the DESTROY timer
35 * was buggy. Put a remove_sock() in the handler 35 * was buggy. Put a remove_sock() in the handler
36 * for memory when we hit 0. Also altered the timer 36 * for memory when we hit 0. Also altered the timer
37 * code. The ACK stuff can wait and needs major 37 * code. The ACK stuff can wait and needs major
38 * TCP layer surgery. 38 * TCP layer surgery.
39 * Alan Cox : Fixed TCP ack bug, removed remove sock 39 * Alan Cox : Fixed TCP ack bug, removed remove sock
40 * and fixed timer/inet_bh race. 40 * and fixed timer/inet_bh race.
@@ -217,8 +217,8 @@ static void sock_warn_obsolete_bsdism(const char *name)
217{ 217{
218 static int warned; 218 static int warned;
219 static char warncomm[TASK_COMM_LEN]; 219 static char warncomm[TASK_COMM_LEN];
220 if (strcmp(warncomm, current->comm) && warned < 5) { 220 if (strcmp(warncomm, current->comm) && warned < 5) {
221 strcpy(warncomm, current->comm); 221 strcpy(warncomm, current->comm);
222 printk(KERN_WARNING "process `%s' is using obsolete " 222 printk(KERN_WARNING "process `%s' is using obsolete "
223 "%s SO_BSDCOMPAT\n", warncomm, name); 223 "%s SO_BSDCOMPAT\n", warncomm, name);
224 warned++; 224 warned++;
@@ -226,8 +226,8 @@ static void sock_warn_obsolete_bsdism(const char *name)
226} 226}
227 227
228static void sock_disable_timestamp(struct sock *sk) 228static void sock_disable_timestamp(struct sock *sk)
229{ 229{
230 if (sock_flag(sk, SOCK_TIMESTAMP)) { 230 if (sock_flag(sk, SOCK_TIMESTAMP)) {
231 sock_reset_flag(sk, SOCK_TIMESTAMP); 231 sock_reset_flag(sk, SOCK_TIMESTAMP);
232 net_disable_timestamp(); 232 net_disable_timestamp();
233 } 233 }
@@ -347,7 +347,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
347 int valbool; 347 int valbool;
348 struct linger ling; 348 struct linger ling;
349 int ret = 0; 349 int ret = 0;
350 350
351 /* 351 /*
352 * Options without arguments 352 * Options without arguments
353 */ 353 */
@@ -360,20 +360,20 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
360 return 0; 360 return 0;
361 } 361 }
362#endif 362#endif
363 363
364 if(optlen<sizeof(int)) 364 if(optlen<sizeof(int))
365 return(-EINVAL); 365 return(-EINVAL);
366 366
367 if (get_user(val, (int __user *)optval)) 367 if (get_user(val, (int __user *)optval))
368 return -EFAULT; 368 return -EFAULT;
369 369
370 valbool = val?1:0; 370 valbool = val?1:0;
371 371
372 lock_sock(sk); 372 lock_sock(sk);
373 373
374 switch(optname) 374 switch(optname)
375 { 375 {
376 case SO_DEBUG: 376 case SO_DEBUG:
377 if(val && !capable(CAP_NET_ADMIN)) 377 if(val && !capable(CAP_NET_ADMIN))
378 { 378 {
379 ret = -EACCES; 379 ret = -EACCES;
@@ -389,7 +389,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
389 case SO_TYPE: 389 case SO_TYPE:
390 case SO_ERROR: 390 case SO_ERROR:
391 ret = -ENOPROTOOPT; 391 ret = -ENOPROTOOPT;
392 break; 392 break;
393 case SO_DONTROUTE: 393 case SO_DONTROUTE:
394 if (valbool) 394 if (valbool)
395 sock_set_flag(sk, SOCK_LOCALROUTE); 395 sock_set_flag(sk, SOCK_LOCALROUTE);
@@ -404,7 +404,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
404 about it this is right. Otherwise apps have to 404 about it this is right. Otherwise apps have to
405 play 'guess the biggest size' games. RCVBUF/SNDBUF 405 play 'guess the biggest size' games. RCVBUF/SNDBUF
406 are treated in BSD as hints */ 406 are treated in BSD as hints */
407 407
408 if (val > sysctl_wmem_max) 408 if (val > sysctl_wmem_max)
409 val = sysctl_wmem_max; 409 val = sysctl_wmem_max;
410set_sndbuf: 410set_sndbuf:
@@ -433,7 +433,7 @@ set_sndbuf:
433 about it this is right. Otherwise apps have to 433 about it this is right. Otherwise apps have to
434 play 'guess the biggest size' games. RCVBUF/SNDBUF 434 play 'guess the biggest size' games. RCVBUF/SNDBUF
435 are treated in BSD as hints */ 435 are treated in BSD as hints */
436 436
437 if (val > sysctl_rmem_max) 437 if (val > sysctl_rmem_max)
438 val = sysctl_rmem_max; 438 val = sysctl_rmem_max;
439set_rcvbuf: 439set_rcvbuf:
@@ -474,16 +474,16 @@ set_rcvbuf:
474 sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); 474 sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool);
475 break; 475 break;
476 476
477 case SO_OOBINLINE: 477 case SO_OOBINLINE:
478 sock_valbool_flag(sk, SOCK_URGINLINE, valbool); 478 sock_valbool_flag(sk, SOCK_URGINLINE, valbool);
479 break; 479 break;
480 480
481 case SO_NO_CHECK: 481 case SO_NO_CHECK:
482 sk->sk_no_check = valbool; 482 sk->sk_no_check = valbool;
483 break; 483 break;
484 484
485 case SO_PRIORITY: 485 case SO_PRIORITY:
486 if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN)) 486 if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN))
487 sk->sk_priority = val; 487 sk->sk_priority = val;
488 else 488 else
489 ret = -EPERM; 489 ret = -EPERM;
@@ -547,9 +547,9 @@ set_rcvbuf:
547#ifdef CONFIG_NETDEVICES 547#ifdef CONFIG_NETDEVICES
548 case SO_BINDTODEVICE: 548 case SO_BINDTODEVICE:
549 { 549 {
550 char devname[IFNAMSIZ]; 550 char devname[IFNAMSIZ];
551 551
552 /* Sorry... */ 552 /* Sorry... */
553 if (!capable(CAP_NET_RAW)) { 553 if (!capable(CAP_NET_RAW)) {
554 ret = -EPERM; 554 ret = -EPERM;
555 break; 555 break;
@@ -557,9 +557,9 @@ set_rcvbuf:
557 557
558 /* Bind this socket to a particular device like "eth0", 558 /* Bind this socket to a particular device like "eth0",
559 * as specified in the passed interface name. If the 559 * as specified in the passed interface name. If the
560 * name is "" or the option length is zero the socket 560 * name is "" or the option length is zero the socket
561 * is not bound. 561 * is not bound.
562 */ 562 */
563 563
564 if (!valbool) { 564 if (!valbool) {
565 sk->sk_bound_dev_if = 0; 565 sk->sk_bound_dev_if = 0;
@@ -608,7 +608,7 @@ set_rcvbuf:
608 case SO_DETACH_FILTER: 608 case SO_DETACH_FILTER:
609 rcu_read_lock_bh(); 609 rcu_read_lock_bh();
610 filter = rcu_dereference(sk->sk_filter); 610 filter = rcu_dereference(sk->sk_filter);
611 if (filter) { 611 if (filter) {
612 rcu_assign_pointer(sk->sk_filter, NULL); 612 rcu_assign_pointer(sk->sk_filter, NULL);
613 sk_filter_release(sk, filter); 613 sk_filter_release(sk, filter);
614 rcu_read_unlock_bh(); 614 rcu_read_unlock_bh();
@@ -628,9 +628,9 @@ set_rcvbuf:
628 /* We implement the SO_SNDLOWAT etc to 628 /* We implement the SO_SNDLOWAT etc to
629 not be settable (1003.1g 5.3) */ 629 not be settable (1003.1g 5.3) */
630 default: 630 default:
631 ret = -ENOPROTOOPT; 631 ret = -ENOPROTOOPT;
632 break; 632 break;
633 } 633 }
634 release_sock(sk); 634 release_sock(sk);
635 return ret; 635 return ret;
636} 636}
@@ -640,32 +640,32 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
640 char __user *optval, int __user *optlen) 640 char __user *optval, int __user *optlen)
641{ 641{
642 struct sock *sk = sock->sk; 642 struct sock *sk = sock->sk;
643 643
644 union 644 union
645 { 645 {
646 int val; 646 int val;
647 struct linger ling; 647 struct linger ling;
648 struct timeval tm; 648 struct timeval tm;
649 } v; 649 } v;
650 650
651 unsigned int lv = sizeof(int); 651 unsigned int lv = sizeof(int);
652 int len; 652 int len;
653 653
654 if(get_user(len,optlen)) 654 if(get_user(len,optlen))
655 return -EFAULT; 655 return -EFAULT;
656 if(len < 0) 656 if(len < 0)
657 return -EINVAL; 657 return -EINVAL;
658 658
659 switch(optname) 659 switch(optname)
660 { 660 {
661 case SO_DEBUG: 661 case SO_DEBUG:
662 v.val = sock_flag(sk, SOCK_DBG); 662 v.val = sock_flag(sk, SOCK_DBG);
663 break; 663 break;
664 664
665 case SO_DONTROUTE: 665 case SO_DONTROUTE:
666 v.val = sock_flag(sk, SOCK_LOCALROUTE); 666 v.val = sock_flag(sk, SOCK_LOCALROUTE);
667 break; 667 break;
668 668
669 case SO_BROADCAST: 669 case SO_BROADCAST:
670 v.val = !!sock_flag(sk, SOCK_BROADCAST); 670 v.val = !!sock_flag(sk, SOCK_BROADCAST);
671 break; 671 break;
@@ -673,7 +673,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
673 case SO_SNDBUF: 673 case SO_SNDBUF:
674 v.val = sk->sk_sndbuf; 674 v.val = sk->sk_sndbuf;
675 break; 675 break;
676 676
677 case SO_RCVBUF: 677 case SO_RCVBUF:
678 v.val = sk->sk_rcvbuf; 678 v.val = sk->sk_rcvbuf;
679 break; 679 break;
@@ -687,7 +687,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
687 break; 687 break;
688 688
689 case SO_TYPE: 689 case SO_TYPE:
690 v.val = sk->sk_type; 690 v.val = sk->sk_type;
691 break; 691 break;
692 692
693 case SO_ERROR: 693 case SO_ERROR:
@@ -699,7 +699,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
699 case SO_OOBINLINE: 699 case SO_OOBINLINE:
700 v.val = !!sock_flag(sk, SOCK_URGINLINE); 700 v.val = !!sock_flag(sk, SOCK_URGINLINE);
701 break; 701 break;
702 702
703 case SO_NO_CHECK: 703 case SO_NO_CHECK:
704 v.val = sk->sk_no_check; 704 v.val = sk->sk_no_check;
705 break; 705 break;
@@ -707,13 +707,13 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
707 case SO_PRIORITY: 707 case SO_PRIORITY:
708 v.val = sk->sk_priority; 708 v.val = sk->sk_priority;
709 break; 709 break;
710 710
711 case SO_LINGER: 711 case SO_LINGER:
712 lv = sizeof(v.ling); 712 lv = sizeof(v.ling);
713 v.ling.l_onoff = !!sock_flag(sk, SOCK_LINGER); 713 v.ling.l_onoff = !!sock_flag(sk, SOCK_LINGER);
714 v.ling.l_linger = sk->sk_lingertime / HZ; 714 v.ling.l_linger = sk->sk_lingertime / HZ;
715 break; 715 break;
716 716
717 case SO_BSDCOMPAT: 717 case SO_BSDCOMPAT:
718 sock_warn_obsolete_bsdism("getsockopt"); 718 sock_warn_obsolete_bsdism("getsockopt");
719 break; 719 break;
@@ -750,7 +750,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
750 750
751 case SO_SNDLOWAT: 751 case SO_SNDLOWAT:
752 v.val=1; 752 v.val=1;
753 break; 753 break;
754 754
755 case SO_PASSCRED: 755 case SO_PASSCRED:
756 v.val = test_bit(SOCK_PASSCRED, &sock->flags) ? 1 : 0; 756 v.val = test_bit(SOCK_PASSCRED, &sock->flags) ? 1 : 0;
@@ -798,9 +798,9 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
798 if (copy_to_user(optval, &v, len)) 798 if (copy_to_user(optval, &v, len))
799 return -EFAULT; 799 return -EFAULT;
800lenout: 800lenout:
801 if (put_user(len, optlen)) 801 if (put_user(len, optlen))
802 return -EFAULT; 802 return -EFAULT;
803 return 0; 803 return 0;
804} 804}
805 805
806/* 806/*
@@ -846,7 +846,7 @@ struct sock *sk_alloc(int family, gfp_t priority,
846 sk->sk_prot = sk->sk_prot_creator = prot; 846 sk->sk_prot = sk->sk_prot_creator = prot;
847 sock_lock_init(sk); 847 sock_lock_init(sk);
848 } 848 }
849 849
850 if (security_sk_alloc(sk, family, priority)) 850 if (security_sk_alloc(sk, family, priority))
851 goto out_free; 851 goto out_free;
852 852
@@ -988,8 +988,8 @@ void __init sk_init(void)
988 */ 988 */
989 989
990 990
991/* 991/*
992 * Write buffer destructor automatically called from kfree_skb. 992 * Write buffer destructor automatically called from kfree_skb.
993 */ 993 */
994void sock_wfree(struct sk_buff *skb) 994void sock_wfree(struct sk_buff *skb)
995{ 995{
@@ -1002,8 +1002,8 @@ void sock_wfree(struct sk_buff *skb)
1002 sock_put(sk); 1002 sock_put(sk);
1003} 1003}
1004 1004
1005/* 1005/*
1006 * Read buffer destructor automatically called from kfree_skb. 1006 * Read buffer destructor automatically called from kfree_skb.
1007 */ 1007 */
1008void sock_rfree(struct sk_buff *skb) 1008void sock_rfree(struct sk_buff *skb)
1009{ 1009{
@@ -1051,7 +1051,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
1051 1051
1052/* 1052/*
1053 * Allocate a skb from the socket's receive buffer. 1053 * Allocate a skb from the socket's receive buffer.
1054 */ 1054 */
1055struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, 1055struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
1056 gfp_t priority) 1056 gfp_t priority)
1057{ 1057{
@@ -1065,16 +1065,16 @@ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
1065 return NULL; 1065 return NULL;
1066} 1066}
1067 1067
1068/* 1068/*
1069 * Allocate a memory block from the socket's option memory buffer. 1069 * Allocate a memory block from the socket's option memory buffer.
1070 */ 1070 */
1071void *sock_kmalloc(struct sock *sk, int size, gfp_t priority) 1071void *sock_kmalloc(struct sock *sk, int size, gfp_t priority)
1072{ 1072{
1073 if ((unsigned)size <= sysctl_optmem_max && 1073 if ((unsigned)size <= sysctl_optmem_max &&
1074 atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) { 1074 atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) {
1075 void *mem; 1075 void *mem;
1076 /* First do the add, to avoid the race if kmalloc 1076 /* First do the add, to avoid the race if kmalloc
1077 * might sleep. 1077 * might sleep.
1078 */ 1078 */
1079 atomic_add(size, &sk->sk_omem_alloc); 1079 atomic_add(size, &sk->sk_omem_alloc);
1080 mem = kmalloc(size, priority); 1080 mem = kmalloc(size, priority);
@@ -1210,7 +1210,7 @@ failure:
1210 return NULL; 1210 return NULL;
1211} 1211}
1212 1212
1213struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, 1213struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
1214 int noblock, int *errcode) 1214 int noblock, int *errcode)
1215{ 1215{
1216 return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); 1216 return sock_alloc_send_pskb(sk, size, 0, noblock, errcode);
@@ -1298,7 +1298,7 @@ int sock_no_bind(struct socket *sock, struct sockaddr *saddr, int len)
1298 return -EOPNOTSUPP; 1298 return -EOPNOTSUPP;
1299} 1299}
1300 1300
1301int sock_no_connect(struct socket *sock, struct sockaddr *saddr, 1301int sock_no_connect(struct socket *sock, struct sockaddr *saddr,
1302 int len, int flags) 1302 int len, int flags)
1303{ 1303{
1304 return -EOPNOTSUPP; 1304 return -EOPNOTSUPP;
@@ -1314,7 +1314,7 @@ int sock_no_accept(struct socket *sock, struct socket *newsock, int flags)
1314 return -EOPNOTSUPP; 1314 return -EOPNOTSUPP;
1315} 1315}
1316 1316
1317int sock_no_getname(struct socket *sock, struct sockaddr *saddr, 1317int sock_no_getname(struct socket *sock, struct sockaddr *saddr,
1318 int *len, int peer) 1318 int *len, int peer)
1319{ 1319{
1320 return -EOPNOTSUPP; 1320 return -EOPNOTSUPP;
@@ -1400,7 +1400,7 @@ static void sock_def_error_report(struct sock *sk)
1400 read_lock(&sk->sk_callback_lock); 1400 read_lock(&sk->sk_callback_lock);
1401 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) 1401 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
1402 wake_up_interruptible(sk->sk_sleep); 1402 wake_up_interruptible(sk->sk_sleep);
1403 sk_wake_async(sk,0,POLL_ERR); 1403 sk_wake_async(sk,0,POLL_ERR);
1404 read_unlock(&sk->sk_callback_lock); 1404 read_unlock(&sk->sk_callback_lock);
1405} 1405}
1406 1406
@@ -1473,7 +1473,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
1473 sk->sk_send_head = NULL; 1473 sk->sk_send_head = NULL;
1474 1474
1475 init_timer(&sk->sk_timer); 1475 init_timer(&sk->sk_timer);
1476 1476
1477 sk->sk_allocation = GFP_KERNEL; 1477 sk->sk_allocation = GFP_KERNEL;
1478 sk->sk_rcvbuf = sysctl_rmem_default; 1478 sk->sk_rcvbuf = sysctl_rmem_default;
1479 sk->sk_sndbuf = sysctl_wmem_default; 1479 sk->sk_sndbuf = sysctl_wmem_default;
@@ -1553,26 +1553,26 @@ void fastcall release_sock(struct sock *sk)
1553EXPORT_SYMBOL(release_sock); 1553EXPORT_SYMBOL(release_sock);
1554 1554
1555int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) 1555int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
1556{ 1556{
1557 if (!sock_flag(sk, SOCK_TIMESTAMP)) 1557 if (!sock_flag(sk, SOCK_TIMESTAMP))
1558 sock_enable_timestamp(sk); 1558 sock_enable_timestamp(sk);
1559 if (sk->sk_stamp.tv_sec == -1) 1559 if (sk->sk_stamp.tv_sec == -1)
1560 return -ENOENT; 1560 return -ENOENT;
1561 if (sk->sk_stamp.tv_sec == 0) 1561 if (sk->sk_stamp.tv_sec == 0)
1562 do_gettimeofday(&sk->sk_stamp); 1562 do_gettimeofday(&sk->sk_stamp);
1563 return copy_to_user(userstamp, &sk->sk_stamp, sizeof(struct timeval)) ? 1563 return copy_to_user(userstamp, &sk->sk_stamp, sizeof(struct timeval)) ?
1564 -EFAULT : 0; 1564 -EFAULT : 0;
1565} 1565}
1566EXPORT_SYMBOL(sock_get_timestamp); 1566EXPORT_SYMBOL(sock_get_timestamp);
1567 1567
1568void sock_enable_timestamp(struct sock *sk) 1568void sock_enable_timestamp(struct sock *sk)
1569{ 1569{
1570 if (!sock_flag(sk, SOCK_TIMESTAMP)) { 1570 if (!sock_flag(sk, SOCK_TIMESTAMP)) {
1571 sock_set_flag(sk, SOCK_TIMESTAMP); 1571 sock_set_flag(sk, SOCK_TIMESTAMP);
1572 net_enable_timestamp(); 1572 net_enable_timestamp();
1573 } 1573 }
1574} 1574}
1575EXPORT_SYMBOL(sock_enable_timestamp); 1575EXPORT_SYMBOL(sock_enable_timestamp);
1576 1576
1577/* 1577/*
1578 * Get a socket option on an socket. 1578 * Get a socket option on an socket.
@@ -1911,7 +1911,7 @@ static int proto_seq_open(struct inode *inode, struct file *file)
1911 return seq_open(file, &proto_seq_ops); 1911 return seq_open(file, &proto_seq_ops);
1912} 1912}
1913 1913
1914static struct file_operations proto_seq_fops = { 1914static const struct file_operations proto_seq_fops = {
1915 .owner = THIS_MODULE, 1915 .owner = THIS_MODULE,
1916 .open = proto_seq_open, 1916 .open = proto_seq_open,
1917 .read = seq_read, 1917 .read = seq_read,
diff --git a/net/core/stream.c b/net/core/stream.c
index d1d7decf70b0..755bacbcb321 100644
--- a/net/core/stream.c
+++ b/net/core/stream.c
@@ -69,7 +69,7 @@ int sk_stream_wait_connect(struct sock *sk, long *timeo_p)
69 sk->sk_write_pending++; 69 sk->sk_write_pending++;
70 done = sk_wait_event(sk, timeo_p, 70 done = sk_wait_event(sk, timeo_p,
71 !sk->sk_err && 71 !sk->sk_err &&
72 !((1 << sk->sk_state) & 72 !((1 << sk->sk_state) &
73 ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT))); 73 ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)));
74 finish_wait(sk->sk_sleep, &wait); 74 finish_wait(sk->sk_sleep, &wait);
75 sk->sk_write_pending--; 75 sk->sk_write_pending--;
@@ -139,7 +139,7 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p)
139 139
140 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); 140 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
141 sk->sk_write_pending++; 141 sk->sk_write_pending++;
142 sk_wait_event(sk, &current_timeo, !sk->sk_err && 142 sk_wait_event(sk, &current_timeo, !sk->sk_err &&
143 !(sk->sk_shutdown & SEND_SHUTDOWN) && 143 !(sk->sk_shutdown & SEND_SHUTDOWN) &&
144 sk_stream_memory_free(sk) && 144 sk_stream_memory_free(sk) &&
145 vm_wait); 145 vm_wait);
diff --git a/net/core/user_dma.c b/net/core/user_dma.c
index 248a6b666aff..0ad1cd57bc39 100644
--- a/net/core/user_dma.c
+++ b/net/core/user_dma.c
@@ -58,7 +58,7 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
58 if (copy > len) 58 if (copy > len)
59 copy = len; 59 copy = len;
60 cookie = dma_memcpy_to_iovec(chan, to, pinned_list, 60 cookie = dma_memcpy_to_iovec(chan, to, pinned_list,
61 skb->data + offset, copy); 61 skb->data + offset, copy);
62 if (cookie < 0) 62 if (cookie < 0)
63 goto fault; 63 goto fault;
64 len -= copy; 64 len -= copy;
@@ -108,8 +108,8 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan,
108 if (copy > len) 108 if (copy > len)
109 copy = len; 109 copy = len;
110 cookie = dma_skb_copy_datagram_iovec(chan, list, 110 cookie = dma_skb_copy_datagram_iovec(chan, list,
111 offset - start, to, copy, 111 offset - start, to, copy,
112 pinned_list); 112 pinned_list);
113 if (cookie < 0) 113 if (cookie < 0)
114 goto fault; 114 goto fault;
115 len -= copy; 115 len -= copy;
@@ -128,5 +128,5 @@ end:
128 } 128 }
129 129
130fault: 130fault:
131 return -EFAULT; 131 return -EFAULT;
132} 132}
diff --git a/net/core/utils.c b/net/core/utils.c
index 61556065f07e..07236c17fab9 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -33,9 +33,9 @@
33int net_msg_cost = 5*HZ; 33int net_msg_cost = 5*HZ;
34int net_msg_burst = 10; 34int net_msg_burst = 10;
35 35
36/* 36/*
37 * All net warning printk()s should be guarded by this function. 37 * All net warning printk()s should be guarded by this function.
38 */ 38 */
39int net_ratelimit(void) 39int net_ratelimit(void)
40{ 40{
41 return __printk_ratelimit(net_msg_cost, net_msg_burst); 41 return __printk_ratelimit(net_msg_cost, net_msg_burst);
diff --git a/net/core/wireless.c b/net/core/wireless.c
index f69ab7b4408e..9936ab11e6e0 100644
--- a/net/core/wireless.c
+++ b/net/core/wireless.c
@@ -369,7 +369,7 @@ static const struct iw_ioctl_description standard_event[] = {
369 .header_type = IW_HEADER_TYPE_ADDR, 369 .header_type = IW_HEADER_TYPE_ADDR,
370 }, 370 },
371 [IWEVEXPIRED - IWEVFIRST] = { 371 [IWEVEXPIRED - IWEVFIRST] = {
372 .header_type = IW_HEADER_TYPE_ADDR, 372 .header_type = IW_HEADER_TYPE_ADDR,
373 }, 373 },
374 [IWEVGENIE - IWEVFIRST] = { 374 [IWEVGENIE - IWEVFIRST] = {
375 .header_type = IW_HEADER_TYPE_POINT, 375 .header_type = IW_HEADER_TYPE_POINT,
@@ -377,7 +377,7 @@ static const struct iw_ioctl_description standard_event[] = {
377 .max_tokens = IW_GENERIC_IE_MAX, 377 .max_tokens = IW_GENERIC_IE_MAX,
378 }, 378 },
379 [IWEVMICHAELMICFAILURE - IWEVFIRST] = { 379 [IWEVMICHAELMICFAILURE - IWEVFIRST] = {
380 .header_type = IW_HEADER_TYPE_POINT, 380 .header_type = IW_HEADER_TYPE_POINT,
381 .token_size = 1, 381 .token_size = 1,
382 .max_tokens = sizeof(struct iw_michaelmicfailure), 382 .max_tokens = sizeof(struct iw_michaelmicfailure),
383 }, 383 },
@@ -630,11 +630,11 @@ static __inline__ void wireless_seq_printf_stats(struct seq_file *seq,
630 dev->name, stats->status, stats->qual.qual, 630 dev->name, stats->status, stats->qual.qual,
631 stats->qual.updated & IW_QUAL_QUAL_UPDATED 631 stats->qual.updated & IW_QUAL_QUAL_UPDATED
632 ? '.' : ' ', 632 ? '.' : ' ',
633 ((__s32) stats->qual.level) - 633 ((__s32) stats->qual.level) -
634 ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0), 634 ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0),
635 stats->qual.updated & IW_QUAL_LEVEL_UPDATED 635 stats->qual.updated & IW_QUAL_LEVEL_UPDATED
636 ? '.' : ' ', 636 ? '.' : ' ',
637 ((__s32) stats->qual.noise) - 637 ((__s32) stats->qual.noise) -
638 ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0), 638 ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0),
639 stats->qual.updated & IW_QUAL_NOISE_UPDATED 639 stats->qual.updated & IW_QUAL_NOISE_UPDATED
640 ? '.' : ' ', 640 ? '.' : ' ',
@@ -674,7 +674,7 @@ static int wireless_seq_open(struct inode *inode, struct file *file)
674 return seq_open(file, &wireless_seq_ops); 674 return seq_open(file, &wireless_seq_ops);
675} 675}
676 676
677static struct file_operations wireless_seq_fops = { 677static const struct file_operations wireless_seq_fops = {
678 .owner = THIS_MODULE, 678 .owner = THIS_MODULE,
679 .open = wireless_seq_open, 679 .open = wireless_seq_open,
680 .read = seq_read, 680 .read = seq_read,
@@ -862,7 +862,7 @@ static int ioctl_standard_call(struct net_device * dev,
862 iwr->u.data.length * 862 iwr->u.data.length *
863 descr->token_size); 863 descr->token_size);
864 if (err) 864 if (err)
865 ret = -EFAULT; 865 ret = -EFAULT;
866#ifdef WE_IOCTL_DEBUG 866#ifdef WE_IOCTL_DEBUG
867 printk(KERN_DEBUG "%s (WE) : Wrote %d bytes\n", 867 printk(KERN_DEBUG "%s (WE) : Wrote %d bytes\n",
868 dev->name, 868 dev->name,
@@ -1040,7 +1040,7 @@ static inline int ioctl_private_call(struct net_device * dev,
1040 err = copy_to_user(iwr->u.data.pointer, extra, 1040 err = copy_to_user(iwr->u.data.pointer, extra,
1041 extra_size); 1041 extra_size);
1042 if (err) 1042 if (err)
1043 ret = -EFAULT; 1043 ret = -EFAULT;
1044#ifdef WE_IOCTL_DEBUG 1044#ifdef WE_IOCTL_DEBUG
1045 printk(KERN_DEBUG "%s (WE) : Wrote %d elem\n", 1045 printk(KERN_DEBUG "%s (WE) : Wrote %d elem\n",
1046 dev->name, iwr->u.data.length); 1046 dev->name, iwr->u.data.length);
@@ -1080,7 +1080,7 @@ int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd)
1080 /* A bunch of special cases, then the generic case... 1080 /* A bunch of special cases, then the generic case...
1081 * Note that 'cmd' is already filtered in dev_ioctl() with 1081 * Note that 'cmd' is already filtered in dev_ioctl() with
1082 * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */ 1082 * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */
1083 switch(cmd) 1083 switch(cmd)
1084 { 1084 {
1085 case SIOCGIWSTATS: 1085 case SIOCGIWSTATS:
1086 /* Get Wireless Stats */ 1086 /* Get Wireless Stats */
@@ -2015,7 +2015,7 @@ void wireless_send_event(struct net_device * dev,
2015 * The best the driver could do is to log an error message. 2015 * The best the driver could do is to log an error message.
2016 * We will do it ourselves instead... 2016 * We will do it ourselves instead...
2017 */ 2017 */
2018 printk(KERN_ERR "%s (WE) : Invalid/Unknown Wireless Event (0x%04X)\n", 2018 printk(KERN_ERR "%s (WE) : Invalid/Unknown Wireless Event (0x%04X)\n",
2019 dev->name, cmd); 2019 dev->name, cmd);
2020 return; 2020 return;
2021 } 2021 }
@@ -2029,11 +2029,11 @@ void wireless_send_event(struct net_device * dev,
2029 if(descr->header_type == IW_HEADER_TYPE_POINT) { 2029 if(descr->header_type == IW_HEADER_TYPE_POINT) {
2030 /* Check if number of token fits within bounds */ 2030 /* Check if number of token fits within bounds */
2031 if(wrqu->data.length > descr->max_tokens) { 2031 if(wrqu->data.length > descr->max_tokens) {
2032 printk(KERN_ERR "%s (WE) : Wireless Event too big (%d)\n", dev->name, wrqu->data.length); 2032 printk(KERN_ERR "%s (WE) : Wireless Event too big (%d)\n", dev->name, wrqu->data.length);
2033 return; 2033 return;
2034 } 2034 }
2035 if(wrqu->data.length < descr->min_tokens) { 2035 if(wrqu->data.length < descr->min_tokens) {
2036 printk(KERN_ERR "%s (WE) : Wireless Event too small (%d)\n", dev->name, wrqu->data.length); 2036 printk(KERN_ERR "%s (WE) : Wireless Event too small (%d)\n", dev->name, wrqu->data.length);
2037 return; 2037 return;
2038 } 2038 }
2039 /* Calculate extra_len - extra is NULL for restricted events */ 2039 /* Calculate extra_len - extra is NULL for restricted events */