12.6Reading Current and Default MAC Addresses (SIOCRPHYSADDR ioctl Command)
The following code shows how the el_ioctl( ) routine implements the SIOCRPHYSADDR ioctl command to read the current and default MAC addresses when an application requests them:
case SIOCRPHYSADDR: 1
j =
}
break;
1
2
3
Determines whether the cmd argument is SIOCRPHYSADDR.
Copies the current MAC address that is stored in the el_softc data structure for this device to the ifd data structure, a
Copies the default MAC address that is stored in the driver’s el_softc data structure for this device to the ifd data structure.
12.7Setting the Local MAC Address (SIOCSPHYSADDR ioctl Command)
The following code shows how the el_ioctl( ) routine implements the SIOCSPHYSADDR ioctl command to set the local MAC address:
case SIOCSPHYSADDR: 1
2
if
}
lock_on = 0; 7
3
if (((struct arpcom
}
8
if_sphyaddr(ifp, ifr); break;
9
1
2
3
Determines whether the cmd argument is SIOCSPHYSADDR ioctl.
Copies the new MAC address to the ifnet data structure.
Calls the pfilt_newaddress( ) routine to copy the new address to the packet filter.
Implementing the ioctl Section