Skip to content

Commit 7570419

Browse files
committed
nettrace: compatible with xtables
Signed-off-by: Menglong Dong <imagedong@tencent.com>
1 parent 0d4d6d4 commit 7570419

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/progs/core.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,17 @@ DEFINE_KPROBE_INIT(__netif_receive_skb_core_pskb,
274274
static try_inline int bpf_ipt_do_table(context_t *ctx, struct xt_table *table,
275275
struct nf_hook_state *state)
276276
{
277+
char *table_name;
277278
DECLARE_EVENT(nf_event_t, e, .hook = _C(state, hook))
278279

279-
bpf_probe_read(e->table, sizeof(e->table) - 1, _C(table, name));
280+
#ifndef COMPAT_MODE
281+
if (bpf_core_type_exists(struct xt_table))
282+
table_name = _C(table, name);
283+
else
284+
#endif
285+
table_name = _(table->name);
286+
287+
bpf_probe_read(e->table, sizeof(e->table) - 1, table_name);
280288
return handle_entry(ctx);
281289
}
282290

0 commit comments

Comments
 (0)