On 03/11/2019 08:14 AM, Olga Albisser wrote:

> +
> +static u32 get_ecn_field(struct sk_buff *skb)
> +{
> +     switch (skb->protocol) {

tc_skb_protocol(skb)

> +     case cpu_to_be16(ETH_P_IP):

Theoretically you have to use pskb_may_pull() before assuming network header is 
in the linear part of skb (skb->head)

> +     return ipv4_get_dsfield(ip_hdr(skb)) & INET_ECN_MASK;
> +     case cpu_to_be16(ETH_P_IPV6):
> +             return ipv6_get_dsfield(ipv6_hdr(skb)) & INET_ECN_MASK;
> +     default:
> +             return 0;
> +     }
> +}
> 



Reply via email to