4

5

6

7

8

9

If the 3Com 3C5x9 device is running, calls the el_reset_locked( ) routine to restart the network interface with the new address.

Calls the simple_unlock( ) routine to release the simple lock for the resource that is associated with el_softc_lock.

Calls the splx( ) routine to reset the CPU priority to the level that the s variable specifies.

Sets the lock_on variable to 0 (false), which indicates that the simple lock is no longer held.

If an IP address was configured, broadcasts an ARP packet to notify all hosts that currently have this address in their ARP tables to update their information.

Notifies the network layer about a possible change in the af_link address.

12.8Adding the Device to a Multicast Group (SIOCADDMULTI ioctl Command)

The following code shows how the el_ioctl( ) routine implements the SIOCADDMULTI ioctl command to add a multicast address:

case SIOCADDMULTI:

1

need_reset = 0;

if (bcmp(ifr->ifr_addr.sa_data, etherbroadcastaddr, 6) == 0) { sc->is_broadcast++;

}else {

i= lan_add_multi(&sc->is_multi,

(unsigned char *)ifr->ifr_addr.sa_data);

switch (i) {

case LAN_MULTI_CHANGED:

if (sc->is_multi.lan_nmulti == 1) 3 need_reset++;

break;

case LAN_MULTI_NOT_CHANGED: break;

case LAN_MULTI_FAILED: default:

status = EINVAL; break;

}

}

2

if ((ifp->if_flags & IFF_RUNNING) && (need_reset)) el_reset_locked(sc, ifp, unit);

4

if (sc->debug) { j = 0;

printf("el%d: Dump of multicast table after ADD (%d entries)\n", unit, sc->is_multi.lan_nmulti);

for (i=0; i<sc->is_multi.lan_nmulti; i++) { unsigned char *maddr;

LAN_GET_MULTI(&sc->is_multi, maddr, j); printf(" %d %s (muse==%d)\n", i+1,

12–6Implementing the ioctl Section

Page 130
Image 130
Compaq AA-RNG2A-TE manual 12-6Implementing the ioctl Section