[IP]: Introduce ip_hdrlen()
[deliverable/linux.git] / net / ipv4 / netfilter / ipt_ECN.c
index 4f565633631dfa971d39eb1bc151ebf0b292fc8d..44daf9e1da35b3cd1b88df871009ba1aea04ca5b 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/ip.h>
+#include <net/ip.h>
 #include <linux/tcp.h>
 #include <net/checksum.h>
 
@@ -52,7 +53,7 @@ set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
        __be16 oldval;
 
        /* Not enought header? */
-       tcph = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4,
+       tcph = skb_header_pointer(*pskb, ip_hdrlen(*pskb),
                                  sizeof(_tcph), &_tcph);
        if (!tcph)
                return 0;
@@ -63,9 +64,9 @@ set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
             tcph->cwr == einfo->proto.tcp.cwr)))
                return 1;
 
-       if (!skb_make_writable(pskb, (*pskb)->nh.iph->ihl*4+sizeof(*tcph)))
+       if (!skb_make_writable(pskb, ip_hdrlen(*pskb) + sizeof(*tcph)))
                return 0;
-       tcph = (void *)(*pskb)->nh.iph + (*pskb)->nh.iph->ihl*4;
+       tcph = (void *)(*pskb)->nh.iph + ip_hdrlen(*pskb);
 
        oldval = ((__be16 *)tcph)[6];
        if (einfo->operation & IPT_ECN_OP_SET_ECE)
This page took 0.02679 seconds and 5 git commands to generate.