diff options
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 10b7c0478830..5ca56cee2dae 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -726,7 +726,7 @@ static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = { | |||
726 | #endif | 726 | #endif |
727 | 727 | ||
728 | static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, | 728 | static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, |
729 | u32 tsval, u32 tsecr, | 729 | u32 tsval, u32 tsecr, int oif, |
730 | struct tcp_md5sig_key *key, int rst, u8 tclass, | 730 | struct tcp_md5sig_key *key, int rst, u8 tclass, |
731 | u32 label) | 731 | u32 label) |
732 | { | 732 | { |
@@ -798,8 +798,10 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, | |||
798 | __tcp_v6_send_check(buff, &fl6.saddr, &fl6.daddr); | 798 | __tcp_v6_send_check(buff, &fl6.saddr, &fl6.daddr); |
799 | 799 | ||
800 | fl6.flowi6_proto = IPPROTO_TCP; | 800 | fl6.flowi6_proto = IPPROTO_TCP; |
801 | if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL) | 801 | if (rt6_need_strict(&fl6.daddr) || !oif) |
802 | fl6.flowi6_oif = inet6_iif(skb); | 802 | fl6.flowi6_oif = inet6_iif(skb); |
803 | else | ||
804 | fl6.flowi6_oif = oif; | ||
803 | fl6.fl6_dport = t1->dest; | 805 | fl6.fl6_dport = t1->dest; |
804 | fl6.fl6_sport = t1->source; | 806 | fl6.fl6_sport = t1->source; |
805 | security_skb_classify_flow(skb, flowi6_to_flowi(&fl6)); | 807 | security_skb_classify_flow(skb, flowi6_to_flowi(&fl6)); |
@@ -833,6 +835,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
833 | int genhash; | 835 | int genhash; |
834 | struct sock *sk1 = NULL; | 836 | struct sock *sk1 = NULL; |
835 | #endif | 837 | #endif |
838 | int oif; | ||
836 | 839 | ||
837 | if (th->rst) | 840 | if (th->rst) |
838 | return; | 841 | return; |
@@ -876,7 +879,8 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
876 | ack_seq = ntohl(th->seq) + th->syn + th->fin + skb->len - | 879 | ack_seq = ntohl(th->seq) + th->syn + th->fin + skb->len - |
877 | (th->doff << 2); | 880 | (th->doff << 2); |
878 | 881 | ||
879 | tcp_v6_send_response(skb, seq, ack_seq, 0, 0, 0, key, 1, 0, 0); | 882 | oif = sk ? sk->sk_bound_dev_if : 0; |
883 | tcp_v6_send_response(skb, seq, ack_seq, 0, 0, 0, oif, key, 1, 0, 0); | ||
880 | 884 | ||
881 | #ifdef CONFIG_TCP_MD5SIG | 885 | #ifdef CONFIG_TCP_MD5SIG |
882 | release_sk1: | 886 | release_sk1: |
@@ -888,11 +892,11 @@ release_sk1: | |||
888 | } | 892 | } |
889 | 893 | ||
890 | static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, | 894 | static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, |
891 | u32 win, u32 tsval, u32 tsecr, | 895 | u32 win, u32 tsval, u32 tsecr, int oif, |
892 | struct tcp_md5sig_key *key, u8 tclass, | 896 | struct tcp_md5sig_key *key, u8 tclass, |
893 | u32 label) | 897 | u32 label) |
894 | { | 898 | { |
895 | tcp_v6_send_response(skb, seq, ack, win, tsval, tsecr, key, 0, tclass, | 899 | tcp_v6_send_response(skb, seq, ack, win, tsval, tsecr, oif, key, 0, tclass, |
896 | label); | 900 | label); |
897 | } | 901 | } |
898 | 902 | ||
@@ -904,7 +908,7 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) | |||
904 | tcp_v6_send_ack(skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, | 908 | tcp_v6_send_ack(skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, |
905 | tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, | 909 | tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, |
906 | tcp_time_stamp + tcptw->tw_ts_offset, | 910 | tcp_time_stamp + tcptw->tw_ts_offset, |
907 | tcptw->tw_ts_recent, tcp_twsk_md5_key(tcptw), | 911 | tcptw->tw_ts_recent, tw->tw_bound_dev_if, tcp_twsk_md5_key(tcptw), |
908 | tw->tw_tclass, (tw->tw_flowlabel << 12)); | 912 | tw->tw_tclass, (tw->tw_flowlabel << 12)); |
909 | 913 | ||
910 | inet_twsk_put(tw); | 914 | inet_twsk_put(tw); |
@@ -914,7 +918,7 @@ static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, | |||
914 | struct request_sock *req) | 918 | struct request_sock *req) |
915 | { | 919 | { |
916 | tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, | 920 | tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, |
917 | req->rcv_wnd, tcp_time_stamp, req->ts_recent, | 921 | req->rcv_wnd, tcp_time_stamp, req->ts_recent, sk->sk_bound_dev_if, |
918 | tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr), | 922 | tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr), |
919 | 0, 0); | 923 | 0, 0); |
920 | } | 924 | } |