summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-09-25 16:39:14 +0200
committerDavid S. Miller <davem@davemloft.net>2015-09-25 22:00:37 +0200
commit4e3f5d727d60939c890a6e86944da52b3a1625ce (patch)
tree48cd1e6ecd83eea399758377fe063a960bbbd623
parentipv6: constify inet6_csk_route_req() socket argument (diff)
downloadlinux-4e3f5d727d60939c890a6e86944da52b3a1625ce.tar.xz
linux-4e3f5d727d60939c890a6e86944da52b3a1625ce.zip
inet: constify ip_dont_fragment() arguments
ip_dont_fragment() can accept const socket and dst Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ip.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index 9b9ca2839399..525dc0778926 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -282,10 +282,12 @@ int ip_decrease_ttl(struct iphdr *iph)
}
static inline
-int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
+int ip_dont_fragment(const struct sock *sk, const struct dst_entry *dst)
{
- return inet_sk(sk)->pmtudisc == IP_PMTUDISC_DO ||
- (inet_sk(sk)->pmtudisc == IP_PMTUDISC_WANT &&
+ u8 pmtudisc = READ_ONCE(inet_sk(sk)->pmtudisc);
+
+ return pmtudisc == IP_PMTUDISC_DO ||
+ (pmtudisc == IP_PMTUDISC_WANT &&
!(dst_metric_locked(dst, RTAX_MTU)));
}