]> git.hungrycats.org Git - linux/commitdiff
[IPV6]: Make sure errors propagate properly in {udp,raw} sendmsg.
authorDavid S. Miller <davem@nuts.ninka.net>
Thu, 7 Aug 2003 15:33:37 +0000 (08:33 -0700)
committerStephen Hemminger <shemminger@osdl.org>
Thu, 7 Aug 2003 15:33:37 +0000 (08:33 -0700)
net/ipv6/ip6_output.c
net/ipv6/raw.c
net/ipv6/udp.c

index f382087386162e3b0e7874f520e2b7e2dfd5697c..840d4117d4198a1acda46e6b66592311ed514e22 100644 (file)
@@ -209,7 +209,6 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
        int seg_len = skb->len;
        int hlimit;
        u32 mtu;
-       int err = 0;
 
        if (opt) {
                int head_room;
index 74537add4f73899d8a0090bb334f92874e5bc505..c5d193728e753d2d439cd7bb440ae0d97664db26 100644 (file)
@@ -659,7 +659,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
                fl.oif = np->mcast_oif;
 
        dst = ip6_dst_lookup(sk, &fl);
-       if (dst->error)
+       if ((err = dst->error))
                goto out;
 
        if (hlimit < 0) {
index 962116603cdcf1b214f99c4e7ff85c6f609be713..699cbc866c77341588ea6774815ede325ea7b82a 100644 (file)
@@ -811,8 +811,10 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
                 * The socket lock must be held while it's corked.
                 */
                lock_sock(sk);
-               if (likely(up->pending))
+               if (likely(up->pending)) {
+                       dst = NULL;
                        goto do_append_data;
+               }
                release_sock(sk);
        }
        ulen += sizeof(struct udphdr);
@@ -929,7 +931,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
                fl.oif = np->mcast_oif;
 
        dst = ip6_dst_lookup(sk, &fl);
-       if (dst->error)
+       if ((err = dst->error))
                goto out;
 
        if (hlimit < 0) {
@@ -968,9 +970,10 @@ do_append_data:
        else if (!corkreq)
                err = udp_v6_push_pending_frames(sk, up);
 
-       ip6_dst_store(sk, dst,
-                     !ipv6_addr_cmp(&fl.fl6_dst, &np->daddr) ?
-                     &np->daddr : NULL);
+       if (dst)
+               ip6_dst_store(sk, dst,
+                             !ipv6_addr_cmp(&fl.fl6_dst, &np->daddr) ?
+                             &np->daddr : NULL);
        if (err > 0)
                err = np->recverr ? net_xmit_errno(err) : 0;
        release_sock(sk);