Skip to content

Commit

Permalink
Fix skb len calculation
Browse files Browse the repository at this point in the history
Fix a bug that prevented TCP payload to be passed to lua scripts.
  • Loading branch information
jperon authored and lneto committed Aug 13, 2024
1 parent 9dd084c commit a147522
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/luaxtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ static inline lunatik_object_t *luaxtable_getskb(lua_State *L, luaxtable_t *xtab
static int luaxtable_pushparams(lua_State *L, const struct xt_action_param *par, luaxtable_t *xtable, const struct sk_buff *skb, uint8_t opt)
{
lunatik_object_t *data = luaxtable_getskb(L, xtable);
if (data == NULL) {
pr_err("could not find skb\n");
if (unlikely(data == NULL || skb_linearize(skb) != 0)) {
pr_err("could not get skb\n");
return -1;
}
luadata_reset(data, skb->data, skb_headlen(skb), opt);
luadata_reset(data, skb->data, skb->len, opt);

lua_newtable(L);
lua_pushboolean(L, par->hotdrop);
Expand Down

0 comments on commit a147522

Please sign in to comment.