diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/netfilter/arpt_mangle.c | 6 | ||||
-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 |
4 files changed, 14 insertions, 12 deletions
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/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; |