This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

redboot's Ethernet packet handlers


Hi,

The Ethernet packet handler mechanism in redboot fails when a node receives a
frame with a length/type field of 0 (this can happen, believe me ;-)). Moreover,
specifying a handler with a type value less than 0x800 does not make sense since
such a value represents a length, not a type. A possible modification of
redboot/current/src/net/enet.c follows.

2001-04-12  Robin Farine  <acnrf@dial.eunet.ch>

	* src/net/enet.c (__eth_install_listener): Does not accept a
	handler for an eth_type less than 0x800.
	(__enet_poll): Only scan the handlers for a frame type greater
	than 0x800.

-------------------------<snip>-----------------------------------------
Index: enet.c
===================================================================
RCS file: /usr/cvs/eCos/base/packages/redboot/current/src/net/enet.c,v
retrieving revision 1.1.1.2
diff -r1.1.1.2 enet.c
77a78,84
>     if (eth_type <= 0x800 || handler == (pkt_handler_t)0) {
>       /* A value less than 0x800 defines the frame length, not a frame type! */
>       printf("** Warning: invalid ethernet listener type 0x%02x or handler\n",
>              eth_type);
>       return (pkt_handler_t)0;
>     }
> 
174,176c181,185
<                 for (i = 0;  i < NUM_EXTRA_HANDLERS;  i++) {
<                     if (eth_handlers[i].type == type) {
<                         (eth_handlers[i].handler)(pkt, &eth_hdr);
---
>                 if (type > 0x800) {
>                     for (i = 0;  i < NUM_EXTRA_HANDLERS;  i++) {
>                         if (eth_handlers[i].type == type) {
>                             (eth_handlers[i].handler)(pkt, &eth_hdr);
>                         }
-------------------------<snip>-----------------------------------------

Robin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]