click 1.0.5 -- patch
Richard Mortier
Richard.Mortier at cl.cam.ac.uk
Wed May 3 19:03:15 EDT 2000
Hi,
Another patch, this time for EtherEncap and UDPEncap. It appears
that EtherEncap, when "pushing" the sk_buff to get space for the
14 byte Ethernet header, forgets to pull the data pointer into
the sk_buff up to the head pointer. This results in the Ethernet
header getting smacked over the first 14 bytes of the IP Header.
In UDPEncap, there is a missing htons() around the length field,
and it also doesn't seem to use the _cksum flag to decide whether
to checksum or not. I've assumed that the flag decides whether
the checksum is the calculated value, or 0 for a "lazy" host.
Patch appended to this mail.
--
Richard Mortier --------------------
----------------- ------ Computer Laboratory,
rmm1002 at cam.ac.uk ----- University of Cambridge, UK
mort at ieee.org ---- http://www.cl.cam.ac.uk/~rmm1002/
diff -ur /usr/groups/srgnet/click-1.0.5-pristine/elements/standard/udpencap.cc click-1.0.5/elements/standard/udpencap.cc
--- /usr/groups/srgnet/click-1.0.5-pristine/elements/standard/udpencap.cc Wed Mar 29 16:38:31 2000
+++ click-1.0.5/elements/standard/udpencap.cc Wed May 3 16:35:18 2000
@@ -62,8 +62,8 @@
udp->uh_sport = htons(_sport);
udp->uh_dport = htons(_dport);
- udp->uh_ulen = p->length();
- udp->uh_sum = in_cksum(p->data(), p->length());
+ udp->uh_ulen = htons(p->length());
+ udp->uh_sum = (_cksum? in_cksum(p->data(), p->length()) : 0);
return p;
}
diff -ur /usr/groups/srgnet/click-1.0.5-pristine/lib/packet.cc click-1.0.5/lib/packet.cc
--- /usr/groups/srgnet/click-1.0.5-pristine/lib/packet.cc Sat Apr 29 04:09:32 2000
+++ click-1.0.5/lib/packet.cc Wed May 3 17:30:51 2000
@@ -196,6 +196,7 @@
click_chatter("expensive Packet::push");
#ifdef __KERNEL__
Packet *q = Packet::make(skb_realloc_headroom(skb(), nbytes));
+ (void)skb_push(q->skb(), nbytes);
#else
Packet *q = Packet::make(length() + nbytes);
memcpy(q->data() + nbytes, data(), length());
More information about the click
mailing list