hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/include/net/ip_tunnels.h
....@@ -378,9 +378,11 @@
378378 static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph,
379379 const struct sk_buff *skb)
380380 {
381
- if (skb->protocol == htons(ETH_P_IP))
381
+ __be16 payload_protocol = skb_protocol(skb, true);
382
+
383
+ if (payload_protocol == htons(ETH_P_IP))
382384 return iph->tos;
383
- else if (skb->protocol == htons(ETH_P_IPV6))
385
+ else if (payload_protocol == htons(ETH_P_IPV6))
384386 return ipv6_get_dsfield((const struct ipv6hdr *)iph);
385387 else
386388 return 0;
....@@ -389,9 +391,11 @@
389391 static inline u8 ip_tunnel_get_ttl(const struct iphdr *iph,
390392 const struct sk_buff *skb)
391393 {
392
- if (skb->protocol == htons(ETH_P_IP))
394
+ __be16 payload_protocol = skb_protocol(skb, true);
395
+
396
+ if (payload_protocol == htons(ETH_P_IP))
393397 return iph->ttl;
394
- else if (skb->protocol == htons(ETH_P_IPV6))
398
+ else if (payload_protocol == htons(ETH_P_IPV6))
395399 return ((const struct ipv6hdr *)iph)->hop_limit;
396400 else
397401 return 0;