ACK: [{xenial, disco}:linux-azure PATCH 1/1] SAUCE: af_packet: Fix skb protocol value in tpacket_fill_skb()

Colin Ian King colin.king at canonical.com
Thu Dec 12 14:14:27 UTC 2019


On 12/12/2019 14:00, Marcelo Henrique Cerri wrote:
> From: Raghav Kempanna <kraghav at vmware.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1855461
> 
> Adapted from upstream patches for 4.15:
> 75c65772c3d1 ("net/packet: Ask driver for protocol if not provided by user")
> 18bed89107a4 ("af_packet: fix the tx skb protocol in raw sockets with ETH_P_ALL")
> 
> Signed-off-by: Raghav Kempanna <kraghav at vmware.com>
> Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
> Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
> ---
>  net/packet/af_packet.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 1e25e06df2db..ea74f2ffe41d 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -2550,6 +2550,15 @@ static int tpacket_fill_skb(struct packet_sock *po, struct sk_buff *skb,
>  		len = ((to_write > len_max) ? len_max : to_write);
>  	}
>  
> +	if ((!skb->protocol || skb->protocol == htons(ETH_P_ALL)) &&
> +	    sock->type == SOCK_RAW) {
> +		const struct ethhdr *eth;
> +
> +		skb_reset_mac_header(skb);
> +		eth = eth_hdr(skb);
> +		skb->protocol = eth->h_proto;
> +	}
> +
>  	skb_probe_transport_header(skb, 0);
>  
>  	return tp_len;
> 

Looks like a reasonable sauce patch derived from the two commits. It's
had some positive tests results, so that is good too. So..

Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the kernel-team mailing list