File tree Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -524,7 +524,6 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev)
524
524
int tunnel_hlen ;
525
525
int version ;
526
526
int nhoff ;
527
- int thoff ;
528
527
529
528
tun_info = skb_tunnel_info (skb );
530
529
if (unlikely (!tun_info || !(tun_info -> mode & IP_TUNNEL_INFO_TX ) ||
@@ -558,10 +557,16 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev)
558
557
(ntohs (ip_hdr (skb )-> tot_len ) > skb -> len - nhoff ))
559
558
truncate = true;
560
559
561
- thoff = skb_transport_header (skb ) - skb_mac_header (skb );
562
- if (skb -> protocol == htons (ETH_P_IPV6 ) &&
563
- (ntohs (ipv6_hdr (skb )-> payload_len ) > skb -> len - thoff ))
564
- truncate = true;
560
+ if (skb -> protocol == htons (ETH_P_IPV6 )) {
561
+ int thoff ;
562
+
563
+ if (skb_transport_header_was_set (skb ))
564
+ thoff = skb_transport_header (skb ) - skb_mac_header (skb );
565
+ else
566
+ thoff = nhoff + sizeof (struct ipv6hdr );
567
+ if (ntohs (ipv6_hdr (skb )-> payload_len ) > skb -> len - thoff )
568
+ truncate = true;
569
+ }
565
570
566
571
if (version == 1 ) {
567
572
erspan_build_header (skb , ntohl (tunnel_id_to_key32 (key -> tun_id )),
Original file line number Diff line number Diff line change @@ -939,7 +939,6 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
939
939
__be16 proto ;
940
940
__u32 mtu ;
941
941
int nhoff ;
942
- int thoff ;
943
942
944
943
if (!pskb_inet_may_pull (skb ))
945
944
goto tx_err ;
@@ -960,10 +959,16 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
960
959
(ntohs (ip_hdr (skb )-> tot_len ) > skb -> len - nhoff ))
961
960
truncate = true;
962
961
963
- thoff = skb_transport_header (skb ) - skb_mac_header (skb );
964
- if (skb -> protocol == htons (ETH_P_IPV6 ) &&
965
- (ntohs (ipv6_hdr (skb )-> payload_len ) > skb -> len - thoff ))
966
- truncate = true;
962
+ if (skb -> protocol == htons (ETH_P_IPV6 )) {
963
+ int thoff ;
964
+
965
+ if (skb_transport_header_was_set (skb ))
966
+ thoff = skb_transport_header (skb ) - skb_mac_header (skb );
967
+ else
968
+ thoff = nhoff + sizeof (struct ipv6hdr );
969
+ if (ntohs (ipv6_hdr (skb )-> payload_len ) > skb -> len - thoff )
970
+ truncate = true;
971
+ }
967
972
968
973
if (skb_cow_head (skb , dev -> needed_headroom ?: t -> hlen ))
969
974
goto tx_err ;
You can’t perform that action at this time.
0 commit comments