Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[cascardo/linux.git] / net / ipv6 / udp.c
index e991e60..4210951 100644 (file)
@@ -153,7 +153,7 @@ try_again:
                        goto csum_copy_err;
        }
 
-       if (skb->ip_summed == CHECKSUM_UNNECESSARY)
+       if (skb_csum_unnecessary(skb))
                err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
                                              msg->msg_iov, copied       );
        else {
@@ -172,7 +172,7 @@ try_again:
 
                sin6 = (struct sockaddr_in6 *) msg->msg_name;
                sin6->sin6_family = AF_INET6;
-               sin6->sin6_port = skb->h.uh->source;
+               sin6->sin6_port = udp_hdr(skb)->source;
                sin6->sin6_flowinfo = 0;
                sin6->sin6_scope_id = 0;
 
@@ -180,7 +180,8 @@ try_again:
                        ipv6_addr_set(&sin6->sin6_addr, 0, 0,
                                      htonl(0xffff), ip_hdr(skb)->saddr);
                else {
-                       ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr);
+                       ipv6_addr_copy(&sin6->sin6_addr,
+                                      &ipv6_hdr(skb)->saddr);
                        if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
                                sin6->sin6_scope_id = IP6CB(skb)->iif;
                }
@@ -345,7 +346,7 @@ static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr,
                           struct in6_addr *daddr, struct hlist_head udptable[])
 {
        struct sock *sk, *sk2;
-       const struct udphdr *uh = skb->h.uh;
+       const struct udphdr *uh = udp_hdr(skb);
        int dif;
 
        read_lock(&udp_hash_lock);
@@ -392,13 +393,13 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh,
                return 1;
        }
        if (skb->ip_summed == CHECKSUM_COMPLETE &&
-           !csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
+           !csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
                             skb->len, proto, skb->csum))
                skb->ip_summed = CHECKSUM_UNNECESSARY;
 
-       if (skb->ip_summed != CHECKSUM_UNNECESSARY)
-               skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
-                                                        &skb->nh.ipv6h->daddr,
+       if (!skb_csum_unnecessary(skb))
+               skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
+                                                        &ipv6_hdr(skb)->daddr,
                                                         skb->len, proto, 0));
 
        return 0;
@@ -417,9 +418,9 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
        if (!pskb_may_pull(skb, sizeof(struct udphdr)))
                goto short_packet;
 
-       saddr = &skb->nh.ipv6h->saddr;
-       daddr = &skb->nh.ipv6h->daddr;
-       uh = skb->h.uh;
+       saddr = &ipv6_hdr(skb)->saddr;
+       daddr = &ipv6_hdr(skb)->daddr;
+       uh = udp_hdr(skb);
 
        ulen = ntohs(uh->len);
        if (ulen > skb->len)
@@ -438,9 +439,9 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
                if (ulen < skb->len) {
                        if (pskb_trim_rcsum(skb, ulen))
                                goto short_packet;
-                       saddr = &skb->nh.ipv6h->saddr;
-                       daddr = &skb->nh.ipv6h->daddr;
-                       uh = skb->h.uh;
+                       saddr = &ipv6_hdr(skb)->saddr;
+                       daddr = &ipv6_hdr(skb)->daddr;
+                       uh = udp_hdr(skb);
                }
        }
 
@@ -533,7 +534,7 @@ static int udp_v6_push_pending_frames(struct sock *sk)
        /*
         * Create a UDP header
         */
-       uh = skb->h.uh;
+       uh = udp_hdr(skb);
        uh->source = fl->fl_ip_sport;
        uh->dest = fl->fl_ip_dport;
        uh->len = htons(up->len);
@@ -747,8 +748,12 @@ do_udp_sendmsg:
        if (final_p)
                ipv6_addr_copy(&fl.fl6_dst, final_p);
 
-       if ((err = xfrm_lookup(&dst, &fl, sk, 1)) < 0)
-               goto out;
+       if ((err = __xfrm_lookup(&dst, &fl, sk, 1)) < 0) {
+               if (err == -EREMOTE)
+                       err = ip6_dst_blackhole(sk, &dst, &fl);
+               if (err < 0)
+                       goto out;
+       }
 
        if (hlimit < 0) {
                if (ipv6_addr_is_multicast(&fl.fl6_dst))