aboutsummaryrefslogtreecommitdiffstats
path: root/tc/m_xt.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2016-06-10 13:42:00 +0200
committerStephen Hemminger <shemming@brocade.com>2016-06-14 14:35:56 -0700
commit445745221a21ecb4111c19cfa7f4c2cf4796337f (patch)
tree2b1ca4deb3a6e28858feccd383087735f84fc12f /tc/m_xt.c
parent8b625177ba69985be6673e776c54f45ab8d40e58 (diff)
downloadplatform_external_iproute2-445745221a21ecb4111c19cfa7f4c2cf4796337f.tar.gz
platform_external_iproute2-445745221a21ecb4111c19cfa7f4c2cf4796337f.tar.bz2
platform_external_iproute2-445745221a21ecb4111c19cfa7f4c2cf4796337f.zip
tc: m_xt: Prevent segfault with standard targets
Iptables standard targets like DROP or REJECT don't implement the print callback in libxtables. Hence the following command would segfault: | tc filter add dev d0 parent ffff: u32 match u32 0 0 action xt -j DROP With this patch standard targets still can't be used (and are not really useful anyway), but at least it doesn't crash anymore. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tc/m_xt.c')
-rw-r--r--tc/m_xt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tc/m_xt.c b/tc/m_xt.c
index c3f866df..62ec6d7f 100644
--- a/tc/m_xt.c
+++ b/tc/m_xt.c
@@ -250,8 +250,12 @@ static int parse_ipt(struct action_util *a, int *argc_p,
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
fprintf(stdout, "\ttarget: ");
- if (m)
- m->print(NULL, m->t, 0);
+ if (m) {
+ if (m->print)
+ m->print(NULL, m->t, 0);
+ else
+ printf("%s ", m->name);
+ }
fprintf(stdout, " index %d\n", index);
if (strlen(tname) > 16) {