* [PATCH 0/5] Netfilter updates for net-next
@ 2012-09-13 11:01 pablo
2012-09-13 18:26 ` David Miller
0 siblings, 1 reply; 10+ messages in thread
From: pablo @ 2012-09-13 11:01 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Pablo Neira Ayuso <pablo@netfilter.org>
Hi David,
The following patchset contains four Netfilter updates, mostly targeting
to fix issues added with IPv6 NAT, and one little IPVS update for net-next:
* Remove unneeded conditional free of skb in nfnetlink_queue, from
Wei Yongjun.
* One semantic path from coccinelle detected the use of list_del +
INIT_LIST_HEAD, instead of list_del_init, again from Wei Yongjun.
* Fix out-of-bound memory access in the NAT address selection, from
Florian Westphal. This was introduced with the IPv6 NAT patches.
* Two fixes for crashes that were introduced in the recently merged
IPv6 NAT support, from myself.
You can pull these changes from:
git://1984.lsi.us.es/nf-next master
Thanks!
Florian Westphal (1):
netfilter: nf_nat: fix out-of-bounds access in address selection
Pablo Neira Ayuso (2):
netfilter: fix crash during boot if NAT has been compiled built-in
netfilter: ctnetlink: fix module auto-load in ctnetlink_parse_nat
Wei Yongjun (2):
netfilter: nfnetlink_queue: remove pointless conditional before kfree_skb()
ipvs: use list_del_init instead of list_del/INIT_LIST_HEAD
net/netfilter/Makefile | 2 +-
net/netfilter/ipvs/ip_vs_ctl.c | 3 +--
net/netfilter/nf_conntrack_netlink.c | 3 ---
net/netfilter/nf_nat_core.c | 2 +-
net/netfilter/nfnetlink_queue_core.c | 3 +--
5 files changed, 4 insertions(+), 9 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/5] Netfilter updates for net-next
2012-09-13 11:01 pablo
@ 2012-09-13 18:26 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2012-09-13 18:26 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
From: pablo@netfilter.org
Date: Thu, 13 Sep 2012 13:01:27 +0200
> The following patchset contains four Netfilter updates, mostly targeting
> to fix issues added with IPv6 NAT, and one little IPVS update for net-next:
>
> * Remove unneeded conditional free of skb in nfnetlink_queue, from
> Wei Yongjun.
>
> * One semantic path from coccinelle detected the use of list_del +
> INIT_LIST_HEAD, instead of list_del_init, again from Wei Yongjun.
>
> * Fix out-of-bound memory access in the NAT address selection, from
> Florian Westphal. This was introduced with the IPv6 NAT patches.
>
> * Two fixes for crashes that were introduced in the recently merged
> IPv6 NAT support, from myself.
>
> You can pull these changes from:
>
> git://1984.lsi.us.es/nf-next master
Also pulled, thanks a lot.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 0/5] Netfilter updates for net-next
@ 2013-04-19 1:23 Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 1/5] netfilter: ipv4: propagate routing errors from ip_route_me_harder() Pablo Neira Ayuso
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-19 1:23 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
Hi David,
The following patchset contains a small batch of Netfilter
updates for your net-next tree, they are:
* Three patches that provide more accurate error reporting to
user-space, instead of -EPERM, in IPv4/IPv6 netfilter re-routing
code and NAT, from Patrick McHardy.
* Update copyright statements in Netfilter filters of
Patrick McHardy, from himself.
* Add Kconfig dependency on the raw/mangle tables to the
rpfilter, from Florian Westphal.
The following changes since commit 6b0ee8c036ecb3ac92e18e6ca0dca7bff88beaf0:
scm: Stop passing struct cred (2013-04-07 18:58:55 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
for you to fetch changes up to d37d696804a83479f240b397670a07ccb53a7417:
netfilter: xt_rpfilter: depend on raw or mangle table (2013-04-19 00:22:55 +0200)
----------------------------------------------------------------
Florian Westphal (1):
netfilter: xt_rpfilter: depend on raw or mangle table
Patrick McHardy (4):
netfilter: ipv4: propagate routing errors from ip_route_me_harder()
netfilter: ipv6: propagate routing errors from ip6_route_me_harder()
netfilter: nat: propagate errors from xfrm_me_harder()
netfilter: add my copyright statements
net/ipv4/netfilter.c | 15 ++++++++-----
net/ipv4/netfilter/Kconfig | 2 +-
net/ipv4/netfilter/arp_tables.c | 1 +
net/ipv4/netfilter/ip_tables.c | 1 +
net/ipv4/netfilter/ipt_ULOG.c | 1 +
net/ipv4/netfilter/iptable_mangle.c | 9 +++++---
net/ipv4/netfilter/iptable_nat.c | 23 +++++++++++++-------
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 1 +
.../netfilter/nf_conntrack_l3proto_ipv4_compat.c | 1 +
net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 1 +
net/ipv4/netfilter/nf_nat_h323.c | 1 +
net/ipv4/netfilter/nf_nat_pptp.c | 2 ++
net/ipv4/netfilter/nf_nat_proto_gre.c | 2 ++
net/ipv4/netfilter/nf_nat_snmp_basic.c | 2 ++
net/ipv6/netfilter.c | 12 +++++++---
net/ipv6/netfilter/Kconfig | 2 +-
net/ipv6/netfilter/ip6_tables.c | 1 +
net/ipv6/netfilter/ip6t_REJECT.c | 2 ++
net/ipv6/netfilter/ip6table_mangle.c | 9 +++++---
net/ipv6/netfilter/ip6table_nat.c | 23 +++++++++++++-------
net/netfilter/core.c | 1 +
net/netfilter/nf_conntrack_amanda.c | 1 +
net/netfilter/nf_conntrack_core.c | 1 +
net/netfilter/nf_conntrack_ecache.c | 8 ++++---
net/netfilter/nf_conntrack_expect.c | 1 +
net/netfilter/nf_conntrack_ftp.c | 1 +
net/netfilter/nf_conntrack_h323_main.c | 1 +
net/netfilter/nf_conntrack_helper.c | 1 +
net/netfilter/nf_conntrack_irc.c | 1 +
net/netfilter/nf_conntrack_pptp.c | 2 ++
net/netfilter/nf_conntrack_proto.c | 1 +
net/netfilter/nf_conntrack_proto_gre.c | 1 +
net/netfilter/nf_conntrack_proto_sctp.c | 3 +++
net/netfilter/nf_conntrack_proto_tcp.c | 2 ++
net/netfilter/nf_conntrack_proto_udp.c | 1 +
net/netfilter/nf_conntrack_standalone.c | 1 +
net/netfilter/nf_conntrack_tftp.c | 2 +-
net/netfilter/nf_nat_amanda.c | 1 +
net/netfilter/nf_nat_core.c | 9 ++++----
net/netfilter/nf_nat_helper.c | 1 +
net/netfilter/nf_queue.c | 5 +++++
net/netfilter/nfnetlink_log.c | 1 +
net/netfilter/x_tables.c | 1 +
net/netfilter/xt_TCPMSS.c | 1 +
net/netfilter/xt_conntrack.c | 1 +
net/netfilter/xt_hashlimit.c | 1 +
net/netfilter/xt_limit.c | 1 +
47 files changed, 122 insertions(+), 40 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/5] netfilter: ipv4: propagate routing errors from ip_route_me_harder()
2013-04-19 1:23 [PATCH 0/5] Netfilter updates for net-next Pablo Neira Ayuso
@ 2013-04-19 1:23 ` Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 2/5] netfilter: ipv6: propagate routing errors from ip6_route_me_harder() Pablo Neira Ayuso
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-19 1:23 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Patrick McHardy <kaber@trash.net>
Propagate routing errors from ip_route_me_harder() when dropping a packet
using NF_DROP_ERR(). This makes userspace get the proper error instead of
EPERM for everything.
Example:
# ip r a unreachable default table 100
# ip ru add fwmark 0x1 lookup 100
# iptables -t mangle -A OUTPUT -d 8.8.8.8 -j MARK --set-mark 0x1
Current behaviour:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted
New behaviour:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv4/netfilter.c | 8 ++++----
net/ipv4/netfilter/iptable_mangle.c | 9 ++++++---
net/ipv4/netfilter/iptable_nat.c | 6 ++++--
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index 4c0cf63..8b201e8 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -40,14 +40,14 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned int addr_type)
fl4.flowi4_flags = flags;
rt = ip_route_output_key(net, &fl4);
if (IS_ERR(rt))
- return -1;
+ return PTR_ERR(rt);
/* Drop old route. */
skb_dst_drop(skb);
skb_dst_set(skb, &rt->dst);
if (skb_dst(skb)->error)
- return -1;
+ return skb_dst(skb)->error;
#ifdef CONFIG_XFRM
if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) &&
@@ -56,7 +56,7 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned int addr_type)
skb_dst_set(skb, NULL);
dst = xfrm_lookup(net, dst, flowi4_to_flowi(&fl4), skb->sk, 0);
if (IS_ERR(dst))
- return -1;
+ return PTR_ERR(dst);;
skb_dst_set(skb, dst);
}
#endif
@@ -66,7 +66,7 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned int addr_type)
if (skb_headroom(skb) < hh_len &&
pskb_expand_head(skb, HH_DATA_ALIGN(hh_len - skb_headroom(skb)),
0, GFP_ATOMIC))
- return -1;
+ return -ENOMEM;
return 0;
}
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c
index 85d88f2..cba5658 100644
--- a/net/ipv4/netfilter/iptable_mangle.c
+++ b/net/ipv4/netfilter/iptable_mangle.c
@@ -44,6 +44,7 @@ ipt_mangle_out(struct sk_buff *skb, const struct net_device *out)
u_int8_t tos;
__be32 saddr, daddr;
u_int32_t mark;
+ int err;
/* root is playing with raw sockets. */
if (skb->len < sizeof(struct iphdr) ||
@@ -66,9 +67,11 @@ ipt_mangle_out(struct sk_buff *skb, const struct net_device *out)
if (iph->saddr != saddr ||
iph->daddr != daddr ||
skb->mark != mark ||
- iph->tos != tos)
- if (ip_route_me_harder(skb, RTN_UNSPEC))
- ret = NF_DROP;
+ iph->tos != tos) {
+ err = ip_route_me_harder(skb, RTN_UNSPEC);
+ if (err < 0)
+ ret = NF_DROP_ERR(err);
+ }
}
return ret;
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c
index eeaff7e..c2937c8 100644
--- a/net/ipv4/netfilter/iptable_nat.c
+++ b/net/ipv4/netfilter/iptable_nat.c
@@ -213,6 +213,7 @@ nf_nat_ipv4_local_fn(unsigned int hooknum,
const struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
unsigned int ret;
+ int err;
/* root is playing with raw sockets. */
if (skb->len < sizeof(struct iphdr) ||
@@ -226,8 +227,9 @@ nf_nat_ipv4_local_fn(unsigned int hooknum,
if (ct->tuplehash[dir].tuple.dst.u3.ip !=
ct->tuplehash[!dir].tuple.src.u3.ip) {
- if (ip_route_me_harder(skb, RTN_UNSPEC))
- ret = NF_DROP;
+ err = ip_route_me_harder(skb, RTN_UNSPEC);
+ if (err < 0)
+ ret = NF_DROP_ERR(err);
}
#ifdef CONFIG_XFRM
else if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) &&
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/5] netfilter: ipv6: propagate routing errors from ip6_route_me_harder()
2013-04-19 1:23 [PATCH 0/5] Netfilter updates for net-next Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 1/5] netfilter: ipv4: propagate routing errors from ip_route_me_harder() Pablo Neira Ayuso
@ 2013-04-19 1:23 ` Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 3/5] netfilter: nat: propagate errors from xfrm_me_harder() Pablo Neira Ayuso
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-19 1:23 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Patrick McHardy <kaber@trash.net>
Propagate routing errors from ip_route_me_harder() when dropping a packet
using NF_DROP_ERR(). This makes userspace get the proper error instead of
EPERM for everything.
# ip -6 r a unreachable default table 100
# ip -6 ru add fwmark 0x1 lookup 100
# ip6tables -t mangle -A OUTPUT -d 2001:4860:4860::8888 -j MARK --set-mark 0x1
Old behaviour:
PING 2001:4860:4860::8888(2001:4860:4860::8888) 56 data bytes
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted
ping: sendmsg: Operation not permitted
New behaviour:
PING 2001:4860:4860::8888(2001:4860:4860::8888) 56 data bytes
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
ping: sendmsg: Network is unreachable
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv6/netfilter.c | 6 +++---
net/ipv6/netfilter/ip6table_mangle.c | 9 ++++++---
net/ipv6/netfilter/ip6table_nat.c | 6 ++++--
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 429089c..fc5fbd7 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -29,7 +29,7 @@ int ip6_route_me_harder(struct sk_buff *skb)
IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n");
dst_release(dst);
- return -EINVAL;
+ return dst->error;
}
/* Drop old route. */
@@ -43,7 +43,7 @@ int ip6_route_me_harder(struct sk_buff *skb)
skb_dst_set(skb, NULL);
dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), skb->sk, 0);
if (IS_ERR(dst))
- return -1;
+ return PTR_ERR(dst);
skb_dst_set(skb, dst);
}
#endif
@@ -53,7 +53,7 @@ int ip6_route_me_harder(struct sk_buff *skb)
if (skb_headroom(skb) < hh_len &&
pskb_expand_head(skb, HH_DATA_ALIGN(hh_len - skb_headroom(skb)),
0, GFP_ATOMIC))
- return -1;
+ return -ENOMEM;
return 0;
}
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
index 6134a1e..e075399 100644
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
@@ -38,7 +38,7 @@ ip6t_mangle_out(struct sk_buff *skb, const struct net_device *out)
struct in6_addr saddr, daddr;
u_int8_t hop_limit;
u_int32_t flowlabel, mark;
-
+ int err;
#if 0
/* root is playing with raw sockets. */
if (skb->len < sizeof(struct iphdr) ||
@@ -65,8 +65,11 @@ ip6t_mangle_out(struct sk_buff *skb, const struct net_device *out)
!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &daddr) ||
skb->mark != mark ||
ipv6_hdr(skb)->hop_limit != hop_limit ||
- flowlabel != *((u_int32_t *)ipv6_hdr(skb))))
- return ip6_route_me_harder(skb) == 0 ? ret : NF_DROP;
+ flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) {
+ err = ip6_route_me_harder(skb);
+ if (err < 0)
+ ret = NF_DROP_ERR(err);
+ }
return ret;
}
diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c
index e0e788d..97e2edd 100644
--- a/net/ipv6/netfilter/ip6table_nat.c
+++ b/net/ipv6/netfilter/ip6table_nat.c
@@ -215,6 +215,7 @@ nf_nat_ipv6_local_fn(unsigned int hooknum,
const struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
unsigned int ret;
+ int err;
/* root is playing with raw sockets. */
if (skb->len < sizeof(struct ipv6hdr))
@@ -227,8 +228,9 @@ nf_nat_ipv6_local_fn(unsigned int hooknum,
if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.dst.u3,
&ct->tuplehash[!dir].tuple.src.u3)) {
- if (ip6_route_me_harder(skb))
- ret = NF_DROP;
+ err = ip6_route_me_harder(skb);
+ if (err < 0)
+ ret = NF_DROP_ERR(err);
}
#ifdef CONFIG_XFRM
else if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/5] netfilter: nat: propagate errors from xfrm_me_harder()
2013-04-19 1:23 [PATCH 0/5] Netfilter updates for net-next Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 1/5] netfilter: ipv4: propagate routing errors from ip_route_me_harder() Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 2/5] netfilter: ipv6: propagate routing errors from ip6_route_me_harder() Pablo Neira Ayuso
@ 2013-04-19 1:23 ` Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 5/5] netfilter: xt_rpfilter: depend on raw or mangle table Pablo Neira Ayuso
2013-04-19 21:56 ` [PATCH 0/5] Netfilter updates for net-next David Miller
4 siblings, 0 replies; 10+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-19 1:23 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Patrick McHardy <kaber@trash.net>
Propagate errors from ip_xfrm_me_harder() instead of returning EPERM in
all cases.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv4/netfilter/iptable_nat.c | 17 +++++++++++------
net/ipv6/netfilter/ip6table_nat.c | 17 +++++++++++------
net/netfilter/nf_nat_core.c | 9 +++++----
3 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c
index c2937c8..6383273 100644
--- a/net/ipv4/netfilter/iptable_nat.c
+++ b/net/ipv4/netfilter/iptable_nat.c
@@ -176,6 +176,7 @@ nf_nat_ipv4_out(unsigned int hooknum,
#ifdef CONFIG_XFRM
const struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
+ int err;
#endif
unsigned int ret;
@@ -195,9 +196,11 @@ nf_nat_ipv4_out(unsigned int hooknum,
ct->tuplehash[!dir].tuple.dst.u3.ip) ||
(ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP &&
ct->tuplehash[dir].tuple.src.u.all !=
- ct->tuplehash[!dir].tuple.dst.u.all))
- if (nf_xfrm_me_harder(skb, AF_INET) < 0)
- ret = NF_DROP;
+ ct->tuplehash[!dir].tuple.dst.u.all)) {
+ err = nf_xfrm_me_harder(skb, AF_INET);
+ if (err < 0)
+ ret = NF_DROP_ERR(err);
+ }
}
#endif
return ret;
@@ -235,9 +238,11 @@ nf_nat_ipv4_local_fn(unsigned int hooknum,
else if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) &&
ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP &&
ct->tuplehash[dir].tuple.dst.u.all !=
- ct->tuplehash[!dir].tuple.src.u.all)
- if (nf_xfrm_me_harder(skb, AF_INET) < 0)
- ret = NF_DROP;
+ ct->tuplehash[!dir].tuple.src.u.all) {
+ err = nf_xfrm_me_harder(skb, AF_INET);
+ if (err < 0)
+ ret = NF_DROP_ERR(err);
+ }
#endif
}
return ret;
diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c
index 97e2edd..6383f90 100644
--- a/net/ipv6/netfilter/ip6table_nat.c
+++ b/net/ipv6/netfilter/ip6table_nat.c
@@ -179,6 +179,7 @@ nf_nat_ipv6_out(unsigned int hooknum,
#ifdef CONFIG_XFRM
const struct nf_conn *ct;
enum ip_conntrack_info ctinfo;
+ int err;
#endif
unsigned int ret;
@@ -197,9 +198,11 @@ nf_nat_ipv6_out(unsigned int hooknum,
&ct->tuplehash[!dir].tuple.dst.u3) ||
(ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 &&
ct->tuplehash[dir].tuple.src.u.all !=
- ct->tuplehash[!dir].tuple.dst.u.all))
- if (nf_xfrm_me_harder(skb, AF_INET6) < 0)
- ret = NF_DROP;
+ ct->tuplehash[!dir].tuple.dst.u.all)) {
+ err = nf_xfrm_me_harder(skb, AF_INET6);
+ if (err < 0)
+ ret = NF_DROP_ERR(err);
+ }
}
#endif
return ret;
@@ -236,9 +239,11 @@ nf_nat_ipv6_local_fn(unsigned int hooknum,
else if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 &&
ct->tuplehash[dir].tuple.dst.u.all !=
- ct->tuplehash[!dir].tuple.src.u.all)
- if (nf_xfrm_me_harder(skb, AF_INET6))
- ret = NF_DROP;
+ ct->tuplehash[!dir].tuple.src.u.all) {
+ err = nf_xfrm_me_harder(skb, AF_INET6);
+ if (err < 0)
+ ret = NF_DROP_ERR(err);
+ }
#endif
}
return ret;
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index 8d5769c..346f871 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -87,9 +87,10 @@ int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family)
struct flowi fl;
unsigned int hh_len;
struct dst_entry *dst;
+ int err;
- if (xfrm_decode_session(skb, &fl, family) < 0)
- return -1;
+ err = xfrm_decode_session(skb, &fl, family);
+ return err;
dst = skb_dst(skb);
if (dst->xfrm)
@@ -98,7 +99,7 @@ int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family)
dst = xfrm_lookup(dev_net(dst->dev), dst, &fl, skb->sk, 0);
if (IS_ERR(dst))
- return -1;
+ return PTR_ERR(dst);
skb_dst_drop(skb);
skb_dst_set(skb, dst);
@@ -107,7 +108,7 @@ int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family)
hh_len = skb_dst(skb)->dev->hard_header_len;
if (skb_headroom(skb) < hh_len &&
pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC))
- return -1;
+ return -ENOMEM;
return 0;
}
EXPORT_SYMBOL(nf_xfrm_me_harder);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/5] netfilter: xt_rpfilter: depend on raw or mangle table
2013-04-19 1:23 [PATCH 0/5] Netfilter updates for net-next Pablo Neira Ayuso
` (2 preceding siblings ...)
2013-04-19 1:23 ` [PATCH 3/5] netfilter: nat: propagate errors from xfrm_me_harder() Pablo Neira Ayuso
@ 2013-04-19 1:23 ` Pablo Neira Ayuso
2013-04-19 21:56 ` [PATCH 0/5] Netfilter updates for net-next David Miller
4 siblings, 0 replies; 10+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-19 1:23 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
From: Florian Westphal <fw@strlen.de>
rpfilter is only valid in raw/mangle PREROUTING, i.e.
RPFILTER=y|m is useless without raw or mangle table support.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv4/netfilter/Kconfig | 2 +-
net/ipv6/netfilter/Kconfig | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 0d755c5..e7916c1 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -71,7 +71,7 @@ config IP_NF_MATCH_ECN
config IP_NF_MATCH_RPFILTER
tristate '"rpfilter" reverse path filter match support'
- depends on NETFILTER_ADVANCED
+ depends on NETFILTER_ADVANCED && (IP_NF_MANGLE || IP_NF_RAW)
---help---
This option allows you to match packets whose replies would
go out via the interface the packet came in.
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig
index c72532a..4433ab40 100644
--- a/net/ipv6/netfilter/Kconfig
+++ b/net/ipv6/netfilter/Kconfig
@@ -105,7 +105,7 @@ config IP6_NF_MATCH_MH
config IP6_NF_MATCH_RPFILTER
tristate '"rpfilter" reverse path filter match support'
- depends on NETFILTER_ADVANCED
+ depends on NETFILTER_ADVANCED && (IP6_NF_MANGLE || IP6_NF_RAW)
---help---
This option allows you to match packets whose replies would
go out via the interface the packet came in.
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/5] Netfilter updates for net-next
2013-04-19 1:23 [PATCH 0/5] Netfilter updates for net-next Pablo Neira Ayuso
` (3 preceding siblings ...)
2013-04-19 1:23 ` [PATCH 5/5] netfilter: xt_rpfilter: depend on raw or mangle table Pablo Neira Ayuso
@ 2013-04-19 21:56 ` David Miller
4 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2013-04-19 21:56 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Fri, 19 Apr 2013 03:23:52 +0200
> The following patchset contains a small batch of Netfilter
> updates for your net-next tree, they are:
>
> * Three patches that provide more accurate error reporting to
> user-space, instead of -EPERM, in IPv4/IPv6 netfilter re-routing
> code and NAT, from Patrick McHardy.
>
> * Update copyright statements in Netfilter filters of
> Patrick McHardy, from himself.
>
> * Add Kconfig dependency on the raw/mangle tables to the
> rpfilter, from Florian Westphal.
...
> git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
Pulled, thanks Pablo.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 0/5] Netfilter updates for net-next
@ 2015-03-02 11:43 Pablo Neira Ayuso
2015-03-02 19:55 ` David Miller
0 siblings, 1 reply; 10+ messages in thread
From: Pablo Neira Ayuso @ 2015-03-02 11:43 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev
Hi David,
A small batch with accumulated updates in nf-next, mostly IPVS updates,
they are:
1) Add 64-bits stats counters to IPVS, from Julian Anastasov.
2) Move NETFILTER_XT_MATCH_ADDRTYPE out of NETFILTER_ADVANCED as docker
seem to require this, from Anton Blanchard.
3) Use boolean instead of numeric value in set_match_v*(), from
coccinelle via Fengguang Wu.
4) Allows rescheduling of new connections in IPVS when port reuse is
detected, from Marcelo Ricardo Leitner.
5) Add missing bits to support arptables extensions from nft_compat,
from Arturo Borrero.
Patrick is preparing a large batch to enhance the set infrastructure,
named expressions among other things, that should follow up soon after
this batch.
You can pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git
Thanks!
----------------------------------------------------------------
The following changes since commit 4c1017aa80c95a74703139bb95c4ce0d130efe4d:
netfilter: nft_lookup: add missing attribute validation for NFTA_LOOKUP_SET_ID (2015-01-30 19:08:20 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
for you to fetch changes up to 5f15893943bfdc804e8703c5aa2c8dd8bf7ddf3f:
netfilter: nft_compat: add support for arptables extensions (2015-03-02 12:28:13 +0100)
----------------------------------------------------------------
Anton Blanchard (1):
netfilter: Don't hide NETFILTER_XT_MATCH_ADDRTYPE behind NETFILTER_ADVANCED
Arturo Borrero (1):
netfilter: nft_compat: add support for arptables extensions
Julian Anastasov (1):
ipvs: use 64-bit rates in stats
Marcelo Ricardo Leitner (1):
ipvs: allow rescheduling of new connections when port reuse is detected
Wu Fengguang (1):
netfilter: ipset: fix boolreturn.cocci warnings
Documentation/networking/ipvs-sysctl.txt | 21 ++++
include/net/ip_vs.h | 61 +++++++---
include/uapi/linux/ip_vs.h | 7 +-
net/netfilter/Kconfig | 2 +-
net/netfilter/ipvs/ip_vs_core.c | 69 +++++++----
net/netfilter/ipvs/ip_vs_ctl.c | 182 ++++++++++++++++++++----------
net/netfilter/ipvs/ip_vs_est.c | 102 ++++++++---------
net/netfilter/ipvs/ip_vs_sync.c | 21 +++-
net/netfilter/nft_compat.c | 9 ++
net/netfilter/xt_set.c | 4 +-
10 files changed, 326 insertions(+), 152 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/5] Netfilter updates for net-next
2015-03-02 11:43 Pablo Neira Ayuso
@ 2015-03-02 19:55 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2015-03-02 19:55 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, netdev
From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Mon, 2 Mar 2015 12:43:42 +0100
> A small batch with accumulated updates in nf-next, mostly IPVS updates,
> they are:
>
> 1) Add 64-bits stats counters to IPVS, from Julian Anastasov.
>
> 2) Move NETFILTER_XT_MATCH_ADDRTYPE out of NETFILTER_ADVANCED as docker
> seem to require this, from Anton Blanchard.
>
> 3) Use boolean instead of numeric value in set_match_v*(), from
> coccinelle via Fengguang Wu.
>
> 4) Allows rescheduling of new connections in IPVS when port reuse is
> detected, from Marcelo Ricardo Leitner.
>
> 5) Add missing bits to support arptables extensions from nft_compat,
> from Arturo Borrero.
>
> Patrick is preparing a large batch to enhance the set infrastructure,
> named expressions among other things, that should follow up soon after
> this batch.
>
> You can pull these changes from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git
Pulled, thanks a lot Pablo.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-03-02 19:55 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-19 1:23 [PATCH 0/5] Netfilter updates for net-next Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 1/5] netfilter: ipv4: propagate routing errors from ip_route_me_harder() Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 2/5] netfilter: ipv6: propagate routing errors from ip6_route_me_harder() Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 3/5] netfilter: nat: propagate errors from xfrm_me_harder() Pablo Neira Ayuso
2013-04-19 1:23 ` [PATCH 5/5] netfilter: xt_rpfilter: depend on raw or mangle table Pablo Neira Ayuso
2013-04-19 21:56 ` [PATCH 0/5] Netfilter updates for net-next David Miller
-- strict thread matches above, loose matches on Subject: below --
2015-03-02 11:43 Pablo Neira Ayuso
2015-03-02 19:55 ` David Miller
2012-09-13 11:01 pablo
2012-09-13 18:26 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).