]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/netfilter/nf_nat_proto_gre.c
[NETFILTER]: nf_nat: add helpers for common NAT protocol operations
[linux-2.6-omap-h63xx.git] / net / ipv4 / netfilter / nf_nat_proto_gre.c
index a1e4da16da2e8a411fc39b6009c4b4f1151d0a09..87af63d9e692ee05876cc00c7548d247cd7f08a1 100644 (file)
@@ -36,24 +36,6 @@ MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
 MODULE_DESCRIPTION("Netfilter NAT protocol helper module for GRE");
 
-/* is key in given range between min and max */
-static int
-gre_in_range(const struct nf_conntrack_tuple *tuple,
-            enum nf_nat_manip_type maniptype,
-            const union nf_conntrack_man_proto *min,
-            const union nf_conntrack_man_proto *max)
-{
-       __be16 key;
-
-       if (maniptype == IP_NAT_MANIP_SRC)
-               key = tuple->src.u.gre.key;
-       else
-               key = tuple->dst.u.gre.key;
-
-       return ntohs(key) >= ntohs(min->gre.key) &&
-              ntohs(key) <= ntohs(max->gre.key);
-}
-
 /* generate unique tuple ... */
 static int
 gre_unique_tuple(struct nf_conntrack_tuple *tuple,
@@ -140,7 +122,7 @@ static const struct nf_nat_protocol gre = {
        .protonum               = IPPROTO_GRE,
        .me                     = THIS_MODULE,
        .manip_pkt              = gre_manip_pkt,
-       .in_range               = gre_in_range,
+       .in_range               = nf_nat_proto_in_range,
        .unique_tuple           = gre_unique_tuple,
 #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE)
        .range_to_nlattr        = nf_nat_port_range_to_nlattr,