]> err.no Git - linux-2.6/blobdiff - net/netfilter/xt_tcpudp.c
[NETFILTER]: x_tables: set the protocol family in x_tables targets/matches
[linux-2.6] / net / netfilter / xt_tcpudp.c
index 9d01f07ceb652d190c32f3ae5b91610104c50233..14a990eb666ae2a7496d91b745d698a1c49be7b4 100644 (file)
@@ -74,6 +74,7 @@ static int
 tcp_match(const struct sk_buff *skb,
          const struct net_device *in,
          const struct net_device *out,
+         const struct xt_match *match,
          const void *matchinfo,
          int offset,
          unsigned int protoff,
@@ -138,6 +139,7 @@ tcp_match(const struct sk_buff *skb,
 static int
 tcp_checkentry(const char *tablename,
               const void *info,
+              const struct xt_match *match,
               void *matchinfo,
               unsigned int matchsize,
               unsigned int hook_mask)
@@ -152,6 +154,7 @@ static int
 udp_match(const struct sk_buff *skb,
          const struct net_device *in,
          const struct net_device *out,
+         const struct xt_match *match,
          const void *matchinfo,
          int offset,
          unsigned int protoff,
@@ -185,6 +188,7 @@ udp_match(const struct sk_buff *skb,
 static int
 udp_checkentry(const char *tablename,
               const void *info,
+              const struct xt_match *match,
               void *matchinfo,
               unsigned int matchsize,
               unsigned int hook_mask)
@@ -200,6 +204,7 @@ static struct xt_match tcp_matchstruct = {
        .match          = tcp_match,
        .matchsize      = sizeof(struct xt_tcp),
        .proto          = IPPROTO_TCP,
+       .family         = AF_INET,
        .checkentry     = tcp_checkentry,
        .me             = THIS_MODULE,
 };
@@ -209,6 +214,7 @@ static struct xt_match tcp6_matchstruct = {
        .match          = tcp_match,
        .matchsize      = sizeof(struct xt_tcp),
        .proto          = IPPROTO_TCP,
+       .family         = AF_INET6,
        .checkentry     = tcp_checkentry,
        .me             = THIS_MODULE,
 };
@@ -218,6 +224,7 @@ static struct xt_match udp_matchstruct = {
        .match          = udp_match,
        .matchsize      = sizeof(struct xt_udp),
        .proto          = IPPROTO_UDP,
+       .family         = AF_INET,
        .checkentry     = udp_checkentry,
        .me             = THIS_MODULE,
 };
@@ -226,6 +233,7 @@ static struct xt_match udp6_matchstruct = {
        .match          = udp_match,
        .matchsize      = sizeof(struct xt_udp),
        .proto          = IPPROTO_UDP,
+       .family         = AF_INET6,
        .checkentry     = udp_checkentry,
        .me             = THIS_MODULE,
 };
@@ -233,39 +241,39 @@ static struct xt_match udp6_matchstruct = {
 static int __init init(void)
 {
        int ret;
-       ret = xt_register_match(AF_INET, &tcp_matchstruct);
+       ret = xt_register_match(&tcp_matchstruct);
        if (ret)
                return ret;
 
-       ret = xt_register_match(AF_INET6, &tcp6_matchstruct);
+       ret = xt_register_match(&tcp6_matchstruct);
        if (ret)
                goto out_unreg_tcp;
 
-       ret = xt_register_match(AF_INET, &udp_matchstruct);
+       ret = xt_register_match(&udp_matchstruct);
        if (ret)
                goto out_unreg_tcp6;
        
-       ret = xt_register_match(AF_INET6, &udp6_matchstruct);
+       ret = xt_register_match(&udp6_matchstruct);
        if (ret)
                goto out_unreg_udp;
 
        return ret;
 
 out_unreg_udp:
-       xt_unregister_match(AF_INET, &tcp_matchstruct);
+       xt_unregister_match(&tcp_matchstruct);
 out_unreg_tcp6:
-       xt_unregister_match(AF_INET6, &tcp6_matchstruct);
+       xt_unregister_match(&tcp6_matchstruct);
 out_unreg_tcp:
-       xt_unregister_match(AF_INET, &tcp_matchstruct);
+       xt_unregister_match(&tcp_matchstruct);
        return ret;
 }
 
 static void __exit fini(void)
 {
-       xt_unregister_match(AF_INET6, &udp6_matchstruct);
-       xt_unregister_match(AF_INET, &udp_matchstruct);
-       xt_unregister_match(AF_INET6, &tcp6_matchstruct);
-       xt_unregister_match(AF_INET, &tcp_matchstruct);
+       xt_unregister_match(&udp6_matchstruct);
+       xt_unregister_match(&udp_matchstruct);
+       xt_unregister_match(&tcp6_matchstruct);
+       xt_unregister_match(&tcp_matchstruct);
 }
 
 module_init(init);