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

Collapse All | Expand All

(-)sys/net/if_epair.c (-2 / +18 lines)
Lines 54-62 Link Here
54
54
55
#include <sys/param.h>
55
#include <sys/param.h>
56
#include <sys/kernel.h>
56
#include <sys/kernel.h>
57
#include <sys/jail.h>
58
#include <sys/libkern.h>
57
#include <sys/malloc.h>
59
#include <sys/malloc.h>
58
#include <sys/mbuf.h>
60
#include <sys/mbuf.h>
59
#include <sys/module.h>
61
#include <sys/module.h>
62
#include <sys/proc.h>
60
#include <sys/refcount.h>
63
#include <sys/refcount.h>
61
#include <sys/queue.h>
64
#include <sys/queue.h>
62
#include <sys/smp.h>
65
#include <sys/smp.h>
Lines 713-718 Link Here
713
	struct ifnet *ifp;
716
	struct ifnet *ifp;
714
	char *dp;
717
	char *dp;
715
	int error, unit, wildcard;
718
	int error, unit, wildcard;
719
	unsigned long hostid;
716
	uint8_t eaddr[ETHER_ADDR_LEN];	/* 00:00:00:00:00:00 */
720
	uint8_t eaddr[ETHER_ADDR_LEN];	/* 00:00:00:00:00:00 */
717
721
718
	/*
722
	/*
Lines 722-733 Link Here
722
	 * it cannot fail anymore. So just do attach it here.
726
	 * it cannot fail anymore. So just do attach it here.
723
	 */
727
	 */
724
	if (params) {
728
	if (params) {
729
		getcredhostid(curthread->td_ucred, &hostid );
730
		if ( hostid == 0 ) 
731
			arc4rand( &hostid, (sizeof(unsigned long)), 0);
732
		
725
		scb = (struct epair_softc *)params;
733
		scb = (struct epair_softc *)params;
726
		ifp = scb->ifp;
734
		ifp = scb->ifp;
727
		/* Assign a hopefully unique, locally administered etheraddr. */
735
		/* Assign a hopefully unique, locally administered etheraddr. */
728
		eaddr[0] = 0x02;
736
		eaddr[0] = 0x02;
729
		eaddr[3] = (ifp->if_index >> 8) & 0xff;
737
		eaddr[1] = ( hostid >> 8 ) & 0xff;
730
		eaddr[4] = ifp->if_index & 0xff;
738
		eaddr[2] = hostid & 0xff;
739
		eaddr[3] = (scb->oifp->if_index >> 8) & 0xff;
740
		eaddr[4] = scb->oifp->if_index & 0xff;
731
		eaddr[5] = 0x0b;
741
		eaddr[5] = 0x0b;
732
		ether_ifattach(ifp, eaddr);
742
		ether_ifattach(ifp, eaddr);
733
		/* Correctly set the name for the cloner list. */
743
		/* Correctly set the name for the cloner list. */
Lines 836-842 Link Here
836
	if_setsendqlen(ifp, ifqmaxlen);
846
	if_setsendqlen(ifp, ifqmaxlen);
837
	if_setsendqready(ifp);
847
	if_setsendqready(ifp);
838
	/* Assign a hopefully unique, locally administered etheraddr. */
848
	/* Assign a hopefully unique, locally administered etheraddr. */
849
	getcredhostid(curthread->td_ucred, &hostid );
850
	if ( hostid == 0 ) 
851
		arc4rand( &hostid, (sizeof(unsigned long)), 0);
852
839
	eaddr[0] = 0x02;
853
	eaddr[0] = 0x02;
854
	eaddr[1] = ( hostid >> 8 ) & 0xff;
855
	eaddr[2] = hostid & 0xff;
840
	eaddr[3] = (ifp->if_index >> 8) & 0xff;
856
	eaddr[3] = (ifp->if_index >> 8) & 0xff;
841
	eaddr[4] = ifp->if_index & 0xff;
857
	eaddr[4] = ifp->if_index & 0xff;
842
	eaddr[5] = 0x0a;
858
	eaddr[5] = 0x0a;

Return to bug 184149