|
@@ -263,6 +263,39 @@ int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
|
|
|
!(dst_metric_locked(dst, RTAX_MTU)));
|
|
|
}
|
|
|
|
|
|
+static inline bool ip_sk_accept_pmtu(const struct sock *sk)
|
|
|
+{
|
|
|
+ return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE;
|
|
|
+}
|
|
|
+
|
|
|
+static inline bool ip_sk_use_pmtu(const struct sock *sk)
|
|
|
+{
|
|
|
+ return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE;
|
|
|
+}
|
|
|
+
|
|
|
+static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
|
|
|
+ bool forwarding)
|
|
|
+{
|
|
|
+ struct net *net = dev_net(dst->dev);
|
|
|
+
|
|
|
+ if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
|
|
|
+ dst_metric_locked(dst, RTAX_MTU) ||
|
|
|
+ !forwarding)
|
|
|
+ return dst_mtu(dst);
|
|
|
+
|
|
|
+ return min(dst->dev->mtu, IP_MAX_MTU);
|
|
|
+}
|
|
|
+
|
|
|
+static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
|
|
|
+{
|
|
|
+ if (!skb->sk || ip_sk_use_pmtu(skb->sk)) {
|
|
|
+ bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;
|
|
|
+ return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding);
|
|
|
+ } else {
|
|
|
+ return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more);
|
|
|
|
|
|
static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk)
|