projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
66ad9be
)
udhcpc6: additional fix for ppp interface type
author
Denys Vlasenko
<vda.linux@googlemail.com>
Tue, 23 Jan 2018 15:46:31 +0000
(16:46 +0100)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Tue, 23 Jan 2018 15:46:31 +0000
(16:46 +0100)
Invent a fictitious MAC only once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/udhcp/d6_socket.c
patch
|
blob
|
history
diff --git
a/networking/udhcp/d6_socket.c
b/networking/udhcp/d6_socket.c
index f9082ee9d3a83f432016ecdac2821871fd44c6a0..315c8d98a33e92241f2b0fa060fc9e094a9054ae 100644
(file)
--- 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_
if (ioctl(fd, SIOCGIFINDEX, &ifr) == 0) {
*ifindex = ifr.ifr_ifindex;
log2("ifindex %d", *ifindex);
- ((uint32_t*)mac)[0] = rand();
- ((uint16_t*)mac)[2] = rand();
+ if (((uint32_t*)mac)[0] == 0) {
+ /* invent a fictitious MAC (once) */
+ ((uint32_t*)mac)[0] = rand();
+ ((uint16_t*)mac)[2] = rand();
+ mac[0] &= 0xfc; /* make sure it's not bcast */
+ }
retval &= (3 - (1<<0));
}
close(fd);