OK, Apologies for my slowness, it's just been one of those slow days. Y'know 
not enough coffee, too much food? Like that. One of our cats didn't help at 
about 2am either.

So I get a TCP packet together and send it through (the now correctly 
optioned) socket. sendto fails and returns -1, derefencing __error() gives us 
22=EINVAL. A little searching around reveals this to be a prevention of user 
error fix that went in at some point comparing the length of the buffer sent 
to sendto and the stated length of the IP packet - if there was a difference 
the packet doesn't get sent, presumably to prevent the random contents of 
memory being spilled across the network.

This is all good, but as Pascal Bouchareine <pb at hert dot org> points out 
in PR21737 (http://www.FreeBSD.org/cgi/query-pr.cgi?pr=21737) the part of the 
raw IP code that is responsible for this doesn't convert network to host byte 
order first and consequently the comparison will always fail for valid 
packets.

This effectively stops anyone from being able to spoof TCP/UDP packets since 
it is impossible to have both the correct checksum, and get past this length 
check thing. Unless the length of the packet is 'symmetrical' in hex, but I 
digress.

I've just applied Pascal's suggested patch (althought I just went in and did 
it manually) to my 4.3-Release development machine and it works fine. Can 
someone commit this patch to -current, or -stable, or do whatever it is you 
do :)

Cheers,
Dave

BTW: A personal note - I used to code for windows, and increasingly have 
crawled down the abstraction layers throught my career (mainly trying to get 
away from API of the week and get on with writing quality code). This is the 
first time I've actually gone into the source, fixed it, and made my 
previously broken kernel work properly. It feels unbelievable, I can't 
believe what Ethereal is telling me just happened. I may be going to pick up 
some of those 'junior kernel hacker' tasks soon and see what I can do with 
them. But not yet, deadlines and baby are coming :) Anyway, over the last 18 
months I have _SO_ become a convert.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to