.. | .. |
---|
378 | 378 | static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph, |
---|
379 | 379 | const struct sk_buff *skb) |
---|
380 | 380 | { |
---|
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)) |
---|
382 | 384 | return iph->tos; |
---|
383 | | - else if (skb->protocol == htons(ETH_P_IPV6)) |
---|
| 385 | + else if (payload_protocol == htons(ETH_P_IPV6)) |
---|
384 | 386 | return ipv6_get_dsfield((const struct ipv6hdr *)iph); |
---|
385 | 387 | else |
---|
386 | 388 | return 0; |
---|
.. | .. |
---|
389 | 391 | static inline u8 ip_tunnel_get_ttl(const struct iphdr *iph, |
---|
390 | 392 | const struct sk_buff *skb) |
---|
391 | 393 | { |
---|
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)) |
---|
393 | 397 | return iph->ttl; |
---|
394 | | - else if (skb->protocol == htons(ETH_P_IPV6)) |
---|
| 398 | + else if (payload_protocol == htons(ETH_P_IPV6)) |
---|
395 | 399 | return ((const struct ipv6hdr *)iph)->hop_limit; |
---|
396 | 400 | else |
---|
397 | 401 | return 0; |
---|