netfilter: nf_nat: make unique_tuple return void
authorChangli Gao <xiaosuo@gmail.com>
Mon, 2 Aug 2010 15:20:54 +0000 (17:20 +0200)
committerPatrick McHardy <kaber@trash.net>
Mon, 2 Aug 2010 15:20:54 +0000 (17:20 +0200)
The only user of unique_tuple() get_unique_tuple() doesn't care about the
return value of unique_tuple(), so make unique_tuple() return void (nothing).

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
include/net/netfilter/nf_nat_protocol.h
net/ipv4/netfilter/nf_nat_proto_common.c
net/ipv4/netfilter/nf_nat_proto_dccp.c
net/ipv4/netfilter/nf_nat_proto_gre.c
net/ipv4/netfilter/nf_nat_proto_icmp.c
net/ipv4/netfilter/nf_nat_proto_sctp.c
net/ipv4/netfilter/nf_nat_proto_tcp.c
net/ipv4/netfilter/nf_nat_proto_udp.c
net/ipv4/netfilter/nf_nat_proto_udplite.c
net/ipv4/netfilter/nf_nat_proto_unknown.c

index c398017ccfa3d364e1d43b5b541405f0a1f575e4..df17bac46bf5ef81cc4a1f3114e99eb54a913758 100644 (file)
@@ -27,9 +27,9 @@ struct nf_nat_protocol {
 
        /* Alter the per-proto part of the tuple (depending on
           maniptype), to give a unique tuple in the given range if
-          possible; return false if not.  Per-protocol part of tuple
-          is initialized to the incoming packet. */
-       bool (*unique_tuple)(struct nf_conntrack_tuple *tuple,
+          possible.  Per-protocol part of tuple is initialized to the
+          incoming packet. */
+       void (*unique_tuple)(struct nf_conntrack_tuple *tuple,
                             const struct nf_nat_range *range,
                             enum nf_nat_manip_type maniptype,
                             const struct nf_conn *ct);
@@ -63,7 +63,7 @@ extern bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple,
                                  const union nf_conntrack_man_proto *min,
                                  const union nf_conntrack_man_proto *max);
 
-extern bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
+extern void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
                                      const struct nf_nat_range *range,
                                      enum nf_nat_manip_type maniptype,
                                      const struct nf_conn *ct,
index 6c4f11f514461a5a244ba1d70180f42ad82940b4..2844a0383a11f05f640c6abcffbd63e45466f256 100644 (file)
@@ -34,7 +34,7 @@ bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple,
 }
 EXPORT_SYMBOL_GPL(nf_nat_proto_in_range);
 
-bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
+void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
                               const struct nf_nat_range *range,
                               enum nf_nat_manip_type maniptype,
                               const struct nf_conn *ct,
@@ -53,7 +53,7 @@ bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
        if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)) {
                /* If it's dst rewrite, can't change port */
                if (maniptype == IP_NAT_MANIP_DST)
-                       return false;
+                       return;
 
                if (ntohs(*portptr) < 1024) {
                        /* Loose convention: >> 512 is credential passing */
@@ -87,9 +87,9 @@ bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
                        continue;
                if (!(range->flags & IP_NAT_RANGE_PROTO_RANDOM))
                        *rover = off;
-               return true;
+               return;
        }
-       return false;
+       return;
 }
 EXPORT_SYMBOL_GPL(nf_nat_proto_unique_tuple);
 
index 22485ce306d41f2d175786bdc9fc7f20160306e2..570faf2667b26e70f3f7ddc6e2f9c89cdbfdcfd9 100644 (file)
 
 static u_int16_t dccp_port_rover;
 
-static bool
+static void
 dccp_unique_tuple(struct nf_conntrack_tuple *tuple,
                  const struct nf_nat_range *range,
                  enum nf_nat_manip_type maniptype,
                  const struct nf_conn *ct)
 {
-       return nf_nat_proto_unique_tuple(tuple, range, maniptype, ct,
-                                        &dccp_port_rover);
+       nf_nat_proto_unique_tuple(tuple, range, maniptype, ct,
+                                 &dccp_port_rover);
 }
 
 static bool
index d7e89201351e90d01bbbac1666e913f90e036dbf..89933ab6f63ee5170bd493af721fc20f091b2c5e 100644 (file)
@@ -37,7 +37,7 @@ MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
 MODULE_DESCRIPTION("Netfilter NAT protocol helper module for GRE");
 
 /* generate unique tuple ... */
-static bool
+static void
 gre_unique_tuple(struct nf_conntrack_tuple *tuple,
                 const struct nf_nat_range *range,
                 enum nf_nat_manip_type maniptype,
@@ -50,7 +50,7 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple,
        /* If there is no master conntrack we are not PPTP,
           do not change tuples */
        if (!ct->master)
-               return false;
+               return;
 
        if (maniptype == IP_NAT_MANIP_SRC)
                keyptr = &tuple->src.u.gre.key;
@@ -71,11 +71,11 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple,
        for (i = 0; i < range_size; i++, key++) {
                *keyptr = htons(min + key % range_size);
                if (!nf_nat_used_tuple(tuple, ct))
-                       return true;
+                       return;
        }
 
        pr_debug("%p: no NAT mapping\n", ct);
-       return false;
+       return;
 }
 
 /* manipulate a GRE packet according to maniptype */
index 19a8b0b07d8e7d80620446939e80aa3966c84ace..97003fe312e3fd67320ac392d837428450e44a90 100644 (file)
@@ -27,7 +27,7 @@ icmp_in_range(const struct nf_conntrack_tuple *tuple,
               ntohs(tuple->src.u.icmp.id) <= ntohs(max->icmp.id);
 }
 
-static bool
+static void
 icmp_unique_tuple(struct nf_conntrack_tuple *tuple,
                  const struct nf_nat_range *range,
                  enum nf_nat_manip_type maniptype,
@@ -46,9 +46,9 @@ icmp_unique_tuple(struct nf_conntrack_tuple *tuple,
                tuple->src.u.icmp.id = htons(ntohs(range->min.icmp.id) +
                                             (id % range_size));
                if (!nf_nat_used_tuple(tuple, ct))
-                       return true;
+                       return;
        }
-       return false;
+       return;
 }
 
 static bool
index 3fc598eeeb1a57cc8fc76f1c6ed7c1220ce21326..756331d42661cf12b2964256a8204b7a588f92f8 100644 (file)
 
 static u_int16_t nf_sctp_port_rover;
 
-static bool
+static void
 sctp_unique_tuple(struct nf_conntrack_tuple *tuple,
                  const struct nf_nat_range *range,
                  enum nf_nat_manip_type maniptype,
                  const struct nf_conn *ct)
 {
-       return nf_nat_proto_unique_tuple(tuple, range, maniptype, ct,
-                                        &nf_sctp_port_rover);
+       nf_nat_proto_unique_tuple(tuple, range, maniptype, ct,
+                                 &nf_sctp_port_rover);
 }
 
 static bool
index 399e2cfa263b72eaa8a2c49b078983cd67399914..aa460a595d5d930e019f9bd36eb010251a5dd33e 100644 (file)
 
 static u_int16_t tcp_port_rover;
 
-static bool
+static void
 tcp_unique_tuple(struct nf_conntrack_tuple *tuple,
                 const struct nf_nat_range *range,
                 enum nf_nat_manip_type maniptype,
                 const struct nf_conn *ct)
 {
-       return nf_nat_proto_unique_tuple(tuple, range, maniptype, ct,
-                                        &tcp_port_rover);
+       nf_nat_proto_unique_tuple(tuple, range, maniptype, ct, &tcp_port_rover);
 }
 
 static bool
index 9e61c79492e4beb0d02a56c0f1bb4b42226630b7..dfe65c7e292586521ad9d1f804a3f82eade1a755 100644 (file)
 
 static u_int16_t udp_port_rover;
 
-static bool
+static void
 udp_unique_tuple(struct nf_conntrack_tuple *tuple,
                 const struct nf_nat_range *range,
                 enum nf_nat_manip_type maniptype,
                 const struct nf_conn *ct)
 {
-       return nf_nat_proto_unique_tuple(tuple, range, maniptype, ct,
-                                        &udp_port_rover);
+       nf_nat_proto_unique_tuple(tuple, range, maniptype, ct, &udp_port_rover);
 }
 
 static bool
index 440a229bbd87df929816d53d02764d7879478ba1..3cc8c8af39ef2fe82905fdad69b0b64af0f4e770 100644 (file)
 
 static u_int16_t udplite_port_rover;
 
-static bool
+static void
 udplite_unique_tuple(struct nf_conntrack_tuple *tuple,
                     const struct nf_nat_range *range,
                     enum nf_nat_manip_type maniptype,
                     const struct nf_conn *ct)
 {
-       return nf_nat_proto_unique_tuple(tuple, range, maniptype, ct,
-                                        &udplite_port_rover);
+       nf_nat_proto_unique_tuple(tuple, range, maniptype, ct,
+                                 &udplite_port_rover);
 }
 
 static bool
index 14381c62acea676e8553530b32d1f4220d90e6a1..a50f2bc1c7328805e755a204ca66253844dba702 100644 (file)
@@ -26,14 +26,14 @@ static bool unknown_in_range(const struct nf_conntrack_tuple *tuple,
        return true;
 }
 
-static bool unknown_unique_tuple(struct nf_conntrack_tuple *tuple,
+static void unknown_unique_tuple(struct nf_conntrack_tuple *tuple,
                                 const struct nf_nat_range *range,
                                 enum nf_nat_manip_type maniptype,
                                 const struct nf_conn *ct)
 {
        /* Sorry: we can't help you; if it's not unique, we can't frob
           anything. */
-       return false;
+       return;
 }
 
 static bool