* [PATCH] Netfilter: Fix an ICMPv6 bug which caused by a latter ICMPv6 NA packet to inherit the mark of previous NS packet.
@ 2016-10-21 8:23 XU Tianwen
2016-10-21 9:00 ` Florian Westphal
0 siblings, 1 reply; 2+ messages in thread
From: XU Tianwen @ 2016-10-21 8:23 UTC (permalink / raw)
To: yasuyuki.kozakai, pablo, kaber, kadlec, davem, kuznet, jmorris, yoshfuji
Cc: netfilter-devel, coreteam, netdev, linux-kernel, XU Tianwen
The root cause is an ICMPv6 packet hits an untracked connection and inherits a mark from the previous packet to which it is not related, IMO it doesn't make sense to inherit mark for nf_conntrack_untracked.
Signed-off-by: XU Tianwen <evan.xu.tianwen@gmail.com>
---
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index f5a61bc..1be9000 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -223,6 +223,9 @@ icmpv6_error(struct net *net, struct nf_conn *tmpl,
if (type >= 0 && type < sizeof(noct_valid_new) &&
noct_valid_new[type]) {
skb->nfct = &nf_ct_untracked_get()->ct_general;
+#ifdef CONFIG_NF_CONNTRACK_MARK
+ ((struct nf_conn *)skb->nfct)->mark = 0;
+#endif
skb->nfctinfo = IP_CT_NEW;
nf_conntrack_get(skb->nfct);
return NF_ACCEPT;
--
2.1.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Netfilter: Fix an ICMPv6 bug which caused by a latter ICMPv6 NA packet to inherit the mark of previous NS packet.
2016-10-21 8:23 [PATCH] Netfilter: Fix an ICMPv6 bug which caused by a latter ICMPv6 NA packet to inherit the mark of previous NS packet XU Tianwen
@ 2016-10-21 9:00 ` Florian Westphal
0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2016-10-21 9:00 UTC (permalink / raw)
To: XU Tianwen
Cc: yasuyuki.kozakai, pablo, kaber, kadlec, davem, kuznet, jmorris,
yoshfuji, netfilter-devel, coreteam, netdev, linux-kernel
XU Tianwen <evan.xu.tianwen@gmail.com> wrote:
> The root cause is an ICMPv6 packet hits an untracked connection and inherits a mark from the previous packet to which it is not related, IMO it doesn't make sense to inherit mark for nf_conntrack_untracked.
>
> Signed-off-by: XU Tianwen <evan.xu.tianwen@gmail.com>
> ---
> net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
> index f5a61bc..1be9000 100644
> --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
> +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
> @@ -223,6 +223,9 @@ icmpv6_error(struct net *net, struct nf_conn *tmpl,
> if (type >= 0 && type < sizeof(noct_valid_new) &&
> noct_valid_new[type]) {
> skb->nfct = &nf_ct_untracked_get()->ct_general;
> +#ifdef CONFIG_NF_CONNTRACK_MARK
> + ((struct nf_conn *)skb->nfct)->mark = 0;
> +#endif
> skb->nfctinfo = IP_CT_NEW;
> nf_conntrack_get(skb->nfct);
> return NF_ACCEPT;
> --
> 2.1.2
Where does that bogus mark come from in first place?
Untracked mark should always be 0.
Maybe we need this instead?
diff --git a/net/netfilter/xt_connmark.c b/net/netfilter/xt_connmark.c
--- a/net/netfilter/xt_connmark.c
+++ b/net/netfilter/xt_connmark.c
@@ -44,7 +44,7 @@ connmark_tg(struct sk_buff *skb, const struct xt_action_param *par)
u_int32_t newmark;
ct = nf_ct_get(skb, &ctinfo);
- if (ct == NULL)
+ if (ct == NULL || nf_ct_is_untracked(ct))
return XT_CONTINUE;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-21 9:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-21 8:23 [PATCH] Netfilter: Fix an ICMPv6 bug which caused by a latter ICMPv6 NA packet to inherit the mark of previous NS packet XU Tianwen
2016-10-21 9:00 ` Florian Westphal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.