diff options
author | Patrick McHardy <kaber@trash.net> | 2008-04-14 13:15:47 +0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2008-04-14 13:15:47 +0400 |
commit | ca6a50749012fc17feeec91ee2f9eeacacf06f0b (patch) | |
tree | b5dd90319ac557fedda67287576a4bb4be38347b /net/ipv4 | |
parent | 535b57c7c1524125444aa1b874332f6ff1608ef5 (diff) | |
download | linux-ca6a50749012fc17feeec91ee2f9eeacacf06f0b.tar.xz |
[NETFILTER]: nf_conntrack_netlink: clean up NAT protocol parsing
Move responsibility for setting the IP_NAT_RANGE_PROTO_SPECIFIED flag
to the NAT protocol, properly propagate errors and get rid of ugly
return value convention.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_common.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/net/ipv4/netfilter/nf_nat_proto_common.c b/net/ipv4/netfilter/nf_nat_proto_common.c index ef4dc3988925..4904b86265e1 100644 --- a/net/ipv4/netfilter/nf_nat_proto_common.c +++ b/net/ipv4/netfilter/nf_nat_proto_common.c @@ -105,24 +105,16 @@ EXPORT_SYMBOL_GPL(nf_nat_proto_nlattr_to_range); int nf_nat_proto_nlattr_to_range(struct nlattr *tb[], struct nf_nat_range *range) { - int ret = 0; - - /* we have to return whether we actually parsed something or not */ - if (tb[CTA_PROTONAT_PORT_MIN]) { - ret = 1; range->min.all = nla_get_be16(tb[CTA_PROTONAT_PORT_MIN]); + range->max.all = range->min.tcp.port; + range->flags |= IP_NAT_RANGE_PROTO_SPECIFIED; } - - if (!tb[CTA_PROTONAT_PORT_MAX]) { - if (ret) - range->max.all = range->min.all; - } else { - ret = 1; + if (tb[CTA_PROTONAT_PORT_MAX]) { range->max.all = nla_get_be16(tb[CTA_PROTONAT_PORT_MAX]); + range->flags |= IP_NAT_RANGE_PROTO_SPECIFIED; } - - return ret; + return 0; } EXPORT_SYMBOL_GPL(nf_nat_proto_range_to_nlattr); #endif |