]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/ipv4/ip_output.c
Merge tag 'mfd-fixes-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
[mirror_ubuntu-bionic-kernel.git] / net / ipv4 / ip_output.c
index 05d105832bdbb88f5f9d611d9f8bd35b1ae7f5d6..105908d841a359bb433621b286398a2821852645 100644 (file)
@@ -239,19 +239,23 @@ static int ip_finish_output_gso(struct net *net, struct sock *sk,
        struct sk_buff *segs;
        int ret = 0;
 
-       /* common case: fragmentation of segments is not allowed,
-        * or seglen is <= mtu
+       /* common case: seglen is <= mtu
         */
-       if (((IPCB(skb)->flags & IPSKB_FRAG_SEGS) == 0) ||
-             skb_gso_validate_mtu(skb, mtu))
+       if (skb_gso_validate_mtu(skb, mtu))
                return ip_finish_output2(net, sk, skb);
 
-       /* Slowpath -  GSO segment length is exceeding the dst MTU.
+       /* Slowpath -  GSO segment length exceeds the egress MTU.
         *
-        * This can happen in two cases:
-        * 1) TCP GRO packet, DF bit not set
-        * 2) skb arrived via virtio-net, we thus get TSO/GSO skbs directly
-        * from host network stack.
+        * This can happen in several cases:
+        *  - Forwarding of a TCP GRO skb, when DF flag is not set.
+        *  - Forwarding of an skb that arrived on a virtualization interface
+        *    (virtio-net/vhost/tap) with TSO/GSO size set by other network
+        *    stack.
+        *  - Local GSO skb transmitted on an NETIF_F_TSO tunnel stacked over an
+        *    interface with a smaller MTU.
+        *  - Arriving GRO skb (or GSO skb in a virtualized environment) that is
+        *    bridged to a NETIF_F_TSO tunnel stacked over an interface with an
+        *    insufficent MTU.
         */
        features = netif_skb_features(skb);
        BUILD_BUG_ON(sizeof(*IPCB(skb)) > SKB_SGO_CB_OFFSET);
@@ -538,7 +542,6 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
 {
        struct iphdr *iph;
        int ptr;
-       struct net_device *dev;
        struct sk_buff *skb2;
        unsigned int mtu, hlen, left, len, ll_rs;
        int offset;
@@ -546,8 +549,6 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
        struct rtable *rt = skb_rtable(skb);
        int err = 0;
 
-       dev = rt->dst.dev;
-
        /* for offloaded checksums cleanup checksum before fragmentation */
        if (skb->ip_summed == CHECKSUM_PARTIAL &&
            (err = skb_checksum_help(skb)))
@@ -1582,7 +1583,8 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
        }
 
        oif = arg->bound_dev_if;
-       oif = oif ? : skb->skb_iif;
+       if (!oif && netif_index_is_l3_master(net, skb->skb_iif))
+               oif = skb->skb_iif;
 
        flowi4_init_output(&fl4, oif,
                           IP4_REPLY_MARK(net, skb->mark),