Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / devs / networks / pcnet32 / handler.c
blob0970c8e9716c04b265636fb3717be5f50c1bb513
1 /*
2 * $Id$
3 */
5 /*
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19 MA 02111-1307, USA.
22 #include <exec/types.h>
23 #include <exec/resident.h>
24 #include <exec/io.h>
25 #include <exec/ports.h>
26 #include <exec/errors.h>
28 #include <devices/sana2.h>
29 #include <devices/sana2specialstats.h>
30 #include <devices/newstyle.h>
32 #include <utility/utility.h>
33 #include <utility/tagitem.h>
34 #include <utility/hooks.h>
36 #include <proto/exec.h>
37 #include <proto/dos.h>
38 #include <proto/battclock.h>
40 #include <stdlib.h>
42 #include "pcnet32.h"
43 #include "unit.h"
44 #include LC_LIBDEFS_FILE
46 #define KNOWN_EVENTS \
47 (S2EVENT_ERROR | S2EVENT_TX | S2EVENT_RX | S2EVENT_ONLINE \
48 | S2EVENT_OFFLINE | S2EVENT_BUFF | S2EVENT_HARDWARE | S2EVENT_SOFTWARE)
50 static BOOL CmdInvalid(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
51 static BOOL CmdRead(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
52 static BOOL CmdWrite(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
53 static BOOL CmdFlush(LIBBASETYPEPTR LIBBASE, struct IORequest *request);
54 static BOOL CmdS2DeviceQuery(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
55 static BOOL CmdGetStationAddress(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
56 static BOOL CmdConfigInterface(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
57 static BOOL CmdBroadcast(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
58 static BOOL CmdTrackType(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
59 static BOOL CmdUntrackType(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
60 static BOOL CmdGetTypeStats(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
61 static BOOL CmdGetGlobalStats(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
62 static BOOL CmdDeviceQuery(LIBBASETYPEPTR LIBBASE, struct IOStdReq *request);
63 static BOOL CmdOnEvent(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
64 static BOOL CmdReadOrphan(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
65 static BOOL CmdOnline(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
66 static BOOL CmdOffline(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
67 static BOOL CmdAddMulticastAddresses(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
68 static BOOL CmdDelMulticastAddresses(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request);
70 static const UWORD supported_commands[] =
72 CMD_READ,
73 CMD_WRITE,
74 CMD_FLUSH,
75 S2_DEVICEQUERY,
76 S2_GETSTATIONADDRESS,
77 S2_CONFIGINTERFACE,
78 S2_ADDMULTICASTADDRESS,
79 S2_DELMULTICASTADDRESS,
80 S2_MULTICAST,
81 S2_BROADCAST,
82 S2_TRACKTYPE,
83 S2_UNTRACKTYPE,
84 S2_GETTYPESTATS,
85 // S2_GETSPECIALSTATS,
86 S2_GETGLOBALSTATS,
87 S2_ONEVENT,
88 S2_READORPHAN,
89 S2_ONLINE,
90 S2_OFFLINE,
91 NSCMD_DEVICEQUERY,
92 S2_ADDMULTICASTADDRESSES,
93 S2_DELMULTICASTADDRESSES,
97 void handle_request(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
99 BOOL complete;
101 switch(request->ios2_Req.io_Command)
103 case CMD_READ:
104 complete = CmdRead(LIBBASE, request);
105 break;
107 case CMD_WRITE:
108 case S2_MULTICAST:
109 complete = CmdWrite(LIBBASE, request);
110 break;
112 case CMD_FLUSH:
113 complete = CmdFlush(LIBBASE, (struct IORequest *)request);
114 break;
116 case S2_DEVICEQUERY:
117 complete = CmdS2DeviceQuery(LIBBASE, request);
118 break;
120 case S2_GETSTATIONADDRESS:
121 complete = CmdGetStationAddress(LIBBASE, request);
122 break;
124 case S2_CONFIGINTERFACE:
125 complete = CmdConfigInterface(LIBBASE, request);
126 break;
128 case S2_BROADCAST:
129 complete = CmdBroadcast(LIBBASE, request);
130 break;
132 case S2_TRACKTYPE:
133 complete = CmdTrackType(LIBBASE, request);
134 break;
136 case S2_UNTRACKTYPE:
137 complete = CmdUntrackType(LIBBASE, request);
138 break;
140 case S2_GETTYPESTATS:
141 complete = CmdGetTypeStats(LIBBASE, request);
142 break;
144 case S2_GETGLOBALSTATS:
145 complete = CmdGetGlobalStats(LIBBASE, request);
146 break;
148 case S2_ONEVENT:
149 complete = CmdOnEvent(LIBBASE, request);
150 break;
152 case S2_READORPHAN:
153 complete = CmdReadOrphan(LIBBASE, request);
154 break;
156 case S2_ONLINE:
157 complete = CmdOnline(LIBBASE, request);
158 break;
160 case S2_OFFLINE:
161 complete = CmdOffline(LIBBASE, request);
162 break;
164 case S2_ADDMULTICASTADDRESS:
165 case S2_ADDMULTICASTADDRESSES:
166 complete = CmdAddMulticastAddresses(LIBBASE, request);
167 break;
169 case S2_DELMULTICASTADDRESS:
170 case S2_DELMULTICASTADDRESSES:
171 complete = CmdDelMulticastAddresses(LIBBASE, request);
172 break;
174 case NSCMD_DEVICEQUERY:
175 complete = CmdDeviceQuery(LIBBASE, (struct IOStdReq *)request);
176 break;
178 default:
179 complete = CmdInvalid(LIBBASE, request);
182 if(complete && (request->ios2_Req.io_Flags & IOF_QUICK) == 0)
183 ReplyMsg((APTR)request);
185 ReleaseSemaphore(&((struct PCN32Unit *)request->ios2_Req.io_Unit)->pcnu_unit_lock);
188 static BOOL CmdInvalid(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
190 request->ios2_Req.io_Error = IOERR_NOCMD;
191 request->ios2_WireError = S2WERR_GENERIC_ERROR;
193 return TRUE;
196 static BOOL CmdRead(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
198 struct PCN32Unit *unit;
199 struct Opener *opener;
200 BOOL complete = FALSE;
202 unit = (APTR)request->ios2_Req.io_Unit;
204 D(bug("%s: S2CmdRead()\n", unit->pcnu_name));
206 if((unit->pcnu_flags & IFF_UP) != 0)
208 opener = request->ios2_BufferManagement;
209 request->ios2_Req.io_Flags &= ~IOF_QUICK;
210 PutMsg(&opener->read_port, (struct Message *)request);
212 else
214 request->ios2_Req.io_Error = S2ERR_OUTOFSERVICE;
215 request->ios2_WireError = S2WERR_UNIT_OFFLINE;
216 complete = TRUE;
219 /* Return */
221 return complete;
224 static BOOL CmdWrite(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
226 struct PCN32Unit *unit;
227 BYTE error = 0;
228 ULONG wire_error = S2WERR_GENERIC_ERROR;
229 BOOL complete = FALSE;
231 /* Check request is valid */
233 unit = (APTR)request->ios2_Req.io_Unit;
235 D(bug("%s: S2CmdWrite()\n", unit->pcnu_name));
237 if((unit->pcnu_flags & IFF_UP) == 0)
239 error = S2ERR_OUTOFSERVICE;
240 wire_error = S2WERR_UNIT_OFFLINE;
242 else if((request->ios2_Req.io_Command == S2_MULTICAST) &&
243 ((request->ios2_DstAddr[0] & 0x1) == 0))
245 error = S2ERR_BAD_ADDRESS;
246 wire_error = S2WERR_BAD_MULTICAST;
249 /* Queue request for sending */
251 if(error == 0) {
252 request->ios2_Req.io_Flags &= ~IOF_QUICK;
253 PutMsg(unit->pcnu_request_ports[WRITE_QUEUE], (APTR)request);
255 else
257 request->ios2_Req.io_Error = error;
258 request->ios2_WireError = wire_error;
259 complete = TRUE;
262 /* Return */
264 return complete;
267 static BOOL CmdFlush(LIBBASETYPEPTR LIBBASE, struct IORequest *request)
269 FlushUnit(LIBBASE, (APTR)request->io_Unit, EVENT_QUEUE, IOERR_ABORTED);
270 return TRUE;
273 static BOOL CmdS2DeviceQuery(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
275 struct PCN32Unit *unit = (APTR)request->ios2_Req.io_Unit;
276 struct fe_priv *np = unit->pcnu_fe_priv;
277 struct Sana2DeviceQuery *info;
278 ULONG size_available, size;
280 D(bug("%s: S2CmdDeviceQuery()\n", unit->pcnu_name));
282 /* Copy device info */
284 info = request->ios2_StatData;
285 size = size_available = info->SizeAvailable;
286 if(size > sizeof(struct Sana2DeviceQuery))
287 size = sizeof(struct Sana2DeviceQuery);
289 CopyMem(&LIBBASE->pcnb_Sana2Info, info, size);
291 info->BPS = 100000000;
292 info->MTU = ETH_MTU;
293 info->HardwareType = S2WireType_Ethernet;
294 info->SizeAvailable = size_available;
295 info->SizeSupplied = size;
297 /* Return */
299 return TRUE;
302 static BOOL CmdGetStationAddress(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
304 struct PCN32Unit *unit;
306 /* Copy addresses */
308 unit = (APTR)request->ios2_Req.io_Unit;
310 D(bug("%s: S2CmdGetStationAddress()\n", unit->pcnu_name));
312 CopyMem(unit->pcnu_dev_addr, request->ios2_SrcAddr, ETH_ADDRESSSIZE);
313 CopyMem(unit->pcnu_org_addr, request->ios2_DstAddr, ETH_ADDRESSSIZE);
315 /* Return */
317 return TRUE;
320 static BOOL CmdConfigInterface(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
322 struct PCN32Unit *unit;
324 /* Configure adapter */
326 unit = (APTR)request->ios2_Req.io_Unit;
328 D(bug("%s: S2CmdConfigInterface()\n", unit->pcnu_name));
330 if((unit->pcnu_flags & IFF_CONFIGURED) == 0)
332 CopyMem(request->ios2_SrcAddr, unit->pcnu_dev_addr, ETH_ADDRESSSIZE);
333 unit->set_mac_address(unit);
334 unit->pcnu_flags |= IFF_CONFIGURED;
336 else
338 request->ios2_Req.io_Error = S2ERR_BAD_STATE;
339 request->ios2_WireError = S2WERR_IS_CONFIGURED;
342 /* Return */
344 return TRUE;
347 static BOOL CmdBroadcast(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
349 /* Fill in the broadcast address as destination */
351 *((ULONG *)request->ios2_DstAddr) = 0xffffffff;
352 *((UWORD *)(request->ios2_DstAddr + 4)) = 0xffff;
354 /* Queue the write as normal */
356 return CmdWrite(LIBBASE, request);
359 static BOOL CmdTrackType(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
361 struct PCN32Unit *unit;
362 struct Opener *opener;
363 ULONG packet_type, wire_error=0;
364 struct TypeTracker *tracker;
365 struct TypeStats *initial_stats;
366 BYTE error = 0;
368 unit = (APTR)request->ios2_Req.io_Unit;
370 D(bug("%s: S2CmdTrackType()\n", unit->pcnu_name));
372 packet_type = request->ios2_PacketType;
374 /* Get global tracker */
376 tracker = (struct TypeTracker *)
377 FindTypeStats(LIBBASE, unit, &unit->pcnu_type_trackers, packet_type);
379 if(tracker != NULL)
380 tracker->user_count++;
381 else
383 tracker =
384 AllocMem(sizeof(struct TypeTracker), MEMF_PUBLIC|MEMF_CLEAR);
385 if(tracker != NULL)
387 tracker->packet_type = packet_type;
388 tracker->user_count = 1;
390 Disable();
391 AddTail((APTR)&unit->pcnu_type_trackers, (APTR)tracker);
392 Enable();
396 /* Store initial figures for this opener */
398 opener = request->ios2_BufferManagement;
399 initial_stats = FindTypeStats(LIBBASE, unit, &opener->initial_stats, packet_type);
401 if(initial_stats != NULL)
403 error = S2ERR_BAD_STATE;
404 wire_error = S2WERR_ALREADY_TRACKED;
407 if(error == 0)
409 initial_stats = AllocMem(sizeof(struct TypeStats), MEMF_PUBLIC);
410 if(initial_stats == NULL)
412 error = S2ERR_NO_RESOURCES;
413 wire_error = S2WERR_GENERIC_ERROR;
417 if(error == 0)
419 CopyMem(tracker, initial_stats, sizeof(struct TypeStats));
420 AddTail((APTR)&opener->initial_stats, (APTR)initial_stats);
423 /* Return */
425 request->ios2_Req.io_Error = error;
426 request->ios2_WireError = wire_error;
427 return TRUE;
430 static BOOL CmdUntrackType(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
432 struct PCN32Unit *unit;
433 struct Opener *opener;
434 ULONG packet_type;
435 struct TypeTracker *tracker;
436 struct TypeStats *initial_stats;
438 unit = (APTR)request->ios2_Req.io_Unit;
440 D(bug("%s: S2CmdUntrackType()\n", unit->pcnu_name));
442 packet_type = request->ios2_PacketType;
444 /* Get global tracker and initial figures */
446 tracker = (struct TypeTracker *)
447 FindTypeStats(LIBBASE, unit, &unit->pcnu_type_trackers, packet_type);
448 opener = request->ios2_BufferManagement;
449 initial_stats = FindTypeStats(LIBBASE, unit, &opener->initial_stats, packet_type);
451 /* Decrement tracker usage and free unused structures */
453 if(initial_stats != NULL)
455 if((--tracker->user_count) == 0)
457 Disable();
458 Remove((APTR)tracker);
459 Enable();
460 FreeMem(tracker, sizeof(struct TypeTracker));
463 Remove((APTR)initial_stats);
464 FreeMem(initial_stats, sizeof(struct TypeStats));
466 else
468 request->ios2_Req.io_Error = S2ERR_BAD_STATE;
469 request->ios2_WireError = S2WERR_NOT_TRACKED;
472 /* Return */
474 return TRUE;
477 static BOOL CmdGetTypeStats(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
479 struct PCN32Unit *unit;
480 struct Opener *opener;
481 ULONG packet_type;
482 struct TypeStats *initial_stats, *tracker;
483 struct Sana2PacketTypeStats *stats;
485 unit = (APTR)request->ios2_Req.io_Unit;
487 D(bug("%s: S2CmdGetTypeStats()\n", unit->pcnu_name));
489 packet_type = request->ios2_PacketType;
491 /* Get global tracker and initial figures */
493 tracker = FindTypeStats(LIBBASE, unit, &unit->pcnu_type_trackers, packet_type);
494 opener = request->ios2_BufferManagement;
495 initial_stats = FindTypeStats(LIBBASE, unit, &opener->initial_stats, packet_type);
497 /* Copy and adjust figures */
498 if(initial_stats != NULL)
500 stats = request->ios2_StatData;
501 CopyMem(&tracker->stats, stats, sizeof(struct Sana2PacketTypeStats));
502 stats->PacketsSent -= initial_stats->stats.PacketsSent;
503 stats->PacketsReceived -= initial_stats->stats.PacketsReceived;
504 stats->BytesSent -= initial_stats->stats.BytesSent;
505 stats->BytesReceived -= initial_stats->stats.BytesReceived;
506 stats->PacketsDropped -= initial_stats->stats.PacketsDropped;
508 else
510 request->ios2_Req.io_Error = S2ERR_BAD_STATE;
511 request->ios2_WireError = S2WERR_NOT_TRACKED;
514 /* Return */
516 return TRUE;
519 static BOOL CmdGetGlobalStats(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
521 struct PCN32Unit *unit;
523 /* Update and copy stats */
525 unit = (APTR)request->ios2_Req.io_Unit;
527 D(bug("%s: S2CmdGetGlobalStats()\n", unit->pcnu_name));
529 CopyMem(&unit->pcnu_stats, request->ios2_StatData,
530 sizeof(struct Sana2DeviceStats));
532 /* Return */
534 return TRUE;
537 static BOOL CmdDeviceQuery(LIBBASETYPEPTR LIBBASE, struct IOStdReq *request)
539 struct NSDeviceQueryResult *info;
541 /* Set structure size twice */
543 info = request->io_Data;
544 request->io_Actual = info->SizeAvailable =
545 offsetof(struct NSDeviceQueryResult, SupportedCommands) + sizeof(APTR);
547 /* Report device details */
549 info->DeviceType = NSDEVTYPE_SANA2;
550 info->DeviceSubType = 0;
552 info->SupportedCommands = (APTR)supported_commands;
554 /* Return */
556 return TRUE;
559 static BOOL CmdOnEvent(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
561 struct PCN32Unit *unit;
562 ULONG events, wanted_events;
563 BOOL complete = FALSE;
565 /* Check if we understand the event types */
567 unit = (APTR)request->ios2_Req.io_Unit;
569 D(bug("%s: S2CmdOnEvent()\n", unit->pcnu_name));
571 wanted_events = request->ios2_WireError;
572 if((wanted_events & ~KNOWN_EVENTS) != 0)
574 request->ios2_Req.io_Error = S2ERR_NOT_SUPPORTED;
575 events = S2WERR_BAD_EVENT;
577 else
579 if((unit->pcnu_flags & IFF_UP) != 0)
580 events = S2EVENT_ONLINE;
581 else
582 events = S2EVENT_OFFLINE;
584 events &= wanted_events;
587 /* Reply request if a wanted event has already occurred */
589 if(events != 0)
591 request->ios2_WireError = events;
592 complete = TRUE;
594 else
596 request->ios2_Req.io_Flags &= ~IOF_QUICK;
597 PutMsg(unit->pcnu_request_ports[EVENT_QUEUE], (APTR)request);
600 /* Return */
602 return complete;
605 static BOOL CmdReadOrphan(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
607 struct PCN32Unit *unit;
608 BYTE error = 0;
609 ULONG wire_error;
610 BOOL complete = FALSE;
612 /* Check request is valid */
614 unit = (APTR)request->ios2_Req.io_Unit;
615 D(bug("%s: S2CmdReadOrphan()\n", unit->pcnu_name));
617 if((unit->pcnu_flags & IFF_UP) == 0)
619 error = S2ERR_OUTOFSERVICE;
620 wire_error = S2WERR_UNIT_OFFLINE;
623 /* Queue request */
625 if(error == 0)
627 request->ios2_Req.io_Flags &= ~IOF_QUICK;
628 PutMsg(unit->pcnu_request_ports[ADOPT_QUEUE], (struct Message *)request);
630 else
632 request->ios2_Req.io_Error = error;
633 request->ios2_WireError = wire_error;
634 complete = TRUE;
637 /* Return */
639 return complete;
642 static BOOL CmdOnline(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
644 struct PCN32Unit *unit = (struct PCN32Unit *)request->ios2_Req.io_Unit;
645 BYTE error = 0;
646 ULONG wire_error = 0;
647 UWORD i;
649 D(bug("%s: S2CmdOnline()\n", unit->pcnu_name));
651 /* Check request is valid */
652 if((unit->pcnu_flags & IFF_CONFIGURED) == 0)
654 error = S2ERR_BAD_STATE;
655 wire_error = S2WERR_NOT_CONFIGURED;
658 /* Clear global and special stats and put adapter back online */
660 if((error == 0) && ((unit->pcnu_flags & IFF_UP) == 0))
662 unit->pcnu_stats.PacketsReceived = 0;
663 unit->pcnu_stats.PacketsSent = 0;
664 unit->pcnu_stats.BadData = 0;
665 unit->pcnu_stats.Overruns = 0;
666 unit->pcnu_stats.UnknownTypesReceived = 0;
667 unit->pcnu_stats.Reconfigurations = 0;
669 for(i = 0; i < STAT_COUNT; i++)
670 unit->pcnu_special_stats[i] = 0;
672 if (unit->start(unit)) {
673 error = S2ERR_OUTOFSERVICE;
674 wire_error = S2WERR_GENERIC_ERROR;
678 /* Return */
680 request->ios2_Req.io_Error = error;
681 request->ios2_WireError = wire_error;
682 return TRUE;
685 static BOOL CmdOffline(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
687 struct PCN32Unit *unit;
689 /* Put adapter offline */
691 unit = (APTR)request->ios2_Req.io_Unit;
693 D(bug("%s: S2CmdOffline()\n", unit->pcnu_name));
695 if((unit->pcnu_flags & IFF_UP) != 0)
696 unit->stop(unit);
698 /* Return */
699 return TRUE;
702 static BOOL CmdAddMulticastAddresses(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
704 struct PCN32Unit *unit;
705 UBYTE *lower_bound, *upper_bound;
707 unit = (APTR)request->ios2_Req.io_Unit;
709 D(bug("%s: S2CmdAddMulticastAddresses()\n", unit->pcnu_name));
711 lower_bound = request->ios2_SrcAddr;
712 if(request->ios2_Req.io_Command == S2_ADDMULTICASTADDRESS)
713 upper_bound = lower_bound;
714 else
715 upper_bound = request->ios2_DstAddr;
717 if(!AddMulticastRange(LIBBASE, unit, lower_bound, upper_bound))
719 request->ios2_Req.io_Error = S2ERR_NO_RESOURCES;
720 request->ios2_WireError = S2WERR_GENERIC_ERROR;
723 /* Return */
725 return TRUE;
728 static BOOL CmdDelMulticastAddresses(LIBBASETYPEPTR LIBBASE, struct IOSana2Req *request)
730 struct PCN32Unit *unit;
731 UBYTE *lower_bound, *upper_bound;
733 unit = (APTR)request->ios2_Req.io_Unit;
735 D(bug("%s: S2CmdDelMulticastAddresses()\n", unit->pcnu_name));
737 lower_bound = request->ios2_SrcAddr;
738 if(request->ios2_Req.io_Command == S2_DELMULTICASTADDRESS)
739 upper_bound = lower_bound;
740 else
741 upper_bound = request->ios2_DstAddr;
743 if(!RemMulticastRange(LIBBASE, unit, lower_bound, upper_bound))
745 request->ios2_Req.io_Error = S2ERR_BAD_STATE;
746 request->ios2_WireError = S2WERR_BAD_MULTICAST;
749 /* Return */
751 return TRUE;