|
|
4aca6e |
From afbf7fa2b6640a6d0675846459753f6e62db9704 Mon Sep 17 00:00:00 2001
|
|
|
4aca6e |
From: Phil Sutter <psutter@redhat.com>
|
|
|
4aca6e |
Date: Tue, 4 Apr 2017 16:22:21 +0200
|
|
|
4aca6e |
Subject: [PATCH] tc: m_xt: Get rid of one indentation level in parse_ipt()
|
|
|
4aca6e |
|
|
|
4aca6e |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1326726
|
|
|
4aca6e |
Upstream Status: iproute2.git commit b45f9141c2602
|
|
|
4aca6e |
Conflicts: Changes in context and replaced code due to missing upstream
|
|
|
4aca6e |
commit 32a121cba2579 ("tc: code cleanup").
|
|
|
4aca6e |
|
|
|
4aca6e |
commit b45f9141c2602de790a9fc3f0f423ed72419da24
|
|
|
4aca6e |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
4aca6e |
Date: Fri Jun 10 13:42:03 2016 +0200
|
|
|
4aca6e |
|
|
|
4aca6e |
tc: m_xt: Get rid of one indentation level in parse_ipt()
|
|
|
4aca6e |
|
|
|
4aca6e |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
4aca6e |
---
|
|
|
4aca6e |
tc/m_xt.c | 93 ++++++++++++++++++++++++++++++++-------------------------------
|
|
|
4aca6e |
1 file changed, 48 insertions(+), 45 deletions(-)
|
|
|
4aca6e |
|
|
|
4aca6e |
diff --git a/tc/m_xt.c b/tc/m_xt.c
|
|
|
4aca6e |
index 02ac4dd..bb1f929 100644
|
|
|
4aca6e |
--- a/tc/m_xt.c
|
|
|
4aca6e |
+++ b/tc/m_xt.c
|
|
|
4aca6e |
@@ -296,6 +296,7 @@ static int parse_ipt(struct action_util *a,int *argc_p,
|
|
|
4aca6e |
static int
|
|
|
4aca6e |
print_ipt(struct action_util *au,FILE * f, struct rtattr *arg)
|
|
|
4aca6e |
{
|
|
|
4aca6e |
+ struct xtables_target *m;
|
|
|
4aca6e |
struct rtattr *tb[TCA_IPT_MAX + 1];
|
|
|
4aca6e |
struct xt_entry_target *t = NULL;
|
|
|
4aca6e |
struct option *opts = NULL;
|
|
|
4aca6e |
@@ -330,58 +331,60 @@ print_ipt(struct action_util *au,FILE * f, struct rtattr *arg)
|
|
|
4aca6e |
if (tb[TCA_IPT_TARG] == NULL) {
|
|
|
4aca6e |
fprintf(f, "\t[NULL ipt target parameters ] \n");
|
|
|
4aca6e |
return -1;
|
|
|
4aca6e |
- } else {
|
|
|
4aca6e |
- struct xtables_target *m = NULL;
|
|
|
4aca6e |
- t = RTA_DATA(tb[TCA_IPT_TARG]);
|
|
|
4aca6e |
- m = xtables_find_target(t->u.user.name, XTF_TRY_LOAD);
|
|
|
4aca6e |
- if (!m) {
|
|
|
4aca6e |
- fprintf(stderr, " failed to find target %s\n\n",
|
|
|
4aca6e |
- t->u.user.name);
|
|
|
4aca6e |
- return -1;
|
|
|
4aca6e |
- }
|
|
|
4aca6e |
- if (build_st(m, t) < 0) {
|
|
|
4aca6e |
- fprintf(stderr, " %s error\n", m->name);
|
|
|
4aca6e |
- return -1;
|
|
|
4aca6e |
- }
|
|
|
4aca6e |
+ }
|
|
|
4aca6e |
+
|
|
|
4aca6e |
+ t = RTA_DATA(tb[TCA_IPT_TARG]);
|
|
|
4aca6e |
+ m = xtables_find_target(t->u.user.name, XTF_TRY_LOAD);
|
|
|
4aca6e |
+ if (!m) {
|
|
|
4aca6e |
+ fprintf(stderr, " failed to find target %s\n\n",
|
|
|
4aca6e |
+ t->u.user.name);
|
|
|
4aca6e |
+ return -1;
|
|
|
4aca6e |
+ }
|
|
|
4aca6e |
+ if (build_st(m, t) < 0) {
|
|
|
4aca6e |
+ fprintf(stderr, " %s error\n", m->name);
|
|
|
4aca6e |
+ return -1;
|
|
|
4aca6e |
+ }
|
|
|
4aca6e |
|
|
|
4aca6e |
#if (XTABLES_VERSION_CODE >= 6)
|
|
|
4aca6e |
- opts = xtables_options_xfrm(tmp_tcipt_globals.orig_opts,
|
|
|
4aca6e |
- tmp_tcipt_globals.opts,
|
|
|
4aca6e |
- m->x6_options,
|
|
|
4aca6e |
- &m->option_offset);
|
|
|
4aca6e |
+ opts = xtables_options_xfrm(tmp_tcipt_globals.orig_opts,
|
|
|
4aca6e |
+ tmp_tcipt_globals.opts,
|
|
|
4aca6e |
+ m->x6_options,
|
|
|
4aca6e |
+ &m->option_offset);
|
|
|
4aca6e |
#else
|
|
|
4aca6e |
- opts = xtables_merge_options(tmp_tcipt_globals.opts,
|
|
|
4aca6e |
- m->extra_opts,
|
|
|
4aca6e |
- &m->option_offset);
|
|
|
4aca6e |
+ opts = xtables_merge_options(tmp_tcipt_globals.opts,
|
|
|
4aca6e |
+ m->extra_opts,
|
|
|
4aca6e |
+ &m->option_offset);
|
|
|
4aca6e |
#endif
|
|
|
4aca6e |
- if (opts == NULL) {
|
|
|
4aca6e |
- fprintf(stderr, " failed to find additional options for target %s\n\n", optarg);
|
|
|
4aca6e |
- return -1;
|
|
|
4aca6e |
- } else
|
|
|
4aca6e |
- tmp_tcipt_globals.opts = opts;
|
|
|
4aca6e |
- fprintf(f, "\ttarget ");
|
|
|
4aca6e |
- m->print(NULL, m->t, 0);
|
|
|
4aca6e |
- if (tb[TCA_IPT_INDEX] == NULL) {
|
|
|
4aca6e |
- fprintf(f, " [NULL ipt target index ]\n");
|
|
|
4aca6e |
- } else {
|
|
|
4aca6e |
- __u32 index;
|
|
|
4aca6e |
- index = rta_getattr_u32(tb[TCA_IPT_INDEX]);
|
|
|
4aca6e |
- fprintf(f, " \n\tindex %d", index);
|
|
|
4aca6e |
- }
|
|
|
4aca6e |
+ if (opts == NULL) {
|
|
|
4aca6e |
+ fprintf(stderr, " failed to find additional options for target %s\n\n", optarg);
|
|
|
4aca6e |
+ return -1;
|
|
|
4aca6e |
+ } else
|
|
|
4aca6e |
+ tmp_tcipt_globals.opts = opts;
|
|
|
4aca6e |
+ fprintf(f, "\ttarget ");
|
|
|
4aca6e |
+ m->print(NULL, m->t, 0);
|
|
|
4aca6e |
+ if (tb[TCA_IPT_INDEX] == NULL) {
|
|
|
4aca6e |
+ fprintf(f, " [NULL ipt target index ]\n");
|
|
|
4aca6e |
+ } else {
|
|
|
4aca6e |
+ __u32 index;
|
|
|
4aca6e |
|
|
|
4aca6e |
- if (tb[TCA_IPT_CNT]) {
|
|
|
4aca6e |
- struct tc_cnt *c = RTA_DATA(tb[TCA_IPT_CNT]);;
|
|
|
4aca6e |
- fprintf(f, " ref %d bind %d", c->refcnt, c->bindcnt);
|
|
|
4aca6e |
- }
|
|
|
4aca6e |
- if (show_stats) {
|
|
|
4aca6e |
- if (tb[TCA_IPT_TM]) {
|
|
|
4aca6e |
- struct tcf_t *tm = RTA_DATA(tb[TCA_IPT_TM]);
|
|
|
4aca6e |
- print_tm(f,tm);
|
|
|
4aca6e |
- }
|
|
|
4aca6e |
- }
|
|
|
4aca6e |
- fprintf(f, " \n");
|
|
|
4aca6e |
+ index = rta_getattr_u32(tb[TCA_IPT_INDEX]);
|
|
|
4aca6e |
+ fprintf(f, "\n\tindex %d", index);
|
|
|
4aca6e |
+ }
|
|
|
4aca6e |
|
|
|
4aca6e |
+ if (tb[TCA_IPT_CNT]) {
|
|
|
4aca6e |
+ struct tc_cnt *c = RTA_DATA(tb[TCA_IPT_CNT]);
|
|
|
4aca6e |
+
|
|
|
4aca6e |
+ fprintf(f, " ref %d bind %d", c->refcnt, c->bindcnt);
|
|
|
4aca6e |
}
|
|
|
4aca6e |
+ if (show_stats) {
|
|
|
4aca6e |
+ if (tb[TCA_IPT_TM]) {
|
|
|
4aca6e |
+ struct tcf_t *tm = RTA_DATA(tb[TCA_IPT_TM]);
|
|
|
4aca6e |
+
|
|
|
4aca6e |
+ print_tm(f, tm);
|
|
|
4aca6e |
+ }
|
|
|
4aca6e |
+ }
|
|
|
4aca6e |
+ fprintf(f, "\n");
|
|
|
4aca6e |
+
|
|
|
4aca6e |
xtables_free_opts(1);
|
|
|
4aca6e |
|
|
|
4aca6e |
return 0;
|
|
|
4aca6e |
--
|
|
|
4aca6e |
1.8.3.1
|
|
|
4aca6e |
|