aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/core/dev.c14
-rw-r--r--net/ipv4/gre_offload.c3
-rw-r--r--net/ipv4/udp.c4
3 files changed, 12 insertions, 9 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 560dafd83adf..a3d8d44cb7f4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2481,10 +2481,10 @@ static int dev_gso_segment(struct sk_buff *skb, netdev_features_t features)
2481} 2481}
2482 2482
2483static netdev_features_t harmonize_features(struct sk_buff *skb, 2483static netdev_features_t harmonize_features(struct sk_buff *skb,
2484 __be16 protocol, netdev_features_t features) 2484 netdev_features_t features)
2485{ 2485{
2486 if (skb->ip_summed != CHECKSUM_NONE && 2486 if (skb->ip_summed != CHECKSUM_NONE &&
2487 !can_checksum_protocol(features, protocol)) { 2487 !can_checksum_protocol(features, skb_network_protocol(skb))) {
2488 features &= ~NETIF_F_ALL_CSUM; 2488 features &= ~NETIF_F_ALL_CSUM;
2489 } else if (illegal_highdma(skb->dev, skb)) { 2489 } else if (illegal_highdma(skb->dev, skb)) {
2490 features &= ~NETIF_F_SG; 2490 features &= ~NETIF_F_SG;
@@ -2505,20 +2505,18 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
2505 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; 2505 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
2506 protocol = veh->h_vlan_encapsulated_proto; 2506 protocol = veh->h_vlan_encapsulated_proto;
2507 } else if (!vlan_tx_tag_present(skb)) { 2507 } else if (!vlan_tx_tag_present(skb)) {
2508 return harmonize_features(skb, protocol, features); 2508 return harmonize_features(skb, features);
2509 } 2509 }
2510 2510
2511 features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX | 2511 features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX |
2512 NETIF_F_HW_VLAN_STAG_TX); 2512 NETIF_F_HW_VLAN_STAG_TX);
2513 2513
2514 if (protocol != htons(ETH_P_8021Q) && protocol != htons(ETH_P_8021AD)) { 2514 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD))
2515 return harmonize_features(skb, protocol, features);
2516 } else {
2517 features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | 2515 features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST |
2518 NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX | 2516 NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX |
2519 NETIF_F_HW_VLAN_STAG_TX; 2517 NETIF_F_HW_VLAN_STAG_TX;
2520 return harmonize_features(skb, protocol, features); 2518
2521 } 2519 return harmonize_features(skb, features);
2522} 2520}
2523EXPORT_SYMBOL(netif_skb_features); 2521EXPORT_SYMBOL(netif_skb_features);
2524 2522
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c
index 775d5b532ece..55e6bfb3a289 100644
--- a/net/ipv4/gre_offload.c
+++ b/net/ipv4/gre_offload.c
@@ -100,6 +100,9 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
100 } 100 }
101 __skb_push(skb, tnl_hlen - ghl); 101 __skb_push(skb, tnl_hlen - ghl);
102 102
103 skb_reset_inner_headers(skb);
104 skb->encapsulation = 1;
105
103 skb_reset_mac_header(skb); 106 skb_reset_mac_header(skb);
104 skb_set_network_header(skb, mac_len); 107 skb_set_network_header(skb, mac_len);
105 skb->mac_len = mac_len; 108 skb->mac_len = mac_len;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index a0d7151ffbd9..766e6bab9113 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2323,6 +2323,9 @@ struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
2323 struct udphdr *uh; 2323 struct udphdr *uh;
2324 int udp_offset = outer_hlen - tnl_hlen; 2324 int udp_offset = outer_hlen - tnl_hlen;
2325 2325
2326 skb_reset_inner_headers(skb);
2327 skb->encapsulation = 1;
2328
2326 skb->mac_len = mac_len; 2329 skb->mac_len = mac_len;
2327 2330
2328 skb_push(skb, outer_hlen); 2331 skb_push(skb, outer_hlen);
@@ -2345,7 +2348,6 @@ struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
2345 uh->check = CSUM_MANGLED_0; 2348 uh->check = CSUM_MANGLED_0;
2346 2349
2347 } 2350 }
2348 skb->ip_summed = CHECKSUM_NONE;
2349 skb->protocol = protocol; 2351 skb->protocol = protocol;
2350 } while ((skb = skb->next)); 2352 } while ((skb = skb->next));
2351out: 2353out: