Signed-off-by: Asbjørn Sloth Tønnesen <[email protected]>
---
src/conntrack.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/conntrack.c b/src/conntrack.c
index cb9545b..3fc9c24 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -1017,10 +1017,16 @@ parse_addr(const char *cp, union ct_address *address)
struct addr_parse parse;
int ret;
- if ((ret = parse_inetaddr(cp, &parse)) == AF_INET)
+ ret = parse_inetaddr(cp, &parse);
+
+ switch(ret) {
+ case AF_INET:
address->v4 = parse.addr.s_addr;
- else if (ret == AF_INET6)
+ break;
+ case AF_INET6:
memcpy(address->v6, &parse.addr6, sizeof(parse.addr6));
+ break;
+ }
return ret;
}
@@ -1966,14 +1972,17 @@ nfct_set_addr_from_opt(int opt, struct nf_conntrack
*ct, union ct_address *ad,
"Invalid IP address `%s'", optarg);
}
set_family(family, l3protonum);
- if (l3protonum == AF_INET) {
+ switch(l3protonum) {
+ case AF_INET:
nfct_set_attr_u32(ct,
- opt2family_attr[opt][0],
- ad->v4);
- } else if (l3protonum == AF_INET6) {
+ opt2family_attr[opt][0],
+ ad->v4);
+ break;
+ case AF_INET6:
nfct_set_attr(ct,
- opt2family_attr[opt][1],
- &ad->v6);
+ opt2family_attr[opt][1],
+ &ad->v6);
+ break;
}
nfct_set_attr_u8(ct, opt2attr[opt], l3protonum);
}
--
2.6.4
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html