On 2002.07.25 17:02 kuznet@xxxxxxxxxxxxx wrote:
> You have just made great discovery. :-)
>
> It was big puzzle why people blame that they see packets with zero MAC,
> sometimes. Apparently, this happens on the first packet, when hh cache
> is still not created. :-)
Yes, this was killing me too.
> I am not sure that this is right. Protocols using neighbour cache
> will work, but anothers will fail on NOARP devices.
>
> It is safer just to reorder two ifs, checking for daddr!=NULL first.
You mean like this:
--- eth.c.orig Thu Jul 25 17:50:20 2002
+++ eth.c Thu Jul 25 17:50:35 2002
@@ -96,6 +96,12 @@
else
memcpy(eth->h_source,dev->dev_addr,dev->addr_len);
+ if(daddr)
+ {
+ memcpy(eth->h_dest,daddr,dev->addr_len);
+ return dev->hard_header_len;
+ }
+
/*
* Anyway, the loopback-device should never use this
function...
*/
@@ -106,12 +112,6 @@
return(dev->hard_header_len);
}
- if(daddr)
- {
- memcpy(eth->h_dest,daddr,dev->addr_len);
- return dev->hard_header_len;
- }
-
return -dev->hard_header_len;
}
Karlis
|