[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181107230732.GA21388@konacove.com>
Date: Wed, 7 Nov 2018 17:07:32 -0600
From: David Barmann <david.barmann@...ckpath.com>
To: netdev@...r.kernel.org
Cc: Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH net-next] sock: Reset dst when changing sk_mark via
setsockopt
> On 11/07/2018 02:33 PM, David Barmann wrote:
> > When setting the SO_MARK socket option, the dst needs to be reset so
> > that a new route lookup is performed.
> >
> > This fixes the case where an application wants to change routing by
> > setting a new sk_mark. If this is done after some packets have already
> > been sent, the dst is cached and has no effect.
> >
> > + } else {
> > + struct dst_entry *dst = sk_dst_get(sk);
> > sk->sk_mark = val;
> > + sk_dst_reset(sk);
>
>
> sk_dst_get() and dst_release() seems extra overhead ?
>
> net/ipv4/ip_sockglue.c do_ip_setsockopt() has a similar handling for IP_TOS,
> and it only calls sk_dst_reset() (If the new TOS is different than the current one)
>
>
>
> So I would suggest :
>
> if (!ns_capable(...)) {
> ret = -EPERM;
> } else if (val != sk->sk_mark) {
> sk->sk_mark = val;
> sk_dst_reset(sk);
> }
Thanks Eric, I'll redo that and resubmit.
-David
Powered by blists - more mailing lists