Skip to content

Commit b355385

Browse files
fixup! add XDPLua
1 parent 06ca994 commit b355385

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

net/core/filter.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4859,15 +4859,16 @@ BPF_CALL_4(bpf_lua_pcall, struct xdp_buff *, ctx, char *, funcname,
48594859
goto clean_state;
48604860
}
48614861

4862-
lua_insert(ctx->L, 1);
4862+
lua_insert(ctx->L, base + 1);
48634863
if (lua_pcall(ctx->L, num_args, num_rets, 0)) {
48644864
pr_err("%s\n", lua_tostring(ctx->L, -1));
48654865
num_rets = 0;
48664866
goto clean_state;
48674867
}
48684868

4869-
clean_state:
48704869
base += num_rets;
4870+
4871+
clean_state:
48714872
lua_settop(ctx->L, base);
48724873
return num_rets;
48734874
}

samples/bpf/xdplua_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static int do_attach_lua(const char *name, char *lua_prog)
8181
{
8282
int err;
8383

84-
err = bpf_set_link_xdp_lua_prog(lua_prog, 0);
84+
err = bpf_set_link_xdp_lua_prog(lua_prog);
8585
if (err < 0)
8686
fprintf(stderr, "ERROR: failed to attach lua script to %s\n", name);
8787

tools/lib/bpf/bpf.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags)
643643
}
644644

645645
/* #ifdef CONFIG_XDPLUA */
646-
int bpf_set_link_xdp_lua_prog(char *lua_prog, __u32 flags)
646+
int bpf_set_link_xdp_lua_prog(char *lua_prog)
647647
{
648648
struct sockaddr_nl sa;
649649
int sock, seq = 0, len, ret = -1;
@@ -715,15 +715,6 @@ int bpf_set_link_xdp_lua_prog(char *lua_prog, __u32 flags)
715715
}
716716
nla->nla_len += nla_xdp->nla_len;
717717

718-
/* if user passed in any flags, add those too */
719-
if (flags) {
720-
nla_xdp = (struct nlattr *)((char *)nla + nla->nla_len);
721-
nla_xdp->nla_type = IFLA_XDP_FLAGS;
722-
nla_xdp->nla_len = NLA_HDRLEN + sizeof(flags);
723-
memcpy((char *)nla_xdp + NLA_HDRLEN, &flags, sizeof(flags));
724-
nla->nla_len += nla_xdp->nla_len;
725-
}
726-
727718
req.nh.nlmsg_len += NLA_ALIGN(nla->nla_len);
728719

729720
if (send(sock, &req, req.nh.nlmsg_len, 0) < 0) {

tools/lib/bpf/libbpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ int bpf_prog_load(const char *file, enum bpf_prog_type type,
285285

286286
int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags);
287287
/* #ifdef CONFIG_XDP_LUA */
288-
int bpf_set_link_xdp_lua_prog(char *lua_prog, __u32 flags);
288+
int bpf_set_link_xdp_lua_prog(char *lua_prog);
289289
/* #endif CONFIG_XDP_LUA */
290290

291291
enum bpf_perf_event_ret {

0 commit comments

Comments
 (0)