* [ECOS] redboot's Ethernet packet handlers
@ 2001-04-12 8:34 Robin Farine
2001-04-12 9:08 ` Mark Salter
0 siblings, 1 reply; 2+ messages in thread
From: Robin Farine @ 2001-04-12 8:34 UTC (permalink / raw)
To: ecos-discuss
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ECOS] redboot's Ethernet packet handlers
2001-04-12 8:34 [ECOS] redboot's Ethernet packet handlers Robin Farine
@ 2001-04-12 9:08 ` Mark Salter
0 siblings, 0 replies; 2+ messages in thread
From: Mark Salter @ 2001-04-12 9:08 UTC (permalink / raw)
To: acnrf; +Cc: ecos-discuss
>>>>> Robin Farine writes:
> 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.
Thanks for the patch Robin! I will commit this to cvs.
--Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-04-12 9:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-12 8:34 [ECOS] redboot's Ethernet packet handlers Robin Farine
2001-04-12 9:08 ` Mark Salter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).