diff options
author | Patrick McHardy <kaber@trash.net> | 2008-04-14 05:15:47 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2008-04-14 05:15:47 -0400 |
commit | ca6a50749012fc17feeec91ee2f9eeacacf06f0b (patch) | |
tree | b5dd90319ac557fedda67287576a4bb4be38347b /net/netfilter | |
parent | 535b57c7c1524125444aa1b874332f6ff1608ef5 (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/netfilter')
-rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 4a1b42b2b7a5..79d5ecde0ddc 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -705,19 +705,10 @@ static int nfnetlink_parse_nat_proto(struct nlattr *attr, | |||
705 | return err; | 705 | return err; |
706 | 706 | ||
707 | npt = nf_nat_proto_find_get(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum); | 707 | npt = nf_nat_proto_find_get(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum); |
708 | 708 | if (npt->nlattr_to_range) | |
709 | if (!npt->nlattr_to_range) { | 709 | err = npt->nlattr_to_range(tb, range); |
710 | nf_nat_proto_put(npt); | ||
711 | return 0; | ||
712 | } | ||
713 | |||
714 | /* nlattr_to_range returns 1 if it parsed, 0 if not, neg. on error */ | ||
715 | if (npt->nlattr_to_range(tb, range) > 0) | ||
716 | range->flags |= IP_NAT_RANGE_PROTO_SPECIFIED; | ||
717 | |||
718 | nf_nat_proto_put(npt); | 710 | nf_nat_proto_put(npt); |
719 | 711 | return err; | |
720 | return 0; | ||
721 | } | 712 | } |
722 | 713 | ||
723 | static const struct nla_policy nat_nla_policy[CTA_NAT_MAX+1] = { | 714 | static const struct nla_policy nat_nla_policy[CTA_NAT_MAX+1] = { |