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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 04 Sep 2007 15:45:14 -0700
From:	Ben Greear <greearb@...delatech.com>
To:	NetDev <netdev@...r.kernel.org>
CC:	Patrick McHardy <kaber@...sh.net>
Subject: SO_BINDTODEVICE mismatch with man page & comments.

According to the comment in the net/core/sock.c code (in 2.6.20), I should be able to pass a zero
optlen to the setsockopt method for SO_BINDTODEVICE:

                 case SO_BINDTODEVICE:
                 {
                         char devname[IFNAMSIZ];

                         /* Sorry... */
                         if (!capable(CAP_NET_RAW)) {
                                 ret = -EPERM;
                                 break;
                         }

                         /* Bind this socket to a particular device like "eth0",
                          * as specified in the passed interface name. If the
                          * name is "" or the option length is zero the socket
                          * is not bound.
                          */

However, earlier in that method it returns -EINVAL if optlen is < sizeof(int).

The man page has comments similar to that in the code above.

Also, even when I get the un-bind call working with code similar to:

int z = 0;
setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, &z, sizeof(z));

The app I'm working on (Xorp) does not appear to work.  Perhaps because
the kernel does not clean up the cached route when you un-bind
as it does in the (re)bind logic?

                                 /* Remove any cached route for this socket. */
                                 sk_dst_reset(sk);


Thanks,
Ben

-- 
Ben Greear <greearb@...delatech.com>
Candela Technologies Inc  http://www.candelatech.com

-
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ