• Herbert Xu's avatar
    [PACKET]: Add optional checksum computation for recvmsg · 8dc41944
    Herbert Xu authored
    This patch is needed to make ISC's DHCP server (and probably other
    DHCP servers/clients using AF_PACKET) to be able to serve another
    client on the same Xen host.
    
    The problem is that packets between different domains on the same
    Xen host only have partial checksums.  Unfortunately this piece of
    information is not passed along in AF_PACKET unless you're using
    the mmap interface.  Since dhcpd doesn't support packet-mmap, UDP
    packets from the same host come out with apparently bogus checksums.
    
    This patch adds a mechanism for AF_PACKET recvmsg(2) to return the
    status along with the packet.  It does so by adding a new cmsg that
    contains this information along with some other relevant data such
    as the original packet length.
    
    I didn't include the time stamp information since there is already
    a cmsg for that.
    
    This patch also changes the mmap code to set the CSUMNOTREADY flag
    on all packets instead of just outoing packets on cooked sockets.
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8dc41944
af_packet.c 43.4 KB