From: Jamal Hadi Salim
Fix a few stylistic things that hurt my eyes while at it.
Signed-off-by: Jamal Hadi Salim
---
tc/f_basic.c| 6 +++---
tc/f_bpf.c | 6 +++---
tc/f_cgroup.c | 7 +++
tc/f_flow.c | 4 ++--
tc/f_flower.c | 5 +++--
tc/f_fw.c | 38 ++
tc/f_matchall.c | 6 +++---
tc/f_route.c| 29 ++---
tc/f_rsvp.c | 28 ++--
tc/f_tcindex.c | 4 +++-
tc/f_u32.c | 9 -
11 files changed, 82 insertions(+), 60 deletions(-)
diff --git a/tc/f_basic.c b/tc/f_basic.c
index d663668..317dca1 100644
--- a/tc/f_basic.c
+++ b/tc/f_basic.c
@@ -112,14 +112,14 @@ static int basic_print_opt(struct filter_util *qu, FILE
*f,
{
struct rtattr *tb[TCA_BASIC_MAX+1];
+ if (handle)
+ fprintf(f, "handle 0x%x ", handle);
+
if (opt == NULL)
return 0;
parse_rtattr_nested(tb, TCA_BASIC_MAX, opt);
- if (handle)
- fprintf(f, "handle 0x%x ", handle);
-
if (tb[TCA_BASIC_CLASSID]) {
SPRINT_BUF(b1);
fprintf(f, "flowid %s ",
diff --git a/tc/f_bpf.c b/tc/f_bpf.c
index 5c97c86..a7dd2f2 100644
--- a/tc/f_bpf.c
+++ b/tc/f_bpf.c
@@ -152,14 +152,14 @@ static int bpf_print_opt(struct filter_util *qu, FILE *f,
{
struct rtattr *tb[TCA_BPF_MAX + 1];
+ if (handle)
+ fprintf(f, "handle 0x%x ", handle);
+
if (opt == NULL)
return 0;
parse_rtattr_nested(tb, TCA_BPF_MAX, opt);
- if (handle)
- fprintf(f, "handle 0x%x ", handle);
-
if (tb[TCA_BPF_CLASSID]) {
SPRINT_BUF(b1);
fprintf(f, "flowid %s ",
diff --git a/tc/f_cgroup.c b/tc/f_cgroup.c
index ecf9909..ae798db 100644
--- a/tc/f_cgroup.c
+++ b/tc/f_cgroup.c
@@ -85,14 +85,13 @@ static int cgroup_print_opt(struct filter_util *qu, FILE *f,
{
struct rtattr *tb[TCA_CGROUP_MAX+1];
+ if (handle)
+ fprintf(f, "handle 0x%x ", handle);
+
if (opt == NULL)
return 0;
parse_rtattr_nested(tb, TCA_CGROUP_MAX, opt);
-
- if (handle)
- fprintf(f, "handle 0x%x ", handle);
-
if (tb[TCA_CGROUP_EMATCHES])
print_ematch(f, tb[TCA_CGROUP_EMATCHES]);
diff --git a/tc/f_flow.c b/tc/f_flow.c
index 09ddcaa..5a9948f 100644
--- a/tc/f_flow.c
+++ b/tc/f_flow.c
@@ -272,13 +272,13 @@ static int flow_print_opt(struct filter_util *fu, FILE
*f, struct rtattr *opt,
unsigned int i;
__u32 mask = ~0, val = 0;
+ fprintf(f, "handle 0x%x ", handle);
+
if (opt == NULL)
return -EINVAL;
parse_rtattr_nested(tb, TCA_FLOW_MAX, opt);
- fprintf(f, "handle 0x%x ", handle);
-
if (tb[TCA_FLOW_MODE]) {
__u32 mode = rta_getattr_u32(tb[TCA_FLOW_MODE]);
diff --git a/tc/f_flower.c b/tc/f_flower.c
index 791ade7..2f566ec 100644
--- a/tc/f_flower.c
+++ b/tc/f_flower.c
@@ -456,13 +456,14 @@ static int flower_print_opt(struct filter_util *qu, FILE
*f,
__be16 eth_type = 0;
__u8 ip_proto = 0xff;
+ if (handle)
+ fprintf(f, "handle 0x%x ", handle);
+
if (!opt)
return 0;
parse_rtattr_nested(tb, TCA_FLOWER_MAX, opt);
- if (handle)
- fprintf(f, "handle 0x%x ", handle);
if (tb[TCA_FLOWER_CLASSID]) {
SPRINT_BUF(b1);
diff --git a/tc/f_fw.c b/tc/f_fw.c
index 29c9854..f779c16 100644
--- a/tc/f_fw.c
+++ b/tc/f_fw.c
@@ -115,37 +115,42 @@ static int fw_parse_opt(struct filter_util *qu, char
*handle, int argc, char **a
return 0;
}
-static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
__u32 handle)
+static int fw_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
+ __u32 handle)
{
struct rtattr *tb[TCA_FW_MAX+1];
+ __u32 mark = 0, mask = 0;
- if (opt == NULL)
- return 0;
+ if (opt) {
+ parse_rtattr_nested(tb, TCA_FW_MAX, opt);
+ if (tb[TCA_FW_MASK]) {
+ __u32 tmask = rta_getattr_u32(tb[TCA_FW_MASK]);
- parse_rtattr_nested(tb, TCA_FW_MAX, opt);
+ if (tmask != 0x)
+ mask = tmask;
+ }
+ }
- if (handle || tb[TCA_FW_MASK]) {
- __u32 mark = 0, mask = 0;
+ if (mask)
+ fprintf(f, "handle 0x%x/0x%x ", mark, mask);
+ else
+ fprintf(f, "handle 0x%x ", handle);
- if (handle)
- mark = handle;
- if (tb[TCA_FW_MASK] &&
- (mask = rta_getattr_u32(tb[TCA_FW_MASK])) != 0x)
- fprintf(f, "handle 0x%x/0x%x ", mark, mask);
- else
-