diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-02-04 16:20:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-02-04 16:20:01 -0500 |
commit | 44f2c5c841da1b1e0864d768197ab1497b5c2cc1 (patch) | |
tree | a9e62ee30dedd31c5aeb9c1a97cb8efec5dc3398 /net | |
parent | 78d2978874e4e10e97dfd4fd79db45bdc0748550 (diff) | |
parent | 1e6d93e45b231b3ae87c01902ede2315aacfe976 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (68 commits)
net: can: janz-ican3: world-writable sysfs termination file
net: can: at91_can: world-writable sysfs files
MAINTAINERS: update email ids of the be2net driver maintainers.
bridge: Don't put partly initialized fdb into hash
r8169: prevent RxFIFO induced loops in the irq handler.
r8169: RxFIFO overflow oddities with 8168 chipsets.
r8169: use RxFIFO overflow workaround for 8168c chipset.
include/net/genetlink.h: Allow genlmsg_cancel to accept a NULL argument
net: Provide compat support for SIOCGETMIFCNT_IN6 and SIOCGETSGCNT_IN6.
net: Support compat SIOCGETVIFCNT ioctl in ipv4.
net: Fix bug in compat SIOCGETSGCNT handling.
niu: Fix races between up/down and get_stats.
tcp_ecn is an integer not a boolean
atl1c: Add missing PCI device ID
s390: Fix possibly wrong size in strncmp (smsgiucv)
s390: Fix wrong size in memcmp (netiucv)
qeth: allow OSA CHPARM change in suspend state
qeth: allow HiperSockets framesize change in suspend
qeth: add more strict MTU checking
qeth: show new mac-address if its setting fails
...
Diffstat (limited to 'net')
-rw-r--r-- | net/batman-adv/vis.c | 14 | ||||
-rw-r--r-- | net/bridge/br_fdb.c | 4 | ||||
-rw-r--r-- | net/core/dev.c | 5 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 6 | ||||
-rw-r--r-- | net/core/skbuff.c | 1 | ||||
-rw-r--r-- | net/econet/af_econet.c | 4 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 16 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 76 | ||||
-rw-r--r-- | net/ipv4/netfilter/arpt_mangle.c | 6 | ||||
-rw-r--r-- | net/ipv4/raw.c | 19 | ||||
-rw-r--r-- | net/ipv4/route.c | 6 | ||||
-rw-r--r-- | net/ipv6/ip6mr.c | 75 | ||||
-rw-r--r-- | net/ipv6/raw.c | 19 | ||||
-rw-r--r-- | net/ipv6/route.c | 10 | ||||
-rw-r--r-- | net/ipv6/sysctl_net_ipv6.c | 9 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_ecache.c | 3 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 1 | ||||
-rw-r--r-- | net/netfilter/xt_iprange.c | 16 |
18 files changed, 260 insertions, 30 deletions
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index cd4c4231fa48..de1022cacaf7 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -64,6 +64,7 @@ static void free_info(struct kref *ref) | |||
64 | 64 | ||
65 | spin_unlock_bh(&bat_priv->vis_list_lock); | 65 | spin_unlock_bh(&bat_priv->vis_list_lock); |
66 | kfree_skb(info->skb_packet); | 66 | kfree_skb(info->skb_packet); |
67 | kfree(info); | ||
67 | } | 68 | } |
68 | 69 | ||
69 | /* Compare two vis packets, used by the hashing algorithm */ | 70 | /* Compare two vis packets, used by the hashing algorithm */ |
@@ -268,10 +269,10 @@ int vis_seq_print_text(struct seq_file *seq, void *offset) | |||
268 | buff_pos += sprintf(buff + buff_pos, "%pM,", | 269 | buff_pos += sprintf(buff + buff_pos, "%pM,", |
269 | entry->addr); | 270 | entry->addr); |
270 | 271 | ||
271 | for (i = 0; i < packet->entries; i++) | 272 | for (j = 0; j < packet->entries; j++) |
272 | buff_pos += vis_data_read_entry( | 273 | buff_pos += vis_data_read_entry( |
273 | buff + buff_pos, | 274 | buff + buff_pos, |
274 | &entries[i], | 275 | &entries[j], |
275 | entry->addr, | 276 | entry->addr, |
276 | entry->primary); | 277 | entry->primary); |
277 | 278 | ||
@@ -444,7 +445,7 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv, | |||
444 | info); | 445 | info); |
445 | if (hash_added < 0) { | 446 | if (hash_added < 0) { |
446 | /* did not work (for some reason) */ | 447 | /* did not work (for some reason) */ |
447 | kref_put(&old_info->refcount, free_info); | 448 | kref_put(&info->refcount, free_info); |
448 | info = NULL; | 449 | info = NULL; |
449 | } | 450 | } |
450 | 451 | ||
@@ -815,7 +816,7 @@ static void send_vis_packets(struct work_struct *work) | |||
815 | container_of(work, struct delayed_work, work); | 816 | container_of(work, struct delayed_work, work); |
816 | struct bat_priv *bat_priv = | 817 | struct bat_priv *bat_priv = |
817 | container_of(delayed_work, struct bat_priv, vis_work); | 818 | container_of(delayed_work, struct bat_priv, vis_work); |
818 | struct vis_info *info, *temp; | 819 | struct vis_info *info; |
819 | 820 | ||
820 | spin_lock_bh(&bat_priv->vis_hash_lock); | 821 | spin_lock_bh(&bat_priv->vis_hash_lock); |
821 | purge_vis_packets(bat_priv); | 822 | purge_vis_packets(bat_priv); |
@@ -825,8 +826,9 @@ static void send_vis_packets(struct work_struct *work) | |||
825 | send_list_add(bat_priv, bat_priv->my_vis_info); | 826 | send_list_add(bat_priv, bat_priv->my_vis_info); |
826 | } | 827 | } |
827 | 828 | ||
828 | list_for_each_entry_safe(info, temp, &bat_priv->vis_send_list, | 829 | while (!list_empty(&bat_priv->vis_send_list)) { |
829 | send_list) { | 830 | info = list_first_entry(&bat_priv->vis_send_list, |
831 | typeof(*info), send_list); | ||
830 | 832 | ||
831 | kref_get(&info->refcount); | 833 | kref_get(&info->refcount); |
832 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 834 | spin_unlock_bh(&bat_priv->vis_hash_lock); |
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 2872393b2939..88485cc74dc3 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c | |||
@@ -328,12 +328,12 @@ static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head, | |||
328 | fdb = kmem_cache_alloc(br_fdb_cache, GFP_ATOMIC); | 328 | fdb = kmem_cache_alloc(br_fdb_cache, GFP_ATOMIC); |
329 | if (fdb) { | 329 | if (fdb) { |
330 | memcpy(fdb->addr.addr, addr, ETH_ALEN); | 330 | memcpy(fdb->addr.addr, addr, ETH_ALEN); |
331 | hlist_add_head_rcu(&fdb->hlist, head); | ||
332 | |||
333 | fdb->dst = source; | 331 | fdb->dst = source; |
334 | fdb->is_local = is_local; | 332 | fdb->is_local = is_local; |
335 | fdb->is_static = is_local; | 333 | fdb->is_static = is_local; |
336 | fdb->ageing_timer = jiffies; | 334 | fdb->ageing_timer = jiffies; |
335 | |||
336 | hlist_add_head_rcu(&fdb->hlist, head); | ||
337 | } | 337 | } |
338 | return fdb; | 338 | return fdb; |
339 | } | 339 | } |
diff --git a/net/core/dev.c b/net/core/dev.c index 24ea2d71e7ea..b6d0bf875a8e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2563,7 +2563,8 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, | |||
2563 | 2563 | ||
2564 | map = rcu_dereference(rxqueue->rps_map); | 2564 | map = rcu_dereference(rxqueue->rps_map); |
2565 | if (map) { | 2565 | if (map) { |
2566 | if (map->len == 1) { | 2566 | if (map->len == 1 && |
2567 | !rcu_dereference_raw(rxqueue->rps_flow_table)) { | ||
2567 | tcpu = map->cpus[0]; | 2568 | tcpu = map->cpus[0]; |
2568 | if (cpu_online(tcpu)) | 2569 | if (cpu_online(tcpu)) |
2569 | cpu = tcpu; | 2570 | cpu = tcpu; |
@@ -3424,6 +3425,8 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) | |||
3424 | __skb_pull(skb, skb_headlen(skb)); | 3425 | __skb_pull(skb, skb_headlen(skb)); |
3425 | skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb)); | 3426 | skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb)); |
3426 | skb->vlan_tci = 0; | 3427 | skb->vlan_tci = 0; |
3428 | skb->dev = napi->dev; | ||
3429 | skb->skb_iif = 0; | ||
3427 | 3430 | ||
3428 | napi->skb = skb; | 3431 | napi->skb = skb; |
3429 | } | 3432 | } |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 750db57f3bb3..2d65c6bb24c1 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -1121,8 +1121,7 @@ static int validate_linkmsg(struct net_device *dev, struct nlattr *tb[]) | |||
1121 | return -EOPNOTSUPP; | 1121 | return -EOPNOTSUPP; |
1122 | 1122 | ||
1123 | if (af_ops->validate_link_af) { | 1123 | if (af_ops->validate_link_af) { |
1124 | err = af_ops->validate_link_af(dev, | 1124 | err = af_ops->validate_link_af(dev, af); |
1125 | tb[IFLA_AF_SPEC]); | ||
1126 | if (err < 0) | 1125 | if (err < 0) |
1127 | return err; | 1126 | return err; |
1128 | } | 1127 | } |
@@ -1672,6 +1671,9 @@ replay: | |||
1672 | snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind); | 1671 | snprintf(ifname, IFNAMSIZ, "%s%%d", ops->kind); |
1673 | 1672 | ||
1674 | dest_net = rtnl_link_get_net(net, tb); | 1673 | dest_net = rtnl_link_get_net(net, tb); |
1674 | if (IS_ERR(dest_net)) | ||
1675 | return PTR_ERR(dest_net); | ||
1676 | |||
1675 | dev = rtnl_create_link(net, dest_net, ifname, ops, tb); | 1677 | dev = rtnl_create_link(net, dest_net, ifname, ops, tb); |
1676 | 1678 | ||
1677 | if (IS_ERR(dev)) | 1679 | if (IS_ERR(dev)) |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 7cd1bc86d591..d883dcc78b6b 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -210,6 +210,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, | |||
210 | shinfo = skb_shinfo(skb); | 210 | shinfo = skb_shinfo(skb); |
211 | memset(shinfo, 0, offsetof(struct skb_shared_info, dataref)); | 211 | memset(shinfo, 0, offsetof(struct skb_shared_info, dataref)); |
212 | atomic_set(&shinfo->dataref, 1); | 212 | atomic_set(&shinfo->dataref, 1); |
213 | kmemcheck_annotate_variable(shinfo->destructor_arg); | ||
213 | 214 | ||
214 | if (fclone) { | 215 | if (fclone) { |
215 | struct sk_buff *child = skb + 1; | 216 | struct sk_buff *child = skb + 1; |
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 15dcc1a586b4..0c2826337919 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -265,13 +265,13 @@ static void ec_tx_done(struct sk_buff *skb, int result) | |||
265 | static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | 265 | static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, |
266 | struct msghdr *msg, size_t len) | 266 | struct msghdr *msg, size_t len) |
267 | { | 267 | { |
268 | struct sock *sk = sock->sk; | ||
269 | struct sockaddr_ec *saddr=(struct sockaddr_ec *)msg->msg_name; | 268 | struct sockaddr_ec *saddr=(struct sockaddr_ec *)msg->msg_name; |
270 | struct net_device *dev; | 269 | struct net_device *dev; |
271 | struct ec_addr addr; | 270 | struct ec_addr addr; |
272 | int err; | 271 | int err; |
273 | unsigned char port, cb; | 272 | unsigned char port, cb; |
274 | #if defined(CONFIG_ECONET_AUNUDP) || defined(CONFIG_ECONET_NATIVE) | 273 | #if defined(CONFIG_ECONET_AUNUDP) || defined(CONFIG_ECONET_NATIVE) |
274 | struct sock *sk = sock->sk; | ||
275 | struct sk_buff *skb; | 275 | struct sk_buff *skb; |
276 | struct ec_cb *eb; | 276 | struct ec_cb *eb; |
277 | #endif | 277 | #endif |
@@ -488,10 +488,10 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
488 | 488 | ||
489 | error_free_buf: | 489 | error_free_buf: |
490 | vfree(userbuf); | 490 | vfree(userbuf); |
491 | error: | ||
491 | #else | 492 | #else |
492 | err = -EPROTOTYPE; | 493 | err = -EPROTOTYPE; |
493 | #endif | 494 | #endif |
494 | error: | ||
495 | mutex_unlock(&econet_mutex); | 495 | mutex_unlock(&econet_mutex); |
496 | 496 | ||
497 | return err; | 497 | return err; |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index f2b61107df6c..45b89d7bda5a 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -880,6 +880,19 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
880 | } | 880 | } |
881 | EXPORT_SYMBOL(inet_ioctl); | 881 | EXPORT_SYMBOL(inet_ioctl); |
882 | 882 | ||
883 | #ifdef CONFIG_COMPAT | ||
884 | int inet_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | ||
885 | { | ||
886 | struct sock *sk = sock->sk; | ||
887 | int err = -ENOIOCTLCMD; | ||
888 | |||
889 | if (sk->sk_prot->compat_ioctl) | ||
890 | err = sk->sk_prot->compat_ioctl(sk, cmd, arg); | ||
891 | |||
892 | return err; | ||
893 | } | ||
894 | #endif | ||
895 | |||
883 | const struct proto_ops inet_stream_ops = { | 896 | const struct proto_ops inet_stream_ops = { |
884 | .family = PF_INET, | 897 | .family = PF_INET, |
885 | .owner = THIS_MODULE, | 898 | .owner = THIS_MODULE, |
@@ -903,6 +916,7 @@ const struct proto_ops inet_stream_ops = { | |||
903 | #ifdef CONFIG_COMPAT | 916 | #ifdef CONFIG_COMPAT |
904 | .compat_setsockopt = compat_sock_common_setsockopt, | 917 | .compat_setsockopt = compat_sock_common_setsockopt, |
905 | .compat_getsockopt = compat_sock_common_getsockopt, | 918 | .compat_getsockopt = compat_sock_common_getsockopt, |
919 | .compat_ioctl = inet_compat_ioctl, | ||
906 | #endif | 920 | #endif |
907 | }; | 921 | }; |
908 | EXPORT_SYMBOL(inet_stream_ops); | 922 | EXPORT_SYMBOL(inet_stream_ops); |
@@ -929,6 +943,7 @@ const struct proto_ops inet_dgram_ops = { | |||
929 | #ifdef CONFIG_COMPAT | 943 | #ifdef CONFIG_COMPAT |
930 | .compat_setsockopt = compat_sock_common_setsockopt, | 944 | .compat_setsockopt = compat_sock_common_setsockopt, |
931 | .compat_getsockopt = compat_sock_common_getsockopt, | 945 | .compat_getsockopt = compat_sock_common_getsockopt, |
946 | .compat_ioctl = inet_compat_ioctl, | ||
932 | #endif | 947 | #endif |
933 | }; | 948 | }; |
934 | EXPORT_SYMBOL(inet_dgram_ops); | 949 | EXPORT_SYMBOL(inet_dgram_ops); |
@@ -959,6 +974,7 @@ static const struct proto_ops inet_sockraw_ops = { | |||
959 | #ifdef CONFIG_COMPAT | 974 | #ifdef CONFIG_COMPAT |
960 | .compat_setsockopt = compat_sock_common_setsockopt, | 975 | .compat_setsockopt = compat_sock_common_setsockopt, |
961 | .compat_getsockopt = compat_sock_common_getsockopt, | 976 | .compat_getsockopt = compat_sock_common_getsockopt, |
977 | .compat_ioctl = inet_compat_ioctl, | ||
962 | #endif | 978 | #endif |
963 | }; | 979 | }; |
964 | 980 | ||
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 3f3a9afd73e0..8b65a12654e7 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/notifier.h> | 60 | #include <linux/notifier.h> |
61 | #include <linux/if_arp.h> | 61 | #include <linux/if_arp.h> |
62 | #include <linux/netfilter_ipv4.h> | 62 | #include <linux/netfilter_ipv4.h> |
63 | #include <linux/compat.h> | ||
63 | #include <net/ipip.h> | 64 | #include <net/ipip.h> |
64 | #include <net/checksum.h> | 65 | #include <net/checksum.h> |
65 | #include <net/netlink.h> | 66 | #include <net/netlink.h> |
@@ -1434,6 +1435,81 @@ int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg) | |||
1434 | } | 1435 | } |
1435 | } | 1436 | } |
1436 | 1437 | ||
1438 | #ifdef CONFIG_COMPAT | ||
1439 | struct compat_sioc_sg_req { | ||
1440 | struct in_addr src; | ||
1441 | struct in_addr grp; | ||
1442 | compat_ulong_t pktcnt; | ||
1443 | compat_ulong_t bytecnt; | ||
1444 | compat_ulong_t wrong_if; | ||
1445 | }; | ||
1446 | |||
1447 | struct compat_sioc_vif_req { | ||
1448 | vifi_t vifi; /* Which iface */ | ||
1449 | compat_ulong_t icount; | ||
1450 | compat_ulong_t ocount; | ||
1451 | compat_ulong_t ibytes; | ||
1452 | compat_ulong_t obytes; | ||
1453 | }; | ||
1454 | |||
1455 | int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) | ||
1456 | { | ||
1457 | struct compat_sioc_sg_req sr; | ||
1458 | struct compat_sioc_vif_req vr; | ||
1459 | struct vif_device *vif; | ||
1460 | struct mfc_cache *c; | ||
1461 | struct net *net = sock_net(sk); | ||
1462 | struct mr_table *mrt; | ||
1463 | |||
1464 | mrt = ipmr_get_table(net, raw_sk(sk)->ipmr_table ? : RT_TABLE_DEFAULT); | ||
1465 | if (mrt == NULL) | ||
1466 | return -ENOENT; | ||
1467 | |||
1468 | switch (cmd) { | ||
1469 | case SIOCGETVIFCNT: | ||
1470 | if (copy_from_user(&vr, arg, sizeof(vr))) | ||
1471 | return -EFAULT; | ||
1472 | if (vr.vifi >= mrt->maxvif) | ||
1473 | return -EINVAL; | ||
1474 | read_lock(&mrt_lock); | ||
1475 | vif = &mrt->vif_table[vr.vifi]; | ||
1476 | if (VIF_EXISTS(mrt, vr.vifi)) { | ||
1477 | vr.icount = vif->pkt_in; | ||
1478 | vr.ocount = vif->pkt_out; | ||
1479 | vr.ibytes = vif->bytes_in; | ||
1480 | vr.obytes = vif->bytes_out; | ||
1481 | read_unlock(&mrt_lock); | ||
1482 | |||
1483 | if (copy_to_user(arg, &vr, sizeof(vr))) | ||
1484 | return -EFAULT; | ||
1485 | return 0; | ||
1486 | } | ||
1487 | read_unlock(&mrt_lock); | ||
1488 | return -EADDRNOTAVAIL; | ||
1489 | case SIOCGETSGCNT: | ||
1490 | if (copy_from_user(&sr, arg, sizeof(sr))) | ||
1491 | return -EFAULT; | ||
1492 | |||
1493 | rcu_read_lock(); | ||
1494 | c = ipmr_cache_find(mrt, sr.src.s_addr, sr.grp.s_addr); | ||
1495 | if (c) { | ||
1496 | sr.pktcnt = c->mfc_un.res.pkt; | ||
1497 | sr.bytecnt = c->mfc_un.res.bytes; | ||
1498 | sr.wrong_if = c->mfc_un.res.wrong_if; | ||
1499 | rcu_read_unlock(); | ||
1500 | |||
1501 | if (copy_to_user(arg, &sr, sizeof(sr))) | ||
1502 | return -EFAULT; | ||
1503 | return 0; | ||
1504 | } | ||
1505 | rcu_read_unlock(); | ||
1506 | return -EADDRNOTAVAIL; | ||
1507 | default: | ||
1508 | return -ENOIOCTLCMD; | ||
1509 | } | ||
1510 | } | ||
1511 | #endif | ||
1512 | |||
1437 | 1513 | ||
1438 | static int ipmr_device_event(struct notifier_block *this, unsigned long event, void *ptr) | 1514 | static int ipmr_device_event(struct notifier_block *this, unsigned long event, void *ptr) |
1439 | { | 1515 | { |
diff --git a/net/ipv4/netfilter/arpt_mangle.c b/net/ipv4/netfilter/arpt_mangle.c index b8ddcc480ed9..a5e52a9f0a12 100644 --- a/net/ipv4/netfilter/arpt_mangle.c +++ b/net/ipv4/netfilter/arpt_mangle.c | |||
@@ -60,12 +60,12 @@ static int checkentry(const struct xt_tgchk_param *par) | |||
60 | 60 | ||
61 | if (mangle->flags & ~ARPT_MANGLE_MASK || | 61 | if (mangle->flags & ~ARPT_MANGLE_MASK || |
62 | !(mangle->flags & ARPT_MANGLE_MASK)) | 62 | !(mangle->flags & ARPT_MANGLE_MASK)) |
63 | return false; | 63 | return -EINVAL; |
64 | 64 | ||
65 | if (mangle->target != NF_DROP && mangle->target != NF_ACCEPT && | 65 | if (mangle->target != NF_DROP && mangle->target != NF_ACCEPT && |
66 | mangle->target != XT_CONTINUE) | 66 | mangle->target != XT_CONTINUE) |
67 | return false; | 67 | return -EINVAL; |
68 | return true; | 68 | return 0; |
69 | } | 69 | } |
70 | 70 | ||
71 | static struct xt_target arpt_mangle_reg __read_mostly = { | 71 | static struct xt_target arpt_mangle_reg __read_mostly = { |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index a3d5ab786e81..6390ba299b3d 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -76,6 +76,7 @@ | |||
76 | #include <linux/seq_file.h> | 76 | #include <linux/seq_file.h> |
77 | #include <linux/netfilter.h> | 77 | #include <linux/netfilter.h> |
78 | #include <linux/netfilter_ipv4.h> | 78 | #include <linux/netfilter_ipv4.h> |
79 | #include <linux/compat.h> | ||
79 | 80 | ||
80 | static struct raw_hashinfo raw_v4_hashinfo = { | 81 | static struct raw_hashinfo raw_v4_hashinfo = { |
81 | .lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock), | 82 | .lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock), |
@@ -838,6 +839,23 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
838 | } | 839 | } |
839 | } | 840 | } |
840 | 841 | ||
842 | #ifdef CONFIG_COMPAT | ||
843 | static int compat_raw_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg) | ||
844 | { | ||
845 | switch (cmd) { | ||
846 | case SIOCOUTQ: | ||
847 | case SIOCINQ: | ||
848 | return -ENOIOCTLCMD; | ||
849 | default: | ||
850 | #ifdef CONFIG_IP_MROUTE | ||
851 | return ipmr_compat_ioctl(sk, cmd, compat_ptr(arg)); | ||
852 | #else | ||
853 | return -ENOIOCTLCMD; | ||
854 | #endif | ||
855 | } | ||
856 | } | ||
857 | #endif | ||
858 | |||
841 | struct proto raw_prot = { | 859 | struct proto raw_prot = { |
842 | .name = "RAW", | 860 | .name = "RAW", |
843 | .owner = THIS_MODULE, | 861 | .owner = THIS_MODULE, |
@@ -860,6 +878,7 @@ struct proto raw_prot = { | |||
860 | #ifdef CONFIG_COMPAT | 878 | #ifdef CONFIG_COMPAT |
861 | .compat_setsockopt = compat_raw_setsockopt, | 879 | .compat_setsockopt = compat_raw_setsockopt, |
862 | .compat_getsockopt = compat_raw_getsockopt, | 880 | .compat_getsockopt = compat_raw_getsockopt, |
881 | .compat_ioctl = compat_raw_ioctl, | ||
863 | #endif | 882 | #endif |
864 | }; | 883 | }; |
865 | 884 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 351dc4e85242..788a3e74834e 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2707,6 +2707,11 @@ static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 coo | |||
2707 | return NULL; | 2707 | return NULL; |
2708 | } | 2708 | } |
2709 | 2709 | ||
2710 | static unsigned int ipv4_blackhole_default_mtu(const struct dst_entry *dst) | ||
2711 | { | ||
2712 | return 0; | ||
2713 | } | ||
2714 | |||
2710 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 2715 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
2711 | { | 2716 | { |
2712 | } | 2717 | } |
@@ -2716,6 +2721,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = { | |||
2716 | .protocol = cpu_to_be16(ETH_P_IP), | 2721 | .protocol = cpu_to_be16(ETH_P_IP), |
2717 | .destroy = ipv4_dst_destroy, | 2722 | .destroy = ipv4_dst_destroy, |
2718 | .check = ipv4_blackhole_dst_check, | 2723 | .check = ipv4_blackhole_dst_check, |
2724 | .default_mtu = ipv4_blackhole_default_mtu, | ||
2719 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, | 2725 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, |
2720 | }; | 2726 | }; |
2721 | 2727 | ||
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 9fab274019c0..0e1d53bcf1e0 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/compat.h> | ||
37 | #include <net/protocol.h> | 38 | #include <net/protocol.h> |
38 | #include <linux/skbuff.h> | 39 | #include <linux/skbuff.h> |
39 | #include <net/sock.h> | 40 | #include <net/sock.h> |
@@ -1804,6 +1805,80 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg) | |||
1804 | } | 1805 | } |
1805 | } | 1806 | } |
1806 | 1807 | ||
1808 | #ifdef CONFIG_COMPAT | ||
1809 | struct compat_sioc_sg_req6 { | ||
1810 | struct sockaddr_in6 src; | ||
1811 | struct sockaddr_in6 grp; | ||
1812 | compat_ulong_t pktcnt; | ||
1813 | compat_ulong_t bytecnt; | ||
1814 | compat_ulong_t wrong_if; | ||
1815 | }; | ||
1816 | |||
1817 | struct compat_sioc_mif_req6 { | ||
1818 | mifi_t mifi; | ||
1819 | compat_ulong_t icount; | ||
1820 | compat_ulong_t ocount; | ||
1821 | compat_ulong_t ibytes; | ||
1822 | compat_ulong_t obytes; | ||
1823 | }; | ||
1824 | |||
1825 | int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) | ||
1826 | { | ||
1827 | struct compat_sioc_sg_req6 sr; | ||
1828 | struct compat_sioc_mif_req6 vr; | ||
1829 | struct mif_device *vif; | ||
1830 | struct mfc6_cache *c; | ||
1831 | struct net *net = sock_net(sk); | ||
1832 | struct mr6_table *mrt; | ||
1833 | |||
1834 | mrt = ip6mr_get_table(net, raw6_sk(sk)->ip6mr_table ? : RT6_TABLE_DFLT); | ||
1835 | if (mrt == NULL) | ||
1836 | return -ENOENT; | ||
1837 | |||
1838 | switch (cmd) { | ||
1839 | case SIOCGETMIFCNT_IN6: | ||
1840 | if (copy_from_user(&vr, arg, sizeof(vr))) | ||
1841 | return -EFAULT; | ||
1842 | if (vr.mifi >= mrt->maxvif) | ||
1843 | return -EINVAL; | ||
1844 | read_lock(&mrt_lock); | ||
1845 | vif = &mrt->vif6_table[vr.mifi]; | ||
1846 | if (MIF_EXISTS(mrt, vr.mifi)) { | ||
1847 | vr.icount = vif->pkt_in; | ||
1848 | vr.ocount = vif->pkt_out; | ||
1849 | vr.ibytes = vif->bytes_in; | ||
1850 | vr.obytes = vif->bytes_out; | ||
1851 | read_unlock(&mrt_lock); | ||
1852 | |||
1853 | if (copy_to_user(arg, &vr, sizeof(vr))) | ||
1854 | return -EFAULT; | ||
1855 | return 0; | ||
1856 | } | ||
1857 | read_unlock(&mrt_lock); | ||
1858 | return -EADDRNOTAVAIL; | ||
1859 | case SIOCGETSGCNT_IN6: | ||
1860 | if (copy_from_user(&sr, arg, sizeof(sr))) | ||
1861 | return -EFAULT; | ||
1862 | |||
1863 | read_lock(&mrt_lock); | ||
1864 | c = ip6mr_cache_find(mrt, &sr.src.sin6_addr, &sr.grp.sin6_addr); | ||
1865 | if (c) { | ||
1866 | sr.pktcnt = c->mfc_un.res.pkt; | ||
1867 | sr.bytecnt = c->mfc_un.res.bytes; | ||
1868 | sr.wrong_if = c->mfc_un.res.wrong_if; | ||
1869 | read_unlock(&mrt_lock); | ||
1870 | |||
1871 | if (copy_to_user(arg, &sr, sizeof(sr))) | ||
1872 | return -EFAULT; | ||
1873 | return 0; | ||
1874 | } | ||
1875 | read_unlock(&mrt_lock); | ||
1876 | return -EADDRNOTAVAIL; | ||
1877 | default: | ||
1878 | return -ENOIOCTLCMD; | ||
1879 | } | ||
1880 | } | ||
1881 | #endif | ||
1807 | 1882 | ||
1808 | static inline int ip6mr_forward2_finish(struct sk_buff *skb) | 1883 | static inline int ip6mr_forward2_finish(struct sk_buff *skb) |
1809 | { | 1884 | { |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 86c39526ba5e..c5b0915d106b 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/netfilter.h> | 31 | #include <linux/netfilter.h> |
32 | #include <linux/netfilter_ipv6.h> | 32 | #include <linux/netfilter_ipv6.h> |
33 | #include <linux/skbuff.h> | 33 | #include <linux/skbuff.h> |
34 | #include <linux/compat.h> | ||
34 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
35 | #include <asm/ioctls.h> | 36 | #include <asm/ioctls.h> |
36 | 37 | ||
@@ -1157,6 +1158,23 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
1157 | } | 1158 | } |
1158 | } | 1159 | } |
1159 | 1160 | ||
1161 | #ifdef CONFIG_COMPAT | ||
1162 | static int compat_rawv6_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg) | ||
1163 | { | ||
1164 | switch (cmd) { | ||
1165 | case SIOCOUTQ: | ||
1166 | case SIOCINQ: | ||
1167 | return -ENOIOCTLCMD; | ||
1168 | default: | ||
1169 | #ifdef CONFIG_IPV6_MROUTE | ||
1170 | return ip6mr_compat_ioctl(sk, cmd, compat_ptr(arg)); | ||
1171 | #else | ||
1172 | return -ENOIOCTLCMD; | ||
1173 | #endif | ||
1174 | } | ||
1175 | } | ||
1176 | #endif | ||
1177 | |||
1160 | static void rawv6_close(struct sock *sk, long timeout) | 1178 | static void rawv6_close(struct sock *sk, long timeout) |
1161 | { | 1179 | { |
1162 | if (inet_sk(sk)->inet_num == IPPROTO_RAW) | 1180 | if (inet_sk(sk)->inet_num == IPPROTO_RAW) |
@@ -1215,6 +1233,7 @@ struct proto rawv6_prot = { | |||
1215 | #ifdef CONFIG_COMPAT | 1233 | #ifdef CONFIG_COMPAT |
1216 | .compat_setsockopt = compat_rawv6_setsockopt, | 1234 | .compat_setsockopt = compat_rawv6_setsockopt, |
1217 | .compat_getsockopt = compat_rawv6_getsockopt, | 1235 | .compat_getsockopt = compat_rawv6_getsockopt, |
1236 | .compat_ioctl = compat_rawv6_ioctl, | ||
1218 | #endif | 1237 | #endif |
1219 | }; | 1238 | }; |
1220 | 1239 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 1534508f6c68..1c29f95695de 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -113,6 +113,11 @@ static struct dst_ops ip6_dst_ops_template = { | |||
113 | .local_out = __ip6_local_out, | 113 | .local_out = __ip6_local_out, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | static unsigned int ip6_blackhole_default_mtu(const struct dst_entry *dst) | ||
117 | { | ||
118 | return 0; | ||
119 | } | ||
120 | |||
116 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 121 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
117 | { | 122 | { |
118 | } | 123 | } |
@@ -122,6 +127,7 @@ static struct dst_ops ip6_dst_blackhole_ops = { | |||
122 | .protocol = cpu_to_be16(ETH_P_IPV6), | 127 | .protocol = cpu_to_be16(ETH_P_IPV6), |
123 | .destroy = ip6_dst_destroy, | 128 | .destroy = ip6_dst_destroy, |
124 | .check = ip6_dst_check, | 129 | .check = ip6_dst_check, |
130 | .default_mtu = ip6_blackhole_default_mtu, | ||
125 | .update_pmtu = ip6_rt_blackhole_update_pmtu, | 131 | .update_pmtu = ip6_rt_blackhole_update_pmtu, |
126 | }; | 132 | }; |
127 | 133 | ||
@@ -194,7 +200,6 @@ static void ip6_dst_destroy(struct dst_entry *dst) | |||
194 | in6_dev_put(idev); | 200 | in6_dev_put(idev); |
195 | } | 201 | } |
196 | if (peer) { | 202 | if (peer) { |
197 | BUG_ON(!(rt->rt6i_flags & RTF_CACHE)); | ||
198 | rt->rt6i_peer = NULL; | 203 | rt->rt6i_peer = NULL; |
199 | inet_putpeer(peer); | 204 | inet_putpeer(peer); |
200 | } | 205 | } |
@@ -204,9 +209,6 @@ void rt6_bind_peer(struct rt6_info *rt, int create) | |||
204 | { | 209 | { |
205 | struct inet_peer *peer; | 210 | struct inet_peer *peer; |
206 | 211 | ||
207 | if (WARN_ON(!(rt->rt6i_flags & RTF_CACHE))) | ||
208 | return; | ||
209 | |||
210 | peer = inet_getpeer_v6(&rt->rt6i_dst.addr, create); | 212 | peer = inet_getpeer_v6(&rt->rt6i_dst.addr, create); |
211 | if (peer && cmpxchg(&rt->rt6i_peer, NULL, peer) != NULL) | 213 | if (peer && cmpxchg(&rt->rt6i_peer, NULL, peer) != NULL) |
212 | inet_putpeer(peer); | 214 | inet_putpeer(peer); |
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c index fa1d8f4e0051..7cb65ef79f9c 100644 --- a/net/ipv6/sysctl_net_ipv6.c +++ b/net/ipv6/sysctl_net_ipv6.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <net/addrconf.h> | 15 | #include <net/addrconf.h> |
16 | #include <net/inet_frag.h> | 16 | #include <net/inet_frag.h> |
17 | 17 | ||
18 | static struct ctl_table empty[1]; | ||
19 | |||
18 | static ctl_table ipv6_table_template[] = { | 20 | static ctl_table ipv6_table_template[] = { |
19 | { | 21 | { |
20 | .procname = "route", | 22 | .procname = "route", |
@@ -35,6 +37,12 @@ static ctl_table ipv6_table_template[] = { | |||
35 | .mode = 0644, | 37 | .mode = 0644, |
36 | .proc_handler = proc_dointvec | 38 | .proc_handler = proc_dointvec |
37 | }, | 39 | }, |
40 | { | ||
41 | .procname = "neigh", | ||
42 | .maxlen = 0, | ||
43 | .mode = 0555, | ||
44 | .child = empty, | ||
45 | }, | ||
38 | { } | 46 | { } |
39 | }; | 47 | }; |
40 | 48 | ||
@@ -152,7 +160,6 @@ static struct ctl_table_header *ip6_base; | |||
152 | 160 | ||
153 | int ipv6_static_sysctl_register(void) | 161 | int ipv6_static_sysctl_register(void) |
154 | { | 162 | { |
155 | static struct ctl_table empty[1]; | ||
156 | ip6_base = register_sysctl_paths(net_ipv6_ctl_path, empty); | 163 | ip6_base = register_sysctl_paths(net_ipv6_ctl_path, empty); |
157 | if (ip6_base == NULL) | 164 | if (ip6_base == NULL) |
158 | return -ENOMEM; | 165 | return -ENOMEM; |
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c index 5702de35e2bb..63a1b915a7e4 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c | |||
@@ -63,6 +63,9 @@ void nf_ct_deliver_cached_events(struct nf_conn *ct) | |||
63 | * this does not harm and it happens very rarely. */ | 63 | * this does not harm and it happens very rarely. */ |
64 | unsigned long missed = e->missed; | 64 | unsigned long missed = e->missed; |
65 | 65 | ||
66 | if (!((events | missed) & e->ctmask)) | ||
67 | goto out_unlock; | ||
68 | |||
66 | ret = notify->fcn(events | missed, &item); | 69 | ret = notify->fcn(events | missed, &item); |
67 | if (unlikely(ret < 0 || missed)) { | 70 | if (unlikely(ret < 0 || missed)) { |
68 | spin_lock_bh(&ct->lock); | 71 | spin_lock_bh(&ct->lock); |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 93297aaceb2b..eead9db6f899 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -667,6 +667,7 @@ restart: | |||
667 | if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, | 667 | if (ctnetlink_fill_info(skb, NETLINK_CB(cb->skb).pid, |
668 | cb->nlh->nlmsg_seq, | 668 | cb->nlh->nlmsg_seq, |
669 | IPCTNL_MSG_CT_NEW, ct) < 0) { | 669 | IPCTNL_MSG_CT_NEW, ct) < 0) { |
670 | nf_conntrack_get(&ct->ct_general); | ||
670 | cb->args[1] = (unsigned long)ct; | 671 | cb->args[1] = (unsigned long)ct; |
671 | goto out; | 672 | goto out; |
672 | } | 673 | } |
diff --git a/net/netfilter/xt_iprange.c b/net/netfilter/xt_iprange.c index 88f7c3511c72..73c33a42f87f 100644 --- a/net/netfilter/xt_iprange.c +++ b/net/netfilter/xt_iprange.c | |||
@@ -53,15 +53,13 @@ iprange_mt4(const struct sk_buff *skb, struct xt_action_param *par) | |||
53 | } | 53 | } |
54 | 54 | ||
55 | static inline int | 55 | static inline int |
56 | iprange_ipv6_sub(const struct in6_addr *a, const struct in6_addr *b) | 56 | iprange_ipv6_lt(const struct in6_addr *a, const struct in6_addr *b) |
57 | { | 57 | { |
58 | unsigned int i; | 58 | unsigned int i; |
59 | int r; | ||
60 | 59 | ||
61 | for (i = 0; i < 4; ++i) { | 60 | for (i = 0; i < 4; ++i) { |
62 | r = ntohl(a->s6_addr32[i]) - ntohl(b->s6_addr32[i]); | 61 | if (a->s6_addr32[i] != b->s6_addr32[i]) |
63 | if (r != 0) | 62 | return ntohl(a->s6_addr32[i]) < ntohl(b->s6_addr32[i]); |
64 | return r; | ||
65 | } | 63 | } |
66 | 64 | ||
67 | return 0; | 65 | return 0; |
@@ -75,15 +73,15 @@ iprange_mt6(const struct sk_buff *skb, struct xt_action_param *par) | |||
75 | bool m; | 73 | bool m; |
76 | 74 | ||
77 | if (info->flags & IPRANGE_SRC) { | 75 | if (info->flags & IPRANGE_SRC) { |
78 | m = iprange_ipv6_sub(&iph->saddr, &info->src_min.in6) < 0; | 76 | m = iprange_ipv6_lt(&iph->saddr, &info->src_min.in6); |
79 | m |= iprange_ipv6_sub(&iph->saddr, &info->src_max.in6) > 0; | 77 | m |= iprange_ipv6_lt(&info->src_max.in6, &iph->saddr); |
80 | m ^= !!(info->flags & IPRANGE_SRC_INV); | 78 | m ^= !!(info->flags & IPRANGE_SRC_INV); |
81 | if (m) | 79 | if (m) |
82 | return false; | 80 | return false; |
83 | } | 81 | } |
84 | if (info->flags & IPRANGE_DST) { | 82 | if (info->flags & IPRANGE_DST) { |
85 | m = iprange_ipv6_sub(&iph->daddr, &info->dst_min.in6) < 0; | 83 | m = iprange_ipv6_lt(&iph->daddr, &info->dst_min.in6); |
86 | m |= iprange_ipv6_sub(&iph->daddr, &info->dst_max.in6) > 0; | 84 | m |= iprange_ipv6_lt(&info->dst_max.in6, &iph->daddr); |
87 | m ^= !!(info->flags & IPRANGE_DST_INV); | 85 | m ^= !!(info->flags & IPRANGE_DST_INV); |
88 | if (m) | 86 | if (m) |
89 | return false; | 87 | return false; |