]> Pileus Git - ~andy/linux/blobdiff - net/ipv4/netfilter/ipt_ECN.c
[NETFILTER]: Update modules' descriptions
[~andy/linux] / net / ipv4 / netfilter / ipt_ECN.c
index f1253bd3837f11d78c530351068dc514a3ecfcc1..21395bc2b27f5b24a28d3d5cda075a362d6fec5e 100644 (file)
 
 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. */
 static inline bool
-set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
+set_ect_ip(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
 {
-       struct iphdr *iph = ip_hdr(*pskb);
+       struct iphdr *iph = ip_hdr(skb);
 
        if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) {
                __u8 oldtos;
-               if (!skb_make_writable(pskb, sizeof(struct iphdr)))
+               if (!skb_make_writable(skb, sizeof(struct iphdr)))
                        return false;
-               iph = ip_hdr(*pskb);
+               iph = ip_hdr(skb);
                oldtos = iph->tos;
                iph->tos &= ~IPT_ECN_IP_MASK;
                iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK);
-               nf_csum_replace2(&iph->check, htons(oldtos), htons(iph->tos));
+               csum_replace2(&iph->check, htons(oldtos), htons(iph->tos));
        }
        return true;
 }
 
 /* Return false if there was an error. */
 static inline bool
-set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
+set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
 {
        struct tcphdr _tcph, *tcph;
        __be16 oldval;
 
        /* Not enought header? */
-       tcph = skb_header_pointer(*pskb, ip_hdrlen(*pskb),
-                                 sizeof(_tcph), &_tcph);
+       tcph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_tcph), &_tcph);
        if (!tcph)
                return false;
 
@@ -62,9 +61,9 @@ set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
             tcph->cwr == einfo->proto.tcp.cwr))
                return true;
 
-       if (!skb_make_writable(pskb, ip_hdrlen(*pskb) + sizeof(*tcph)))
+       if (!skb_make_writable(skb, ip_hdrlen(skb) + sizeof(*tcph)))
                return false;
-       tcph = (void *)ip_hdr(*pskb) + ip_hdrlen(*pskb);
+       tcph = (void *)ip_hdr(skb) + ip_hdrlen(skb);
 
        oldval = ((__be16 *)tcph)[6];
        if (einfo->operation & IPT_ECN_OP_SET_ECE)
@@ -72,39 +71,34 @@ set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
        if (einfo->operation & IPT_ECN_OP_SET_CWR)
                tcph->cwr = einfo->proto.tcp.cwr;
 
-       nf_proto_csum_replace2(&tcph->check, *pskb,
-                               oldval, ((__be16 *)tcph)[6], 0);
+       inet_proto_csum_replace2(&tcph->check, skb,
+                                oldval, ((__be16 *)tcph)[6], 0);
        return true;
 }
 
 static unsigned int
-target(struct sk_buff **pskb,
-       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 net_device *in,
+       const struct net_device *out, unsigned int hooknum,
+       const struct xt_target *target, const void *targinfo)
 {
        const struct ipt_ECN_info *einfo = targinfo;
 
        if (einfo->operation & IPT_ECN_OP_SET_IP)
-               if (!set_ect_ip(pskb, einfo))
+               if (!set_ect_ip(skb, einfo))
                        return NF_DROP;
 
        if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR)
-           && ip_hdr(*pskb)->protocol == IPPROTO_TCP)
-               if (!set_ect_tcp(pskb, einfo))
+           && ip_hdr(skb)->protocol == IPPROTO_TCP)
+               if (!set_ect_tcp(skb, einfo))
                        return NF_DROP;
 
        return XT_CONTINUE;
 }
 
 static bool
-checkentry(const char *tablename,
-          const void *e_void,
-          const struct xt_target *target,
-          void *targinfo,
-          unsigned int hook_mask)
+ecn_tg_check(const char *tablename, const void *e_void,
+             const struct xt_target *target, void *targinfo,
+             unsigned int hook_mask)
 {
        const struct ipt_ECN_info *einfo = (struct ipt_ECN_info *)targinfo;
        const struct ipt_entry *e = e_void;
@@ -128,25 +122,25 @@ checkentry(const char *tablename,
        return true;
 }
 
-static struct xt_target ipt_ecn_reg __read_mostly = {
+static struct xt_target ecn_tg_reg __read_mostly = {
        .name           = "ECN",
        .family         = AF_INET,
-       .target         = target,
+       .target         = ecn_tg,
        .targetsize     = sizeof(struct ipt_ECN_info),
        .table          = "mangle",
-       .checkentry     = checkentry,
+       .checkentry     = ecn_tg_check,
        .me             = THIS_MODULE,
 };
 
-static int __init ipt_ecn_init(void)
+static int __init ecn_tg_init(void)
 {
-       return xt_register_target(&ipt_ecn_reg);
+       return xt_register_target(&ecn_tg_reg);
 }
 
-static void __exit ipt_ecn_fini(void)
+static void __exit ecn_tg_exit(void)
 {
-       xt_unregister_target(&ipt_ecn_reg);
+       xt_unregister_target(&ecn_tg_reg);
 }
 
-module_init(ipt_ecn_init);
-module_exit(ipt_ecn_fini);
+module_init(ecn_tg_init);
+module_exit(ecn_tg_exit);