> 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

Reply via email to