aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-04-14 05:15:47 -0400
committerPatrick McHardy <kaber@trash.net>2008-04-14 05:15:47 -0400
commitca6a50749012fc17feeec91ee2f9eeacacf06f0b (patch)
treeb5dd90319ac557fedda67287576a4bb4be38347b /net/ipv4
parent535b57c7c1524125444aa1b874332f6ff1608ef5 (diff)
[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.c18
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);
105int nf_nat_proto_nlattr_to_range(struct nlattr *tb[], 105int nf_nat_proto_nlattr_to_range(struct nlattr *tb[],
106 struct nf_nat_range *range) 106 struct nf_nat_range *range)
107{ 107{
108 int ret = 0;
109
110 /* we have to return whether we actually parsed something or not */
111
112 if (tb[CTA_PROTONAT_PORT_MIN]) { 108 if (tb[CTA_PROTONAT_PORT_MIN]) {
113 ret = 1;
114 range->min.all = nla_get_be16(tb[CTA_PROTONAT_PORT_MIN]); 109 range->min.all = nla_get_be16(tb[CTA_PROTONAT_PORT_MIN]);
110 range->max.all = range->min.tcp.port;
111 range->flags |= IP_NAT_RANGE_PROTO_SPECIFIED;
115 } 112 }
116 113 if (tb[CTA_PROTONAT_PORT_MAX]) {
117 if (!tb[CTA_PROTONAT_PORT_MAX]) {
118 if (ret)
119 range->max.all = range->min.all;
120 } else {
121 ret = 1;
122 range->max.all = nla_get_be16(tb[CTA_PROTONAT_PORT_MAX]); 114 range->max.all = nla_get_be16(tb[CTA_PROTONAT_PORT_MAX]);
115 range->flags |= IP_NAT_RANGE_PROTO_SPECIFIED;
123 } 116 }
124 117 return 0;
125 return ret;
126} 118}
127EXPORT_SYMBOL_GPL(nf_nat_proto_range_to_nlattr); 119EXPORT_SYMBOL_GPL(nf_nat_proto_range_to_nlattr);
128#endif 120#endif