Skip to contentSkip to conversation

Patch "netfilter: use fwmark_reflect in nf_send_reset" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Aug 9, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

netfilter: use fwmark_reflect in nf_send_reset

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
netfilter-use-fwmark_reflect-in-nf_send_reset.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed Aug 9 10:32:06 PDT 2017

From: Pau Espin Pedrol <[email protected]>
Date: Fri, 6 Jan 2017 20:33:27 +0100
Subject: netfilter: use fwmark_reflect in nf_send_reset

From: Pau Espin Pedrol <[email protected]>

[ Upstream commit cc31d43b4154ad5a7d8aa5543255a93b7e89edc2 ]

Otherwise, RST packets generated by ipt_REJECT always have mark 0 when the routing is checked later in the same code path.

Fixes e110861f8609 ("net: add a sysctl to reflect the fwmark on replies")
Cc Lorenzo Colitti <[email protected]>
---
 net/ipv4/netfilter/nf_reject_ipv4.c |    2 ++
 net/ipv6/netfilter/nf_reject_ipv6.c |    3 +++
 2 files changed, 5 insertions(+)
net/ipv4/netfilter/nf_reject_ipv4.c +2 -0
@@ -126,6 +126,8 @@ void nf_send_reset(struct net *net, stru
 	/* ip_route_me_harder expects skb->dst to be set */
 	skb_dst_set_noref(nskb, skb_dst(oldskb));
 
+	nskb->mark = IP4_REPLY_MARK(net, oldskb->mark);
+
 	skb_reserve(nskb, LL_MAX_HEADER);
 	niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_TCP,
 				   ip4_dst_hoplimit(skb_dst(nskb)));
net/ipv6/netfilter/nf_reject_ipv6.c +3 -0
@@ -157,6 +157,7 @@ void nf_send_reset6(struct net *net, str
 	fl6.fl6_sport = otcph->dest;
 	fl6.fl6_dport = otcph->source;
 	fl6.flowi6_oif = l3mdev_master_ifindex(skb_dst(oldskb)->dev);
+	fl6.flowi6_mark = IP6_REPLY_MARK(net, oldskb->mark);
 	security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6));
 	dst = ip6_route_output(net, NULL, &fl6);
 	if (dst->error) {
@@ -180,6 +181,8 @@ void nf_send_reset6(struct net *net, str
 
 	skb_dst_set(nskb, dst);
 
+	nskb->mark = fl6.flowi6_mark;
+
 	skb_reserve(nskb, hh_len + dst->header_len);
 	ip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_TCP,
 				    ip6_dst_hoplimit(dst));

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/netfilter-use-fwmark_reflect-in-nf_send_reset.patch