Sam Steingold writes:
> > > still awaiting demo code for checksum functions.
> > These will only be useful when you want to send raw packets.
> > We've not yet discussed when this might be useful.
> the functions are there.
> ergo, they are useful for _something_.
I don't think this follows - I don't want to admit it for CONFIGDEV
> can we have an example?
They're useful when you want to send ip packets from a "raw" socket -
one created with either AF packet or AF ip and type packet. A socket
created with AF ip and type raw, by contrast, I'll call an "ip" socket.
I'm trying to decide whether I think that's strictly necessary. Even
if it's not, it might be convenient in cases where you are using the
same raw socket for everything and you happen to want to send ip
packets. It would be necessary to use a raw socket, and therefore to
compute checksums, if you wanted to control the ethernet header of IP
packets. I've never tried all the stuff for controlling the IP fields
from an ip socket, so I'm not sure whether you ever have to compute
checksums in that case. The impression I got from the man page was
that you could control everything that made sense and in the end the
checksum would be computed for you. Of course, if you want to send
illegal IP packets then you almost certainly need to use raw sockets.
And in that case if you want to send correct checksums then the
checksum functions are handy. Even if you want to send incorrect
checksums that are closely related to correct checksums, e.g., with
the bytes swapped, it's handy to have checksum functions.