netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, davem@davemloft.net,
	Neil Horman <nhorman@tuxdriver.com>
Subject: Re: [PATCH net] sctp: update dst pmtu with the correct daddr
Date: Thu, 20 Sep 2018 11:17:56 -0300	[thread overview]
Message-ID: <20180920141755.GD4591@localhost.localdomain> (raw)
In-Reply-To: <dbed84b3964b13a0c15b3a5c8e825940819a2918.1537435648.git.lucien.xin@gmail.com>

On Thu, Sep 20, 2018 at 05:27:28PM +0800, Xin Long wrote:
> When processing pmtu update from an icmp packet, it calls .update_pmtu
> with sk instead of skb in sctp_transport_update_pmtu.
> 
> However for sctp, the daddr in the transport might be different from
> inet_sock->inet_daddr or sk->sk_v6_daddr, which is used to update or
> create the route cache. The incorrect daddr will cause a different
> route cache created for the path.
> 
> So before calling .update_pmtu, inet_sock->inet_daddr/sk->sk_v6_daddr
> should be updated with the daddr in the transport, and update it back
> after it's done.
> 
> The issue has existed since route exceptions introduction.
> 
> Fixes: 4895c771c7f0 ("ipv4: Add FIB nexthop exceptions.")
> Reported-by: ian.periam@dialogic.com
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  net/sctp/transport.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/transport.c b/net/sctp/transport.c
> index 12cac85..033696e 100644
> --- a/net/sctp/transport.c
> +++ b/net/sctp/transport.c
> @@ -260,6 +260,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
>  bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
>  {
>  	struct dst_entry *dst = sctp_transport_dst_check(t);
> +	struct sock *sk = t->asoc->base.sk;
>  	bool change = true;
>  
>  	if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) {
> @@ -271,12 +272,19 @@ bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
>  	pmtu = SCTP_TRUNC4(pmtu);
>  
>  	if (dst) {
> -		dst->ops->update_pmtu(dst, t->asoc->base.sk, NULL, pmtu);
> +		struct sctp_pf *pf = sctp_get_pf_specific(dst->ops->family);
> +		union sctp_addr addr;
> +
> +		pf->af->from_sk(&addr, sk);
> +		pf->to_sk_daddr(&t->ipaddr, sk);
> +		dst->ops->update_pmtu(dst, sk, NULL, pmtu);
> +		pf->to_sk_daddr(&addr, sk);
> +
>  		dst = sctp_transport_dst_check(t);
>  	}
>  
>  	if (!dst) {
> -		t->af_specific->get_dst(t, &t->saddr, &t->fl, t->asoc->base.sk);
> +		t->af_specific->get_dst(t, &t->saddr, &t->fl, sk);
>  		dst = t->dst;
>  	}
>  
> -- 
> 2.1.0
> 

  reply	other threads:[~2018-09-20 20:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20  9:27 [PATCH net] sctp: update dst pmtu with the correct daddr Xin Long
2018-09-20 14:17 ` Marcelo Ricardo Leitner [this message]
2018-09-20 18:31 ` David Miller
2018-09-21  7:55   ` Xin Long
2018-09-21 14:45     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180920141755.GD4591@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).