From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (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 C31003D75B9; Mon, 1 Jun 2026 15:02:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780326179; cv=none; b=DtixW8O+B4baX4r6h2lkze8Z1faT7alPbEj5sT4IymiU0igLOsWg7Gk3VENYTJH23whUJ9IBQOMYST9YxLwV+EVeQT6+hos9SF4O+u37cJBGYjWcvL0TWb7ud4GYADAzNfDJ+eoApXnu3H30RdE1hC8gm1aXT0VDUZMcQQA6ZuU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780326179; c=relaxed/simple; bh=wi4uhkHTWPvW3vtOQi3U5Uu+t3OBcXcFzrWJpvUCSxo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=aUPuMDw63CoPCGEl+etYFbeBYVWx5bOj/eFHqZWaErZwA3h0bmpVntH6z6z6f19YDFwcz/pTKhVXrvI2X/mPGW5OJxdPFD/fP62z2INz0RDXXrYFT/nhHrp5mGkJIyjwx6xoJem6jMqLnrb6VzfVeWdwfi5GPpSufzJVLhSbv7o= 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=wf9x7CW9; arc=none smtp.client-ip=91.218.175.174 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="wf9x7CW9" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780326165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=7ZoYADBK9XZFEaglIzgjbTAZy+ZzDPXzGK/FiK5cnTo=; b=wf9x7CW9ZbRShz2Ok32SwBJqzI+YJWVKA3sdoULQu23tDiJ7z9Rel1wKHUilB7fDQYOFkJ 5xVkMU+2ukQ09fQc8WK7rNQKAxcRJZGVYtsdf6PC1z/hzQhAebIwm9iM4IvhgcI62Ta1v4 xKlMqm+G+tIjL/AMon2Yngu6E4V+M54= From: Leon Hwang To: bpf@vger.kernel.org Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Andrii Nakryiko , Eduard Zingerman , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , Shuah Khan , Guillaume Nault , Leon Hwang , Ido Schimmel , Fernando Fernandez Mancera , Peter Oskolkov , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-patches-bot@fb.com Subject: [PATCH bpf v3 0/2] bpf: Update transport_header when encapsulating UDP tunnel in lwt Date: Mon, 1 Jun 2026 23:02:01 +0800 Message-ID: <20260601150203.20352-1-leon.hwang@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Currently, bpf_lwt_push_ip_encap() does not update skb->transport_header. When a driver, e.g. ice, reuses the stale skb->transport_header to offload checksum computation to NIC hardware, VxLAN packets encapsulated by bpf_lwt_push_encap() helper may be dropped due to incorrect checksum. Update skb->transport_header in bpf_lwt_push_ip_encap() whenever the encapsulated packet uses UDP, so checksum offload works correctly. Changes: v2 -> v3: * Drop patch #1 and #2 of v2 that aim to resolve potential issues reported by sashiko (per Alexei). * Check target IP version and UDP tunnel in test (per sashiko). * v2: https://lore.kernel.org/bpf/20260529151351.69911-1-leon.hwang@linux.dev/ v1 -> v2: * Address sashiko's reviews: * Fix TOCTOU issue in lwt to avoid changing hdr after checks. * Add check iph->ihl < 5 in lwt to avoid infinite-loop in MIPS driver. * Update comment style in selftests with BPF comment style. * v1: https://lore.kernel.org/bpf/20260525142650.2569-1-leon.hwang@linux.dev/ Leon Hwang (2): bpf: Update transport_header when encapsulating UDP tunnel in lwt selftests/bpf: Add tests to verify the fix of encapsulating VxLAN in lwt net/core/lwt_bpf.c | 11 ++ .../selftests/bpf/prog_tests/lwt_ip_encap.c | 164 ++++++++++++++++++ .../selftests/bpf/progs/test_lwt_ip_encap.c | 112 ++++++++++++ .../bpf/progs/test_lwt_ip_encap_fix.c | 44 +++++ 4 files changed, 331 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/test_lwt_ip_encap_fix.c -- 2.54.0