netfilter: xtables: add struct xt_mtchk_param::net
[safe/jmp/linux-2.6] / net / ipv4 / netfilter / ipt_ECN.c
index ab41764..ea5cea2 100644 (file)
@@ -21,7 +21,7 @@
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
-MODULE_DESCRIPTION("iptables ECN modification module");
+MODULE_DESCRIPTION("Xtables: Explicit Congestion Notification (ECN) flag modification");
 
 /* set ECT codepoint from IP header.
  *     return false if there was an error. */
@@ -50,7 +50,7 @@ set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
        struct tcphdr _tcph, *tcph;
        __be16 oldval;
 
-       /* Not enought header? */
+       /* Not enough header? */
        tcph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph);
        if (!tcph)
                return false;
@@ -77,31 +77,26 @@ set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
 }
 
 static unsigned int
-ecn_tg(struct sk_buff *skb, const struct net_device *in,
-       const struct net_device *out, unsigned int hooknum,
-       const struct xt_target *target, const void *targinfo)
+ecn_tg(struct sk_buff *skb, const struct xt_target_param *par)
 {
-       const struct ipt_ECN_info *einfo = targinfo;
+       const struct ipt_ECN_info *einfo = par->targinfo;
 
        if (einfo->operation & IPT_ECN_OP_SET_IP)
                if (!set_ect_ip(skb, einfo))
                        return NF_DROP;
 
-       if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR)
-           && ip_hdr(skb)->protocol == IPPROTO_TCP)
+       if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR) &&
+           ip_hdr(skb)->protocol == IPPROTO_TCP)
                if (!set_ect_tcp(skb, einfo))
                        return NF_DROP;
 
        return XT_CONTINUE;
 }
 
-static bool
-ecn_tg_check(const char *tablename, const void *e_void,
-             const struct xt_target *target, void *targinfo,
-             unsigned int hook_mask)
+static bool ecn_tg_check(const struct xt_tgchk_param *par)
 {
-       const struct ipt_ECN_info *einfo = (struct ipt_ECN_info *)targinfo;
-       const struct ipt_entry *e = e_void;
+       const struct ipt_ECN_info *einfo = par->targinfo;
+       const struct ipt_entry *e = par->entryinfo;
 
        if (einfo->operation & IPT_ECN_OP_MASK) {
                printk(KERN_WARNING "ECN: unsupported ECN operation %x\n",
@@ -113,8 +108,8 @@ ecn_tg_check(const char *tablename, const void *e_void,
                        einfo->ip_ect);
                return false;
        }
-       if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR))
-           && (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & XT_INV_PROTO))) {
+       if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&
+           (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & XT_INV_PROTO))) {
                printk(KERN_WARNING "ECN: cannot use TCP operations on a "
                       "non-tcp rule\n");
                return false;
@@ -124,7 +119,7 @@ ecn_tg_check(const char *tablename, const void *e_void,
 
 static struct xt_target ecn_tg_reg __read_mostly = {
        .name           = "ECN",
-       .family         = AF_INET,
+       .family         = NFPROTO_IPV4,
        .target         = ecn_tg,
        .targetsize     = sizeof(struct ipt_ECN_info),
        .table          = "mangle",