|
|
4aca6e |
From cadd480c74b11f0510aa56d9ee9f58c7fd7c094d Mon Sep 17 00:00:00 2001
|
|
|
4aca6e |
From: Phil Sutter <psutter@redhat.com>
|
|
|
4aca6e |
Date: Tue, 4 Apr 2017 16:21:45 +0200
|
|
|
4aca6e |
Subject: [PATCH] tc: m_xt: Prevent segfault with standard targets
|
|
|
4aca6e |
|
|
|
4aca6e |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726
|
|
|
4aca6e |
Upstream Status: iproute2.git commit 445745221a21e
|
|
|
4aca6e |
|
|
|
4aca6e |
commit 445745221a21ecb4111c19cfa7f4c2cf4796337f
|
|
|
4aca6e |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
4aca6e |
Date: Fri Jun 10 13:42:00 2016 +0200
|
|
|
4aca6e |
|
|
|
4aca6e |
tc: m_xt: Prevent segfault with standard targets
|
|
|
4aca6e |
|
|
|
4aca6e |
Iptables standard targets like DROP or REJECT don't implement the print
|
|
|
4aca6e |
callback in libxtables. Hence the following command would segfault:
|
|
|
4aca6e |
|
|
|
4aca6e |
| tc filter add dev d0 parent ffff: u32 match u32 0 0 action xt -j DROP
|
|
|
4aca6e |
|
|
|
4aca6e |
With this patch standard targets still can't be used (and are not really
|
|
|
4aca6e |
useful anyway), but at least it doesn't crash anymore.
|
|
|
4aca6e |
|
|
|
4aca6e |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
4aca6e |
---
|
|
|
4aca6e |
tc/m_xt.c | 8 ++++++--
|
|
|
4aca6e |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/tc/m_xt.c b/tc/m_xt.c
|
|
|
4aca6e |
index 537daf8..aa83061 100644
|
|
|
4aca6e |
--- a/tc/m_xt.c
|
|
|
4aca6e |
+++ b/tc/m_xt.c
|
|
|
4aca6e |
@@ -248,8 +248,12 @@ static int parse_ipt(struct action_util *a,int *argc_p,
|
|
|
4aca6e |
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
|
|
|
4aca6e |
fprintf(stdout, "\ttarget: ");
|
|
|
4aca6e |
|
|
|
4aca6e |
- if (m)
|
|
|
4aca6e |
- m->print(NULL, m->t, 0);
|
|
|
4aca6e |
+ if (m) {
|
|
|
4aca6e |
+ if (m->print)
|
|
|
4aca6e |
+ m->print(NULL, m->t, 0);
|
|
|
4aca6e |
+ else
|
|
|
4aca6e |
+ printf("%s ", m->name);
|
|
|
4aca6e |
+ }
|
|
|
4aca6e |
fprintf(stdout, " index %d\n", index);
|
|
|
4aca6e |
|
|
|
4aca6e |
if (strlen(tname) > 16) {
|
|
|
4aca6e |
--
|
|
|
4aca6e |
1.8.3.1
|
|
|
4aca6e |
|