aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-05-13 13:17:34 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-13 18:35:09 -0400
commit1b3c61dc1aebf5d3d6c3981ba3eedc1e66f3ecda (patch)
tree60c0617f575a955b37d6c0eb681bd3f9acea8670 /net/ipv4
parente110861f86094cd78cc85593b873970092deb43a (diff)
net: Use fwmark reflection in PMTU discovery.
Currently, routing lookups used for Path PMTU Discovery in absence of a socket or on unmarked sockets use a mark of 0. This causes PMTUD not to work when using routing based on netfilter fwmark mangling and fwmark ip rules, such as: iptables -j MARK --set-mark 17 ip rule add fwmark 17 lookup 100 This patch causes these route lookups to use the fwmark from the received ICMP error when the fwmark_reflect sysctl is enabled. This allows the administrator to make PMTUD work by configuring appropriate fwmark rules to mark the inbound ICMP packets. Black-box tested using user-mode linux by pointing different fwmarks at routing tables egressing on different interfaces, and using iptables mangling to mark packets inbound on each interface with the interface's fwmark. ICMPv4 and ICMPv6 PMTU discovery work as expected when mark reflection is enabled and fail when it is disabled. Signed-off-by: Lorenzo Colitti <lorenzo@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/route.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index db1e0da871f4..50e1e0feddfc 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -993,6 +993,9 @@ void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
993 struct flowi4 fl4; 993 struct flowi4 fl4;
994 struct rtable *rt; 994 struct rtable *rt;
995 995
996 if (!mark)
997 mark = IP4_REPLY_MARK(net, skb->mark);
998
996 __build_flow_key(&fl4, NULL, iph, oif, 999 __build_flow_key(&fl4, NULL, iph, oif,
997 RT_TOS(iph->tos), protocol, mark, flow_flags); 1000 RT_TOS(iph->tos), protocol, mark, flow_flags);
998 rt = __ip_route_output_key(net, &fl4); 1001 rt = __ip_route_output_key(net, &fl4);
@@ -1010,6 +1013,10 @@ static void __ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
1010 struct rtable *rt; 1013 struct rtable *rt;
1011 1014
1012 __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); 1015 __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0);
1016
1017 if (!fl4.flowi4_mark)
1018 fl4.flowi4_mark = IP4_REPLY_MARK(sock_net(sk), skb->mark);
1019
1013 rt = __ip_route_output_key(sock_net(sk), &fl4); 1020 rt = __ip_route_output_key(sock_net(sk), &fl4);
1014 if (!IS_ERR(rt)) { 1021 if (!IS_ERR(rt)) {
1015 __ip_rt_update_pmtu(rt, &fl4, mtu); 1022 __ip_rt_update_pmtu(rt, &fl4, mtu);