diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-01-23 16:46:31 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-01-23 16:46:31 +0100 |
commit | 30b290f996366e9370eadc0321cb59ec4eb85181 (patch) | |
tree | 008e411f745666564638fbfacac4818bb4836bc7 | |
parent | 66ad9be6031a3c5c0491b0040270b3f9ff591cdf (diff) | |
download | busybox-w32-30b290f996366e9370eadc0321cb59ec4eb85181.tar.gz busybox-w32-30b290f996366e9370eadc0321cb59ec4eb85181.tar.bz2 busybox-w32-30b290f996366e9370eadc0321cb59ec4eb85181.zip |
udhcpc6: additional fix for ppp interface type
Invent a fictitious MAC only once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/udhcp/d6_socket.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/networking/udhcp/d6_socket.c b/networking/udhcp/d6_socket.c index f9082ee9d..315c8d98a 100644 --- a/networking/udhcp/d6_socket.c +++ b/networking/udhcp/d6_socket.c | |||
@@ -69,8 +69,12 @@ int FAST_FUNC d6_read_interface(const char *interface, int *ifindex, struct in6_ | |||
69 | if (ioctl(fd, SIOCGIFINDEX, &ifr) == 0) { | 69 | if (ioctl(fd, SIOCGIFINDEX, &ifr) == 0) { |
70 | *ifindex = ifr.ifr_ifindex; | 70 | *ifindex = ifr.ifr_ifindex; |
71 | log2("ifindex %d", *ifindex); | 71 | log2("ifindex %d", *ifindex); |
72 | ((uint32_t*)mac)[0] = rand(); | 72 | if (((uint32_t*)mac)[0] == 0) { |
73 | ((uint16_t*)mac)[2] = rand(); | 73 | /* invent a fictitious MAC (once) */ |
74 | ((uint32_t*)mac)[0] = rand(); | ||
75 | ((uint16_t*)mac)[2] = rand(); | ||
76 | mac[0] &= 0xfc; /* make sure it's not bcast */ | ||
77 | } | ||
74 | retval &= (3 - (1<<0)); | 78 | retval &= (3 - (1<<0)); |
75 | } | 79 | } |
76 | close(fd); | 80 | close(fd); |