1

2

3

4

5

ether_sprintf(maddr), sc->is_multi.lan_mtable[j-1].muse);

}

}

lan_build_mclist (mclist_buf, NET_SZ_MCLIST, &sc->is_multi); 5

lan_set_attribute(sc->ehm.current_val, NET_MCLIST_NDX, mclist_buf); break;

Determines whether the cmd argument is SIOCADDMULTI.

If the address is broadcast, indicates the presence of another broadcast user. If the address is multicast, the el_ioctl( ) routine adds the address to the table. The EtherLink III family does not support any multicast filtering. Either you receive all multicast addresses or you do not receive any. The EtherLink III family does special-case the broadcast address.

If the add succeeds and there are no other multicasts enabled, increments a counter that indicates that the device needs to be reset.

If the device is running and multicasts and broadcasts have not already been enabled, enables them.

Builds a text string that lists all currently active multicast addresses, and sets this list as an enhanced hardware management (EHM) attribute for this network device.

12.9Deleting the Device from a Multicast Group (SIOCDELMULTI ioctl Command)

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

case SIOCDELMULTI:

1

need_reset = 0;

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

}else {

i= lan_del_multi(&sc->is_multi,

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

switch (i) {

case LAN_MULTI_CHANGED:

if (sc->is_multi.lan_nmulti == 0) 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);

Implementing the ioctl Section 12–7

Page 131
Image 131
Compaq AA-RNG2A-TE manual Implementing the ioctl Section