Skip to content

Commit 55fb6d6

Browse files
r41k0uclaude
andcommitted
Core: Export every XDP action from pythonbpf.helper
helpers.py defined all five and return_utils mapped them, but only XDP_DROP and XDP_PASS were exported, so the xdp_tx port had to import XDP_TX from vmlinux and live under vmlinux/, skipped on any host without a generated module. It imports from pythonbpf.helper and lives under xdp/ now, returning XDP_TX bare like its siblings and the C original, which is the shape the return fast path resolves without vmlinux. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent d649327 commit 55fb6d6

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎pythonbpf/helper/__init__.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
skb_store_bytes,
1919
get_current_cgroup_id,
2020
get_stack,
21+
XDP_ABORTED,
2122
XDP_DROP,
2223
XDP_PASS,
24+
XDP_TX,
25+
XDP_REDIRECT,
2326
)
2427

2528

@@ -86,6 +89,9 @@ def helper_call_handler(call, compilation_context, builder, func, local_sym_tab)
8689
"uid",
8790
"skb_store_bytes",
8891
"get_stack",
92+
"XDP_ABORTED",
8993
"XDP_DROP",
9094
"XDP_PASS",
95+
"XDP_TX",
96+
"XDP_REDIRECT",
9197
]

‎tests/kernel_selftest_equivalent/xdp/xdp_tx.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,15 @@
33
# Bounce every packet back out of the interface it arrived on. Upstream is
44
# the transmit side of the veth XDP tests.
55
#
6-
# XDP_TX comes from vmlinux because pythonbpf.helper exports only XDP_PASS
7-
# and XDP_DROP; that is why this lives under vmlinux/.
8-
96
from pythonbpf import bpf, section, bpfglobal, compile
10-
from vmlinux import XDP_TX
7+
from pythonbpf.helper import XDP_TX
118
from ctypes import c_void_p, c_int64
129

1310

1411
@bpf
1512
@section("xdp")
1613
def xdp_tx(xdp: c_void_p) -> c_int64:
17-
return c_int64(XDP_TX)
14+
return XDP_TX # bare, like the C: resolved by the return fast path
1815

1916

2017
@bpf

0 commit comments

Comments
 (0)