Subject: Re: Ethersubr fix for netiso
To: None <>
From: Christos Zoulas <>
List: tech-net
Date: 12/01/2006 16:28:08
In article <>,
Ignatios Souvatzis  <> wrote:
>when Perry asked for NETISO testing code, I wrote some, and found bugs.
>Basically, when ether_input() calls (indirectly) clnp_input(), it does
>horrible things. 
>Namely, it does an overlapping struct assign (on a memory area
>formerly m_adj'ed away!) which might have worked with ancient
>compilers, but creates address corruption now. (== netbsd-3-1).
>All  to get rid of the intermediate 3-byte 802.x llc field.
>As the clnp_input is aware of being called by ethernet anyway (and
>sort of needs to), I decided to just give it the full ethernet
>header with llc, and let it throw it away itself (it does an m_adj
>itself, so this is for free). Saving in the ISO networking path:
>two memcpy if done right, one memmove if the current code was 
>trivially repaired.
>I suspect that any modern compiler would integrate one additional
>compare-to-constant and and conditional branch (which are executed 
>additionally for the DIX protocols) into the big DIX switch, so no
>cost created there, or else, say, 2 instruction cycles (== about one
>nanosecond for modern machines).
>if_fddisubr and if_tokensubr will need similar patches; at least for
>fddi this won't create a penalty because it hasn't any DIX type
>field, so there's a convenient switch case already to move the
>m_adj() to.
>Any comments?
>(Code is tested for AF_INET, AF_INET6 and AF_ISO).

Looks fine to me.