• Y
    bonding: Add vlan tx offload to hw_enc_features · cabb3a72
    YueHaibing 提交于
    hulk inclusion
    category: bugfix
    bugzilla: 16589
    CVE: NA
    
    -------------------------------------------------
    
    As commit 30d8177e8ac7 ("bonding: Always enable vlan tx offload")
    said, we should always enable bonding's vlan tx offload, pass the
    vlan packets to the slave devices with vlan tci, let them to handle
    vlan implementation.
    
    Now if encapsulation protocols like VXLAN is used, skb->encapsulation
    may be set, then the packet is passed to vlan device which based on
    bonding device. However in netif_skb_features(), the check of
    hw_enc_features:
    
    	 if (skb->encapsulation)
                     features &= dev->hw_enc_features;
    
    clears NETIF_F_HW_VLAN_CTAG_TX/NETIF_F_HW_VLAN_STAG_TX. This results
    in same issue in commit 30d8177e8ac7 like this:
    
    vlan_dev_hard_start_xmit
      -->dev_queue_xmit
        -->validate_xmit_skb
          -->netif_skb_features //NETIF_F_HW_VLAN_CTAG_TX is cleared
          -->validate_xmit_vlan
            -->__vlan_hwaccel_push_inside //skb->tci is cleared
    ...
     --> bond_start_xmit
       --> bond_xmit_hash //BOND_XMIT_POLICY_ENCAP34
         --> __skb_flow_dissect // nhoff point to IP header
            -->  case htons(ETH_P_8021Q)
                 // skb_vlan_tag_present is false, so
                 vlan = __skb_header_pointer(skb, nhoff, sizeof(_vlan),
                 //vlan point to ip header wrongly
    
    Link: https://patchwork.ozlabs.org/patch/1143194/
    Fixes: b2a103e6 ("bonding: convert to ndo_fix_features")
    Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
    Acked-by: NJay Vosburgh <jay.vosburgh@canonical.com>
    Reviewed-by: NWei Yongjun <weiyongjun1@huawei.com>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    cabb3a72
bond_main.c 136.3 KB