lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 02 Feb 2012 23:45:44 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	"Erich E. Hoover" <ehoover@...es.edu>
Cc:	Linux Netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v2] Implement IP_UNICAST_IF socket option.

Le jeudi 02 février 2012 à 15:29 -0700, Erich E. Hoover a écrit :
> On Thu, Feb 2, 2012 at 2:57 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> > Le jeudi 02 février 2012 à 14:36 -0700, Erich E. Hoover a écrit :
> > > ...
> > > +             if (sk->sk_bound_dev_if && ifindex != sk->sk_bound_dev_if)
> > > +                     break;
> >
> > what happens if later sk_bound_dev_if is changed ? Should we redo the
> > above tests ?
> 
> Would it be better if ip_default_ifindex performed the same comparison
> and prioritized the sk->sk_bound_dev_if value?
> 

I guess you should mimic other OS behavior. Tests are probably needed.

> > > ...
> > > +     case IP_UNICAST_IF:
> > > +     {
> > > +             __be32 iface;
> > > +
> > > +             len = sizeof(__be32);
> > > +             iface = htonl(inet->outif_index);
> > > +             release_sock(sk);
> > > +
> > > +             if (put_user(len, optlen))
> > > +                     return -EFAULT;
> > > +             if (copy_to_user(optval, &iface, len))
> > > +                     return -EFAULT;
> > > +             return 0;
> >
> > wow.... thats not pretty...
> >
> >        what about :
> >
> >        case IP_UNICASE_IF:
> >                val = htonl(inet->outif_index);
> >                break;
> >
> 
> The return value needs to be 4 bytes even if sizeof(int) != 4.
> 

On all arches supported by linux, sizeof(int) == 4

Maybe avoid sparse warning since val is not __be32

	val = (__force int)htonl(inet->outif_index);
	break;

> > > ...
> > IPv6 not supported ?
> 
> Nope, at least according to the documentation the option is only for
> IPv4 (IPPROTO_IP).

Probably because of the mix on interface index and IPv4 addr on "other
OS".

But if we implement interface index only, it could be used on IPv6
too... I dont know...


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists