EXPORT_SYMBOL(sysctl_ip_default_ttl);
 
 static int ip_fragment(struct sock *sk, struct sk_buff *skb,
+                      unsigned int mtu,
                       int (*output)(struct sock *, struct sk_buff *));
 
 /* Generate a checksum for an outgoing IP datagram. */
        return -EINVAL;
 }
 
-static int ip_finish_output_gso(struct sock *sk, struct sk_buff *skb)
+static int ip_finish_output_gso(struct sock *sk, struct sk_buff *skb,
+                               unsigned int mtu)
 {
        netdev_features_t features;
        struct sk_buff *segs;
 
        /* common case: locally created skb or seglen is <= mtu */
        if (((IPCB(skb)->flags & IPSKB_FORWARDED) == 0) ||
-             skb_gso_network_seglen(skb) <= ip_skb_dst_mtu(skb))
+             skb_gso_network_seglen(skb) <= mtu)
                return ip_finish_output2(sk, skb);
 
        /* Slowpath -  GSO segment length is exceeding the dst MTU.
                int err;
 
                segs->next = NULL;
-               err = ip_fragment(sk, segs, ip_finish_output2);
+               err = ip_fragment(sk, segs, mtu, ip_finish_output2);
 
                if (err && ret == 0)
                        ret = err;
 
 static int ip_finish_output(struct sock *sk, struct sk_buff *skb)
 {
+       unsigned int mtu;
+
 #if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM)
        /* Policy lookup after SNAT yielded a new policy */
        if (skb_dst(skb)->xfrm) {
                return dst_output_sk(sk, skb);
        }
 #endif
+       mtu = ip_skb_dst_mtu(skb);
        if (skb_is_gso(skb))
-               return ip_finish_output_gso(sk, skb);
+               return ip_finish_output_gso(sk, skb, mtu);
 
-       if (skb->len > ip_skb_dst_mtu(skb))
-               return ip_fragment(sk, skb, ip_finish_output2);
+       if (skb->len > mtu)
+               return ip_fragment(sk, skb, mtu, ip_finish_output2);
 
        return ip_finish_output2(sk, skb);
 }
 }
 
 static int ip_fragment(struct sock *sk, struct sk_buff *skb,
+                      unsigned int mtu,
                       int (*output)(struct sock *, struct sk_buff *))
 {
        struct iphdr *iph = ip_hdr(skb);
-       unsigned int mtu = ip_skb_dst_mtu(skb);
 
        if (unlikely(((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) ||
                     (IPCB(skb)->frag_max_size &&