OSDN Git Service

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
[uclinux-h8/linux.git] / net / ipv6 / tcp_ipv6.c
index 03e6b7a..b81eb7c 100644 (file)
@@ -349,7 +349,7 @@ static void tcp_v6_mtu_reduced(struct sock *sk)
        }
 }
 
-static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
+static int tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                u8 type, u8 code, int offset, __be32 info)
 {
        const struct ipv6hdr *hdr = (const struct ipv6hdr *)skb->data;
@@ -371,17 +371,19 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        if (!sk) {
                __ICMP6_INC_STATS(net, __in6_dev_get(skb->dev),
                                  ICMP6_MIB_INERRORS);
-               return;
+               return -ENOENT;
        }
 
        if (sk->sk_state == TCP_TIME_WAIT) {
                inet_twsk_put(inet_twsk(sk));
-               return;
+               return 0;
        }
        seq = ntohl(th->seq);
        fatal = icmpv6_err_convert(type, code, &err);
-       if (sk->sk_state == TCP_NEW_SYN_RECV)
-               return tcp_req_err(sk, seq, fatal);
+       if (sk->sk_state == TCP_NEW_SYN_RECV) {
+               tcp_req_err(sk, seq, fatal);
+               return 0;
+       }
 
        bh_lock_sock(sk);
        if (sock_owned_by_user(sk) && type != ICMPV6_PKT_TOOBIG)
@@ -467,6 +469,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 out:
        bh_unlock_sock(sk);
        sock_put(sk);
+       return 0;
 }
 
 
@@ -734,6 +737,7 @@ static void tcp_v6_init_req(struct request_sock *req,
                            const struct sock *sk_listener,
                            struct sk_buff *skb)
 {
+       bool l3_slave = ipv6_l3mdev_skb(TCP_SKB_CB(skb)->header.h6.flags);
        struct inet_request_sock *ireq = inet_rsk(req);
        const struct ipv6_pinfo *np = inet6_sk(sk_listener);
 
@@ -741,7 +745,7 @@ static void tcp_v6_init_req(struct request_sock *req,
        ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
 
        /* So that link locals have meaning */
-       if (!sk_listener->sk_bound_dev_if &&
+       if ((!sk_listener->sk_bound_dev_if || l3_slave) &&
            ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL)
                ireq->ir_iif = tcp_v6_iif(skb);