diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net/route.h | 16 | ||||
-rw-r--r-- | include/uapi/linux/in.h | 5 |
2 files changed, 17 insertions, 4 deletions
diff --git a/include/net/route.h b/include/net/route.h index dd4ae0029fd8..f68c167280a7 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -313,12 +313,20 @@ static inline int ip4_dst_hoplimit(const struct dst_entry *dst) | |||
313 | return hoplimit; | 313 | return hoplimit; |
314 | } | 314 | } |
315 | 315 | ||
316 | static inline int ip_skb_dst_mtu(struct sk_buff *skb) | 316 | static inline bool ip_sk_accept_pmtu(const struct sock *sk) |
317 | { | 317 | { |
318 | struct inet_sock *inet = skb->sk ? inet_sk(skb->sk) : NULL; | 318 | return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE; |
319 | } | ||
319 | 320 | ||
320 | return (inet && inet->pmtudisc == IP_PMTUDISC_PROBE) ? | 321 | static inline bool ip_sk_use_pmtu(const struct sock *sk) |
321 | skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); | 322 | { |
323 | return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE; | ||
324 | } | ||
325 | |||
326 | static inline int ip_skb_dst_mtu(const struct sk_buff *skb) | ||
327 | { | ||
328 | return (!skb->sk || ip_sk_use_pmtu(skb->sk)) ? | ||
329 | dst_mtu(skb_dst(skb)) : skb_dst(skb)->dev->mtu; | ||
322 | } | 330 | } |
323 | 331 | ||
324 | #endif /* _ROUTE_H */ | 332 | #endif /* _ROUTE_H */ |
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h index f9e8e496ae5d..393c5de09d42 100644 --- a/include/uapi/linux/in.h +++ b/include/uapi/linux/in.h | |||
@@ -115,6 +115,11 @@ struct in_addr { | |||
115 | #define IP_PMTUDISC_WANT 1 /* Use per route hints */ | 115 | #define IP_PMTUDISC_WANT 1 /* Use per route hints */ |
116 | #define IP_PMTUDISC_DO 2 /* Always DF */ | 116 | #define IP_PMTUDISC_DO 2 /* Always DF */ |
117 | #define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */ | 117 | #define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */ |
118 | /* Always use interface mtu (ignores dst pmtu) but don't set DF flag. | ||
119 | * Also incoming ICMP frag_needed notifications will be ignored on | ||
120 | * this socket to prevent accepting spoofed ones. | ||
121 | */ | ||
122 | #define IP_PMTUDISC_INTERFACE 4 | ||
118 | 123 | ||
119 | #define IP_MULTICAST_IF 32 | 124 | #define IP_MULTICAST_IF 32 |
120 | #define IP_MULTICAST_TTL 33 | 125 | #define IP_MULTICAST_TTL 33 |