Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1682103 > unrolled thread

[PATCH] sctp: set the value of flowi6_oif to sk_bound_dev_if to make sctp_v6_get_dst to find the correct route entry.

Started byZheng Li <lizheng043@gmail.com>
First post2017-07-06 09:10 +0200
Last post2017-07-06 12:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sctp: set the value of flowi6_oif to sk_bound_dev_if to make sctp_v6_get_dst to find the correct route entry. Zheng Li <lizheng043@gmail.com> - 2017-07-06 09:10 +0200
    Re: [PATCH] sctp: set the value of flowi6_oif to sk_bound_dev_if to  make sctp_v6_get_dst to find the correct route entry. Ethan Zhao <ethan.kernel@gmail.com> - 2017-07-06 11:10 +0200
    Re: [PATCH] sctp: set the value of flowi6_oif to sk_bound_dev_if  to make sctp_v6_get_dst to find the correct route entry. David Miller <davem@davemloft.net> - 2017-07-06 12:50 +0200

#1682103 — [PATCH] sctp: set the value of flowi6_oif to sk_bound_dev_if to make sctp_v6_get_dst to find the correct route entry.

FromZheng Li <lizheng043@gmail.com>
Date2017-07-06 09:10 +0200
Subject[PATCH] sctp: set the value of flowi6_oif to sk_bound_dev_if to make sctp_v6_get_dst to find the correct route entry.
Message-ID<u095g-1az-17@gated-at.bofh.it>
From: Zheng Li <james.z.li@ericsson.com>

if there are several same route entries with different outgoing net device,
application's socket specifies the oif through setsockopt with
SO_BINDTODEVICE, sctpv6 should choose the route entry whose outgoing net
device is the oif which was specified by socket, set the value of
flowi6_oif to sk->sk_bound_dev_if to make sctp_v6_get_dst to find the
correct route entry.

Signed-off-by: Zheng Li <james.z.li@ericsson.com>
---
 net/sctp/ipv6.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index f5b45b8..2a186b20 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -252,6 +252,8 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
 	fl6->flowi6_proto = IPPROTO_SCTP;
 	if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
 		fl6->flowi6_oif = daddr->v6.sin6_scope_id;
+	else if (asoc)
+		fl6->flowi6_oif = asoc->base.sk->sk_bound_dev_if;
 
 	pr_debug("%s: dst=%pI6 ", __func__, &fl6->daddr);
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1682220 — Re: [PATCH] sctp: set the value of flowi6_oif to sk_bound_dev_if to make sctp_v6_get_dst to find the correct route entry.

FromEthan Zhao <ethan.kernel@gmail.com>
Date2017-07-06 11:10 +0200
SubjectRe: [PATCH] sctp: set the value of flowi6_oif to sk_bound_dev_if to make sctp_v6_get_dst to find the correct route entry.
Message-ID<u0aXp-2hr-35@gated-at.bofh.it>
In reply to#1682103
Zheng,

On Thu, Jul 6, 2017 at 3:00 PM, Zheng Li <lizheng043@gmail.com> wrote:
> From: Zheng Li <james.z.li@ericsson.com>
>
> if there are several same route entries with different outgoing net device,
> application's socket specifies the oif through setsockopt with
> SO_BINDTODEVICE, sctpv6 should choose the route entry whose outgoing net
> device is the oif which was specified by socket, set the value of
> flowi6_oif to sk->sk_bound_dev_if to make sctp_v6_get_dst to find the
> correct route entry.
>
> Signed-off-by: Zheng Li <james.z.li@ericsson.com>
> ---
>  net/sctp/ipv6.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
> index f5b45b8..2a186b20 100644
> --- a/net/sctp/ipv6.c
> +++ b/net/sctp/ipv6.c
> @@ -252,6 +252,8 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
>         fl6->flowi6_proto = IPPROTO_SCTP;
>         if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL)
>                 fl6->flowi6_oif = daddr->v6.sin6_scope_id;
> +       else if (asoc)
> +               fl6->flowi6_oif = asoc->base.sk->sk_bound_dev_if;

  Yes, ipv4 does the same way,  but sctp ipv4 code aslo set the
source port to htons(asoc->base.bind_addr.port) meanwhile;
:>

Thanks,
Ethan

>
>         pr_debug("%s: dst=%pI6 ", __func__, &fl6->daddr);
>
> --
> 2.7.4
>

[toc] | [prev] | [next] | [standalone]


#1682337 — Re: [PATCH] sctp: set the value of flowi6_oif to sk_bound_dev_if to make sctp_v6_get_dst to find the correct route entry.

FromDavid Miller <davem@davemloft.net>
Date2017-07-06 12:50 +0200
SubjectRe: [PATCH] sctp: set the value of flowi6_oif to sk_bound_dev_if to make sctp_v6_get_dst to find the correct route entry.
Message-ID<u0cwa-38K-7@gated-at.bofh.it>
In reply to#1682103
From: Zheng Li <lizheng043@gmail.com>
Date: Thu,  6 Jul 2017 15:00:09 +0800

> From: Zheng Li <james.z.li@ericsson.com>
> 
> if there are several same route entries with different outgoing net device,
> application's socket specifies the oif through setsockopt with
> SO_BINDTODEVICE, sctpv6 should choose the route entry whose outgoing net
> device is the oif which was specified by socket, set the value of
> flowi6_oif to sk->sk_bound_dev_if to make sctp_v6_get_dst to find the
> correct route entry.
> 
> Signed-off-by: Zheng Li <james.z.li@ericsson.com>

Applied, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web