Skip to contentSkip to conversation

/proc and/or /sys file to know if ip_tables is there?

DISCUSSION Tomasz Bursztyka 2 participants 3 messages Nov 28, 2013 – Nov 29, 2013 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

I need to know reliably at runtime whether or not ip_tables is either currently loaded as a module or built-in the kernel.

Testing for /sys/module/ip_tables solves the first issue, but in case of built-in it's not usable.

I could check for ip_tables_* symbols in /proc/kallsyms but I guess it's not a nice way.

Any other proper way?

Tomasz

#1 lore raw
Quoted 5 lines · Tomasz Bursztyka

Hi,

I need to know reliably at runtime whether or not ip_tables is either currently loaded as a module or built-in the kernel.

Quoted 7 lines

Testing for /sys/module/ip_tables solves the first issue, but in case of built-in it's not usable.

I could check for ip_tables_* symbols in /proc/kallsyms but I guess it's not a nice way.

Any other proper way?

[ -f /proc/net/ip_tables_names ]

Although built in components will show up in /sys/module/ also.

Phil

#2 lore raw

Hi Phil,

Quoted 1 line

Although built in components will show up in/sys/module/ also.

I was expecting something like that, but making as built-in only ip_tables module did not. I guess I need to add other stuff too.

Thanks,

Tomasz