Skip to content

Commit

Permalink
inet: constify ip_dont_fragment() arguments
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and davem330 committed Sep 25, 2015
1 parent 30d50c6 commit 4e3f5d7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/net/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

Expand Down

0 comments on commit 4e3f5d7

Please sign in to comment.