From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 581CC70830 for ; Tue, 28 Apr 2026 02:08:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777342097; cv=none; b=abOR5h/0vY/p753qRU9idIdRmE5jRBXcaFrsiCMteszZ4j/SkHAeA0pki2s+gdc3qym4I7YuAT4FLVIhubrlpxXB41ecCJb54kpxGr/hNKiVLgKnkNWFMrtUmdH1vQvZ9nNInDMNq/LlPLNNDep0dJhlgRfiNJ+/uepUMorPUAU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777342097; c=relaxed/simple; bh=5fweW2NW0Gar4b/duUKwxUCucTy5E5pmuqgkgyQ1cc0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Y6AQGDRkzLgfbb8zg8ZsJePo8jCmrKg38OOLDhyGfV3xbFbvNs/+AQEWDqC9vhOdrsrlyLdDjjOdNeNp7qdoS2eqHDwZLMofoNRzIqtsc+TyZslJIzGkXcBlKc/0lccmQWQXo8KbaOL2cBu6U4ysbzUsl5DikGUgAYrKR7tODVE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=mrg1wLtA; arc=none smtp.client-ip=95.215.58.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="mrg1wLtA" Message-ID: <501fb5d6-3247-40aa-aaa5-ce9dacb17255@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1777342089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3XE8CatXrYTF+194303j/a2miQCVsg0bLQkFRF29ixA=; b=mrg1wLtAmpzJZCskWXqUIGZsGlEpDpI272zAeY/R4wE+KjjS9jzo//8KzLlYbEEVgRUAoA AcQBa+M6hgQYqIiHvUS5xAG8bDH0ebyeZCIDdZBjaPOBFqvUyuSxJR87eootXrI6g55oKB +r9PGJx8iZwyOqWs/mc4n68uaTxyVvY= Date: Tue, 28 Apr 2026 10:08:00 +0800 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [Openvpn-devel] [PATCH ovpn-net-next] ovpn: reset MAC header before passing skb up To: Antonio Quartulli , openvpn-devel@lists.sourceforge.net Cc: Minqiang Chen , Sabrina Dubroca , netdev@vger.kernel.org References: <20260427040011.2107748-1-qingfang.deng@linux.dev> <101221c8-8e47-4fc1-9791-2ef3a0ae8312@unstable.cc> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Qingfang Deng In-Reply-To: <101221c8-8e47-4fc1-9791-2ef3a0ae8312@unstable.cc> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Hi, On 2026/4/27 17:45, Antonio Quartulli wrote: > Hi Qingfang, > > thanks for the patch! > > On 27/04/2026 06:00, Qingfang Deng wrote: >> After decapsulating a packet, the skb->mac_header still points to the >> outer transport header. Call skb_reset_mac_header() in >> ovpn_netdev_write() to ensure the MAC header points to the beginning of >> the inner IP packet. > > May you elaborate on what this is exactly fixing? > Did you encounter a bug triggered by this missing line? > > I am asking because I wonder what is "expected" as MAC header for a > packet not having one at all (packets delivered to the ovpn interface > are L3 only, as per the interface type itself). For L3-only devices, the net core expects skb->mac_header == skb->network_header. For example, in __netif_receive_skb_core(), skb_reset_mac_len() sets skb->mac_len to (skb->network_header - skb->mac_header). If skb->mac_header still has a stale value, this will incorrectly assign a non-zero value to skb->mac_len. Also, if generic XDP or SOCK_PACKET is used, either will do   skb_push(skb, skb->data - skb_mac_header(skb)); > > Thanks! > > Regards, > >> >> Reported-by: Minqiang Chen >> Fixes: 8534731dbf2d ("ovpn: implement packet processing") >> Signed-off-by: Qingfang Deng >> --- >>   drivers/net/ovpn/io.c | 1 + >>   1 file changed, 1 insertion(+) >> >> diff --git a/drivers/net/ovpn/io.c b/drivers/net/ovpn/io.c >> index db43a1f8a07a..d92bb87be2b2 100644 >> --- a/drivers/net/ovpn/io.c >> +++ b/drivers/net/ovpn/io.c >> @@ -85,6 +85,7 @@ static void ovpn_netdev_write(struct ovpn_peer >> *peer, struct sk_buff *skb) >>       skb_scrub_packet(skb, true); >>         /* network header reset in ovpn_decrypt_post() */ >> +    skb_reset_mac_header(skb); >>       skb_reset_transport_header(skb); >>       skb_reset_inner_headers(skb); > +Cc: netdev Regards, Qingfang