diff options
author | David S. Miller <davem@davemloft.net> | 2011-02-04 17:28:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-04 17:28:58 -0500 |
commit | bd4a6974cc9090ef3851e5b0a2071e5383565c7c (patch) | |
tree | e96ef46426d293b730a305b5185ba5412c9172d4 /net/ipv4 | |
parent | 2b7bcebf958c74124220ee8103024def8597b36c (diff) | |
parent | 1e6d93e45b231b3ae87c01902ede2315aacfe976 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/ipmr.c | 32 | ||||
-rw-r--r-- | net/ipv4/netfilter/arpt_mangle.c | 6 | ||||
-rw-r--r-- | net/ipv4/route.c | 6 |
3 files changed, 40 insertions, 4 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 7e41ac0b9260..8b65a12654e7 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1444,9 +1444,19 @@ struct compat_sioc_sg_req { | |||
1444 | compat_ulong_t wrong_if; | 1444 | compat_ulong_t wrong_if; |
1445 | }; | 1445 | }; |
1446 | 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 | |||
1447 | int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) | 1455 | int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) |
1448 | { | 1456 | { |
1449 | struct sioc_sg_req sr; | 1457 | struct compat_sioc_sg_req sr; |
1458 | struct compat_sioc_vif_req vr; | ||
1459 | struct vif_device *vif; | ||
1450 | struct mfc_cache *c; | 1460 | struct mfc_cache *c; |
1451 | struct net *net = sock_net(sk); | 1461 | struct net *net = sock_net(sk); |
1452 | struct mr_table *mrt; | 1462 | struct mr_table *mrt; |
@@ -1456,6 +1466,26 @@ int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) | |||
1456 | return -ENOENT; | 1466 | return -ENOENT; |
1457 | 1467 | ||
1458 | switch (cmd) { | 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; | ||
1459 | case SIOCGETSGCNT: | 1489 | case SIOCGETSGCNT: |
1460 | if (copy_from_user(&sr, arg, sizeof(sr))) | 1490 | if (copy_from_user(&sr, arg, sizeof(sr))) |
1461 | return -EFAULT; | 1491 | return -EFAULT; |
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/route.c b/net/ipv4/route.c index 242a3de83fbb..e4c81652f17d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2773,6 +2773,11 @@ static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 coo | |||
2773 | return NULL; | 2773 | return NULL; |
2774 | } | 2774 | } |
2775 | 2775 | ||
2776 | static unsigned int ipv4_blackhole_default_mtu(const struct dst_entry *dst) | ||
2777 | { | ||
2778 | return 0; | ||
2779 | } | ||
2780 | |||
2776 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 2781 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
2777 | { | 2782 | { |
2778 | } | 2783 | } |
@@ -2782,6 +2787,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = { | |||
2782 | .protocol = cpu_to_be16(ETH_P_IP), | 2787 | .protocol = cpu_to_be16(ETH_P_IP), |
2783 | .destroy = ipv4_dst_destroy, | 2788 | .destroy = ipv4_dst_destroy, |
2784 | .check = ipv4_blackhole_dst_check, | 2789 | .check = ipv4_blackhole_dst_check, |
2790 | .default_mtu = ipv4_blackhole_default_mtu, | ||
2785 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, | 2791 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, |
2786 | }; | 2792 | }; |
2787 | 2793 | ||