This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
redboot's Ethernet packet handlers
- To: ecos-discuss at sources dot redhat dot com
- Subject: [ECOS] redboot's Ethernet packet handlers
- From: Robin Farine <acnrf at dial dot eunet dot ch>
- Date: 12 Apr 2001 17:11:25 +0200
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, ð_hdr);
---
> if (type > 0x800) {
> for (i = 0; i < NUM_EXTRA_HANDLERS; i++) {
> if (eth_handlers[i].type == type) {
> (eth_handlers[i].handler)(pkt, ð_hdr);
> }
-------------------------<snip>-----------------------------------------
Robin