From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 02/11] netfilter: Update nf_send_reset6 to consider L3 domain
Date: Wed, 30 Nov 2016 22:57:16 +0100 [thread overview]
Message-ID: <1480543045-3389-3-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1480543045-3389-1-git-send-email-pablo@netfilter.org>
From: David Ahern <dsa@cumulusnetworks.com>
nf_send_reset6 is not considering the L3 domain and lookups are sent
to the wrong table. For example consider the following output rule:
ip6tables -A OUTPUT -p tcp --dport 12345 -j REJECT --reject-with tcp-reset
using perf to analyze lookups via the fib6_table_lookup tracepoint shows:
swapper 0 [001] 248.787816: fib6:fib6_table_lookup: table 255 oif 0 iif 1 src 2100:1::3 dst 2100:1:
ffffffff81439cdc perf_trace_fib6_table_lookup ([kernel.kallsyms])
ffffffff814c1ce3 trace_fib6_table_lookup ([kernel.kallsyms])
ffffffff814c3e89 ip6_pol_route ([kernel.kallsyms])
ffffffff814c40d5 ip6_pol_route_output ([kernel.kallsyms])
ffffffff814e7b6f fib6_rule_action ([kernel.kallsyms])
ffffffff81437f60 fib_rules_lookup ([kernel.kallsyms])
ffffffff814e7c79 fib6_rule_lookup ([kernel.kallsyms])
ffffffff814c2541 ip6_route_output_flags ([kernel.kallsyms])
528 nf_send_reset6 ([nf_reject_ipv6])
The lookup is directed to table 255 rather than the table associated with
the device via the L3 domain. Update nf_send_reset6 to pull the L3 domain
from the dst currently attached to the skb.
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv6/netfilter/nf_reject_ipv6.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c
index a5400223fd74..10090400c72f 100644
--- a/net/ipv6/netfilter/nf_reject_ipv6.c
+++ b/net/ipv6/netfilter/nf_reject_ipv6.c
@@ -156,6 +156,7 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook)
fl6.daddr = oip6h->saddr;
fl6.fl6_sport = otcph->dest;
fl6.fl6_dport = otcph->source;
+ fl6.flowi6_oif = l3mdev_master_ifindex(skb_dst(oldskb)->dev);
security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6));
dst = ip6_route_output(net, NULL, &fl6);
if (dst->error) {
--
2.1.4
next prev parent reply other threads:[~2016-11-30 21:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 21:57 [PATCH 00/11] Netfilter fixes for net Pablo Neira Ayuso
2016-11-30 21:57 ` [PATCH 01/11] netfilter: Update ip_route_me_harder to consider L3 domain Pablo Neira Ayuso
2016-11-30 21:57 ` Pablo Neira Ayuso [this message]
2016-11-30 21:57 ` [PATCH 03/11] netfilter: fix nf_conntrack_helper documentation Pablo Neira Ayuso
2016-11-30 21:57 ` [PATCH 04/11] netfilter: nft_hash: validate maximum value of u32 netlink hash attribute Pablo Neira Ayuso
2016-11-30 21:57 ` [PATCH 05/11] netfilter: nat: fix cmp return value Pablo Neira Ayuso
2016-11-30 21:57 ` [PATCH 06/11] netfilter: nat: switch to new rhlist interface Pablo Neira Ayuso
2016-11-30 21:57 ` [PATCH 07/11] netfilter: nf_tables: fix inconsistent element expiration calculation Pablo Neira Ayuso
2016-11-30 21:57 ` [PATCH 08/11] netfilter: nft_range: add the missing NULL pointer check Pablo Neira Ayuso
2016-11-30 21:57 ` [PATCH 09/11] netfilter: nat: fix crash when conntrack entry is re-used Pablo Neira Ayuso
2016-11-30 21:57 ` [PATCH 10/11] netfilter: ipv6: nf_defrag: drop mangled skb on ream error Pablo Neira Ayuso
2016-11-30 21:57 ` [PATCH 11/11] netfilter: arp_tables: fix invoking 32bit "iptable -P INPUT ACCEPT" failed in 64bit kernel Pablo Neira Ayuso
2016-12-01 16:13 ` [PATCH 00/11] Netfilter fixes for net David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480543045-3389-3-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).