View | Details | Raw Unified | Return to bug 274092 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/net/if_ethersubr.c (+4 lines)
Lines 1499-1504 ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) Link Here
1499
	char digest[SHA1_RESULTLEN];
1499
	char digest[SHA1_RESULTLEN];
1500
	char jailname[MAXHOSTNAMELEN];
1500
	char jailname[MAXHOSTNAMELEN];
1501
1501
1502
if_printf(ifp, "getcredhostuuid %s\n", __FILE__);
1502
	getcredhostuuid(curthread->td_ucred, uuid, sizeof(uuid));
1503
	getcredhostuuid(curthread->td_ucred, uuid, sizeof(uuid));
1503
	if (strncmp(uuid, DEFAULT_HOSTUUID, sizeof(uuid)) == 0) {
1504
	if (strncmp(uuid, DEFAULT_HOSTUUID, sizeof(uuid)) == 0) {
1504
		/* Fall back to a random mac address. */
1505
		/* Fall back to a random mac address. */
Lines 1507-1512 ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) Link Here
1507
1508
1508
	/* If each (vnet) jail would also have a unique hostuuid this would not
1509
	/* If each (vnet) jail would also have a unique hostuuid this would not
1509
	 * be necessary. */
1510
	 * be necessary. */
1511
if_printf(ifp, "getjailname %s\n", __FILE__);
1510
	getjailname(curthread->td_ucred, jailname, sizeof(jailname));
1512
	getjailname(curthread->td_ucred, jailname, sizeof(jailname));
1511
	sz = asprintf(&buf, M_TEMP, "%s-%s-%s", uuid, if_name(ifp),
1513
	sz = asprintf(&buf, M_TEMP, "%s-%s-%s", uuid, if_name(ifp),
1512
	    jailname);
1514
	    jailname);
Lines 1515-1520 ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) Link Here
1515
		goto rando;
1517
		goto rando;
1516
	}
1518
	}
1517
1519
1520
if_printf(ifp, "SHA1 %s\n", __FILE__);
1518
	SHA1Init(&ctx);
1521
	SHA1Init(&ctx);
1519
	SHA1Update(&ctx, buf, sz);
1522
	SHA1Update(&ctx, buf, sz);
1520
	SHA1Final(digest, &ctx);
1523
	SHA1Final(digest, &ctx);
Lines 1530-1535 ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) Link Here
1530
1533
1531
	return;
1534
	return;
1532
rando:
1535
rando:
1536
if_printf(ifp, "arc4rand %s\n", __FILE__);
1533
	arc4rand(hwaddr, sizeof(*hwaddr), 0);
1537
	arc4rand(hwaddr, sizeof(*hwaddr), 0);
1534
	/* Unicast */
1538
	/* Unicast */
1535
	hwaddr->octet[0] &= 0xFE;
1539
	hwaddr->octet[0] &= 0xFE;

Return to bug 274092