From: Eric Dumazet Date: Fri, 25 Sep 2015 14:39:14 +0000 (-0700) Subject: inet: constify ip_dont_fragment() arguments X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4e3f5d727d60939c890a6e86944da52b3a1625ce;p=linux-beck.git inet: constify ip_dont_fragment() arguments ip_dont_fragment() can accept const socket and dst Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- 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))); }