On Wed, 14 Apr 2021 16:25:39 -0700 Saeed Mahameed wrote:
> +static void get_inner_ipproto(struct sk_buff *skb, struct sec_path *sp)
> +{
> +     const struct ethhdr *eth;
> +
> +     if (!skb->inner_protocol)
> +             return;
> +
> +     if (skb->inner_protocol_type == ENCAP_TYPE_IPPROTO) {
> +             sp->inner_ipproto = skb->inner_protocol;
> +             return;
> +     }
> +
> +     if (skb->inner_protocol_type != ENCAP_TYPE_ETHER)
> +             return;
> +
> +     eth = (struct ethhdr *)skb_inner_mac_header(skb);
> +
> +     switch (eth->h_proto) {
> +     case ntohs(ETH_P_IPV6):
> +             sp->inner_ipproto = inner_ipv6_hdr(skb)->nexthdr;
> +             break;
> +     case ntohs(ETH_P_IP):
> +             sp->inner_ipproto = inner_ip_hdr(skb)->protocol;
> +             break;
> +     default:
> +             return;
> +     }
> +}

Bunch of sparse warnings here, please check.

Reply via email to