Skip to content

Conversation

@masc2008
Copy link

@masc2008 masc2008 commented Jan 1, 2026

avoid trap when run "iptables -L" if configured CONFIG_NET_NAT while not configured CONFIG_NET_IPFILTER
It's a trap happen everytime.

It's a trap happen everytime.

it can fix issue: #3294

Copy link
Author

@masc2008 masc2008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[BUG] trap when run "iptables -L" if configured CONFIG_NET_NAT while not configure CONFIG_NET_IPFILTER #3294 #3294

@xiaoxiang781216
Copy link
Contributor

@masc2008 please fix:

../nuttx/tools/checkpatch.sh -c -u -m -g 85539a1223c4770ee36e68817f5bfe91e6b49369..HEAD
❌ Commit subject too long > 80
❌ Missing Signed-off-by
Used config files:
    1: .codespellrc
Some checks failed. For contributing guidelines, see:

@masc2008 masc2008 force-pushed the master branch 3 times, most recently from 829cba5 to 2b35fe5 Compare January 1, 2026 09:43
@masc2008
Copy link
Author

masc2008 commented Jan 1, 2026

updated the commit info, please further review.

#endif
#ifdef CONFIG_NET_NAT
if (strcmp(args.table, TABLE_NAME_NAT) == 0)
if (args.table == NULL || strcmp(args.table, TABLE_NAME_NAT) == 0)
Copy link
Contributor

@hartmannathan hartmannathan Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure I understand correctly: If args.table is NULL, it's OK to call iptables_apply()? Note that in iptables_apply(), COMMAND_FLUSH, COMMAND_LIST, and COMMAND_POLICY will try to access args->table. It's possible other commands also will try, but I didn't dig further. If this was unintended, the line could be changed as follows, which will prevent calling iptables_apply() if args.table is NULL.

Suggested change
if (args.table == NULL || strcmp(args.table, TABLE_NAME_NAT) == 0)
if (args.table != NULL && strcmp(args.table, TABLE_NAME_NAT) == 0)

Copy link
Author

@masc2008 masc2008 Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be more near to the standard behavior, thanks!

It's a trap happen everytime if configured CONFIG_NET_NAT while not configured CONFIG_NET_IPFILTER.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] trap when run "iptables -L" if configured CONFIG_NET_NAT while not configure CONFIG_NET_IPFILTER

3 participants