[PATCH] net/tap: Modified TAP BPF program as per the Kernel-version upgrade requirements.

Stephen Hemminger stephen at networkplumber.org
Fri Jan 12 17:43:59 CET 2024


On Fri, 12 Jan 2024 19:18:21 +0530
madhuker.mythri at oracle.com wrote:

> +	if (bpf_skb_load_bytes_relative(skb, 0, &nh, sizeof(nh), BPF_HDR_START_NET))
> +		return TC_ACT_OK;
> +	if (nh.iph.version == 4) {

Using IP header bytes, instead of ether header protocol (in skb->proto)
is changing functionality and wrong. You don't want to be seeing some other
protocol (not IPv4 or IPv6) that just happened to have the 4 in that nibble.

Original code was fine.


More information about the dev mailing list