Skip to content

Commit caec4fa

Browse files
fixup! add XDPLua
1 parent e462d21 commit caec4fa

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
@@ -4854,15 +4854,16 @@ BPF_CALL_4(bpf_lua_pcall, struct xdp_buff *, ctx, char *, funcname,
48544854
goto clean_state;
48554855
}
48564856

4857-
lua_insert(ctx->L, 1);
4857+
lua_insert(ctx->L, base + 1);
48584858
if (lua_pcall(ctx->L, num_args, num_rets, 0)) {
48594859
pr_err("%s\n", lua_tostring(ctx->L, -1));
48604860
num_rets = 0;
48614861
goto clean_state;
48624862
}
48634863

4864-
clean_state:
48654864
base += num_rets;
4865+
4866+
clean_state:
48664867
lua_settop(ctx->L, base);
48674868
return num_rets;
48684869
}

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
@@ -621,7 +621,7 @@ int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags)
621621
}
622622

623623
/* #ifdef CONFIG_XDPLUA */
624-
int bpf_set_link_xdp_lua_prog(char *lua_prog, __u32 flags)
624+
int bpf_set_link_xdp_lua_prog(char *lua_prog)
625625
{
626626
struct sockaddr_nl sa;
627627
int sock, seq = 0, len, ret = -1;
@@ -693,15 +693,6 @@ int bpf_set_link_xdp_lua_prog(char *lua_prog, __u32 flags)
693693
}
694694
nla->nla_len += nla_xdp->nla_len;
695695

696-
/* if user passed in any flags, add those too */
697-
if (flags) {
698-
nla_xdp = (struct nlattr *)((char *)nla + nla->nla_len);
699-
nla_xdp->nla_type = IFLA_XDP_FLAGS;
700-
nla_xdp->nla_len = NLA_HDRLEN + sizeof(flags);
701-
memcpy((char *)nla_xdp + NLA_HDRLEN, &flags, sizeof(flags));
702-
nla->nla_len += nla_xdp->nla_len;
703-
}
704-
705696
req.nh.nlmsg_len += NLA_ALIGN(nla->nla_len);
706697

707698
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)