summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2016-03-04 12:26:30 +0100
committerPatrick McHardy <kaber@trash.net>2016-03-04 12:26:30 +0100
commitd408ba1a864190a6b8d6756010de8c3564a53719 (patch)
tree4fc76f0a00d0b0149fa82c23d3ca299351d7f505
parentaf0c18267083714cbf2dfeb76de9106003b81098 (diff)
trace: fix multiple copy and paste errors
Fix duplicated and incorrect assignments. Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--src/trace.c51
1 files changed, 13 insertions, 38 deletions
diff --git a/src/trace.c b/src/trace.c
index b04abb5..9655f0a 100644
--- a/src/trace.c
+++ b/src/trace.c
@@ -333,11 +333,6 @@ int nftnl_trace_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_trace *t)
if (!tb[NFTA_TRACE_TYPE])
abi_breakage();
- if (tb[NFTA_TRACE_TABLE])
- t->table = strdup(mnl_attr_get_str(tb[NFTA_TRACE_TABLE]));
- if (tb[NFTA_TRACE_CHAIN])
- t->chain = strdup(mnl_attr_get_str(tb[NFTA_TRACE_CHAIN]));
-
t->family = nfg->nfgen_family;
t->flags |= (1 << NFTNL_TRACE_FAMILY);
@@ -347,6 +342,16 @@ int nftnl_trace_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_trace *t)
t->id = ntohl(mnl_attr_get_u32(tb[NFTA_TRACE_ID]));
t->flags |= (1 << NFTNL_TRACE_ID);
+ if (tb[NFTA_TRACE_TABLE]) {
+ t->table = strdup(mnl_attr_get_str(tb[NFTA_TRACE_TABLE]));
+ t->flags |= (1 << NFTNL_TRACE_TABLE);
+ }
+
+ if (tb[NFTA_TRACE_CHAIN]) {
+ t->chain = strdup(mnl_attr_get_str(tb[NFTA_TRACE_CHAIN]));
+ t->flags |= (1 << NFTNL_TRACE_CHAIN);
+ }
+
if (tb[NFTA_TRACE_IIFTYPE]) {
t->iiftype = ntohs(mnl_attr_get_u16(tb[NFTA_TRACE_IIFTYPE]));
t->flags |= (1 << NFTNL_TRACE_IIFTYPE);
@@ -358,7 +363,7 @@ int nftnl_trace_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_trace *t)
}
if (tb[NFTA_TRACE_OIFTYPE]) {
- t->iiftype = ntohs(mnl_attr_get_u16(tb[NFTA_TRACE_OIFTYPE]));
+ t->oiftype = ntohs(mnl_attr_get_u16(tb[NFTA_TRACE_OIFTYPE]));
t->flags |= (1 << NFTNL_TRACE_OIFTYPE);
}
@@ -390,49 +395,19 @@ int nftnl_trace_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_trace *t)
t->flags |= (1 << NFTNL_TRACE_TRANSPORT_HEADER);
if (tb[NFTA_TRACE_NFPROTO]) {
- t->iiftype = ntohs(mnl_attr_get_u16(tb[NFTA_TRACE_NFPROTO]));
+ t->nfproto = ntohs(mnl_attr_get_u16(tb[NFTA_TRACE_NFPROTO]));
t->flags |= (1 << NFTNL_TRACE_NFPROTO);
}
if (tb[NFTA_TRACE_POLICY]) {
- t->iiftype = ntohs(mnl_attr_get_u16(tb[NFTA_TRACE_POLICY]));
+ t->policy = ntohs(mnl_attr_get_u16(tb[NFTA_TRACE_POLICY]));
t->flags |= (1 << NFTNL_TRACE_POLICY);
}
- if (tb[NFTA_TRACE_OIF]) {
- t->oif = ntohl(mnl_attr_get_u32(tb[NFTA_TRACE_OIF]));
- t->flags |= (1 << NFTNL_TRACE_OIF);
- }
-
if (tb[NFTA_TRACE_MARK]) {
t->mark = ntohl(mnl_attr_get_u32(tb[NFTA_TRACE_MARK]));
t->flags |= (1 << NFTNL_TRACE_MARK);
}
- if (tb[NFTA_TRACE_RULE_HANDLE]) {
- t->rule_handle = be64toh(mnl_attr_get_u64(tb[NFTA_TRACE_RULE_HANDLE]));
- t->flags |= (1 << NFTNL_TRACE_RULE_HANDLE);
- }
-
- if (tb[NFTA_TRACE_VERDICT])
- nftnl_trace_parse_verdict(tb[NFTA_TRACE_VERDICT], t);
-
- if (nftnl_trace_nlmsg_parse_hdrdata(tb[NFTA_TRACE_LL_HEADER], &t->ll))
- t->flags |= (1 << NFTNL_TRACE_LL_HEADER);
-
- if (nftnl_trace_nlmsg_parse_hdrdata(tb[NFTA_TRACE_NETWORK_HEADER], &t->nh))
- t->flags |= (1 << NFTNL_TRACE_NETWORK_HEADER);
-
- if (nftnl_trace_nlmsg_parse_hdrdata(tb[NFTA_TRACE_TRANSPORT_HEADER], &t->th))
- t->flags |= (1 << NFTNL_TRACE_TRANSPORT_HEADER);
-
- if (t->chain)
- t->flags |= (1 << NFTNL_TRACE_CHAIN);
-
- if (t->chain)
- t->flags |= (1 << NFTNL_TRACE_CHAIN);
- if (t->table)
- t->flags |= (1 << NFTNL_TRACE_TABLE);
-
return 0;
}