diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-10 11:24:33 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-10 11:24:33 +0000 |
commit | a3ca7cf069177dba7b3c064324bd77e39483f13a (patch) | |
tree | ffaae181320cb1a744e5fa5643f479e66f822d4c | |
parent | 517413f9affae582f5e824ef45805662d676be6a (diff) | |
download | busybox-w32-a3ca7cf069177dba7b3c064324bd77e39483f13a.tar.gz busybox-w32-a3ca7cf069177dba7b3c064324bd77e39483f13a.tar.bz2 busybox-w32-a3ca7cf069177dba7b3c064324bd77e39483f13a.zip |
add a note that SO_BINDTODEVICE needs padded iface name on 2.6.26
-rw-r--r-- | libbb/xconnect.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libbb/xconnect.c b/libbb/xconnect.c index d078e9811..2eb4cb9be 100644 --- a/libbb/xconnect.c +++ b/libbb/xconnect.c | |||
@@ -24,7 +24,9 @@ int FAST_FUNC setsockopt_bindtodevice(int fd, const char *iface) | |||
24 | int r; | 24 | int r; |
25 | struct ifreq ifr; | 25 | struct ifreq ifr; |
26 | strncpy_IFNAMSIZ(ifr.ifr_name, iface); | 26 | strncpy_IFNAMSIZ(ifr.ifr_name, iface); |
27 | /* Actually, ifr_name is at offset 0, and in practice | 27 | /* NB: passing (iface, strlen(iface) + 1) does not work! |
28 | * (maybe it works on _some_ kernels, but not on 2.6.26) | ||
29 | * Actually, ifr_name is at offset 0, and in practice | ||
28 | * just giving char[IFNAMSIZ] instead of struct ifreq works too. | 30 | * just giving char[IFNAMSIZ] instead of struct ifreq works too. |
29 | * But just in case it's not true on some obscure arch... */ | 31 | * But just in case it's not true on some obscure arch... */ |
30 | r = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)); | 32 | r = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)); |