FreeBSD Bugzilla – Attachment 195377 Details for
Bug 229957
[epair] MAC addresses all the same, no randomness
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed fix for if_epair.c
epair.diff (text/plain), 1.30 KB, created by
Eugene Grosbein
on 2018-07-22 18:06:25 UTC
(
hide
)
Description:
proposed fix for if_epair.c
Filename:
MIME Type:
Creator:
Eugene Grosbein
Created:
2018-07-22 18:06:25 UTC
Size:
1.30 KB
patch
obsolete
>Index: sys/net/if_epair.c >=================================================================== >--- sys/net/if_epair.c (revision 336460) >+++ sys/net/if_epair.c (working copy) >@@ -107,6 +107,7 @@ static int epair_clone_create(struct if_ > static int epair_clone_destroy(struct if_clone *, struct ifnet *); > > static const char epairname[] = "epair"; >+static unsigned int next_index = 0; > > /* Netisr related definitions and sysctl. */ > static struct netisr_handler epair_nh = { >@@ -843,12 +844,21 @@ epair_clone_create(struct if_clone *ifc, > > /* > * Calculate the etheraddr hashing the hostid and the >- * interface index. The result would be hopefully unique >+ * interface index. The result would be hopefully unique. >+ * Note that epair(4) may be created then "a" part moved to another >+ * VNET freeing if_index so next epair obtains same if_index. >+ * Make sure we do not create same etheraddr again. > */ > getcredhostid(curthread->td_ucred, (unsigned long *)&hostid); > if (hostid == 0) > arc4rand(&hostid, sizeof(hostid), 0); >- key[0] = (uint32_t)ifp->if_index; >+ >+ if (ifp->if_index > next_index) >+ next_index = ifp->if_index; >+ else >+ next_index++; >+ >+ key[0] = (uint32_t)next_index; > key[1] = (uint32_t)(hostid & 0xffffffff); > key[2] = (uint32_t)((hostid >> 32) & 0xfffffffff); > hash = jenkins_hash32(key, 3, 0);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 229957
: 195377