]> Pileus Git - ~andy/linux/blobdiff - include/net/inet_ecn.h
Pull misc into release branch
[~andy/linux] / include / net / inet_ecn.h
index cadc0eab54faedee6c0c4bb17ed64b50eed14a0d..de8399a797749007f17501f8371136fb83d33fd1 100644 (file)
@@ -53,7 +53,7 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
 
 static inline int IP_ECN_set_ce(struct iphdr *iph)
 {
-       u32 check = iph->check;
+       u32 check = (__force u32)iph->check;
        u32 ecn = (iph->tos + 1) & INET_ECN_MASK;
 
        /*
@@ -71,9 +71,9 @@ static inline int IP_ECN_set_ce(struct iphdr *iph)
         * INET_ECN_ECT_1 => check += htons(0xFFFD)
         * INET_ECN_ECT_0 => check += htons(0xFFFE)
         */
-       check += htons(0xFFFB) + htons(ecn);
+       check += (__force u16)htons(0xFFFB) + (__force u16)htons(ecn);
 
-       iph->check = check + (check>=0xFFFF);
+       iph->check = (__force __sum16)(check + (check>=0xFFFF));
        iph->tos |= INET_ECN_CE;
        return 1;
 }
@@ -114,13 +114,13 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
 {
        switch (skb->protocol) {
        case __constant_htons(ETH_P_IP):
-               if (skb->nh.raw + sizeof(struct iphdr) <= skb->tail)
-                       return IP_ECN_set_ce(skb->nh.iph);
+               if (skb->network_header + sizeof(struct iphdr) <= skb->tail)
+                       return IP_ECN_set_ce(ip_hdr(skb));
                break;
 
        case __constant_htons(ETH_P_IPV6):
-               if (skb->nh.raw + sizeof(struct ipv6hdr) <= skb->tail)
-                       return IP6_ECN_set_ce(skb->nh.ipv6h);
+               if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail)
+                       return IP6_ECN_set_ce(ipv6_hdr(skb));
                break;
        }