-
Notifications
You must be signed in to change notification settings - Fork 668
system/iptables: avoid trap when run "iptables -L" if configured CONF… #3295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
masc2008
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@masc2008 please fix: |
829cba5 to
2b35fe5
Compare
|
updated the commit info, please further review. |
system/iptables/iptables.c
Outdated
| #endif | ||
| #ifdef CONFIG_NET_NAT | ||
| if (strcmp(args.table, TABLE_NAME_NAT) == 0) | ||
| if (args.table == NULL || strcmp(args.table, TABLE_NAME_NAT) == 0) |
There was a problem hiding this comment.
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.
| if (args.table == NULL || strcmp(args.table, TABLE_NAME_NAT) == 0) | |
| if (args.table != NULL && strcmp(args.table, TABLE_NAME_NAT) == 0) |
There was a problem hiding this comment.
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.
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