From: Wei Yongjun <[EMAIL PROTECTED]>
Date: Thu, 23 Feb 2006 16:03:18 -0500

> IPv4 UDP does not discard the datagram with invalid checksum. UDP can
> validate UDP checksums correctly only when socket filtering instructions
> is set. If socket filtering instructions is not set, datagram with
> invalid checksum will be passed to the application.

We check the checksum later, in parallel with the copy of
the packet data into userspace.

See udp_recvmsg(), where we do this:

        if (skb->ip_summed==CHECKSUM_UNNECESSARY) {
                err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), 
msg->msg_iov,
                                              copied);
        } else if (msg->msg_flags&MSG_TRUNC) {
                if (__udp_checksum_complete(skb))
                        goto csum_copy_err;
                err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), 
msg->msg_iov,
                                              copied);
        } else {
                err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct 
udphdr), msg->msg_iov);

                if (err == -EINVAL)
                        goto csum_copy_err;
        }

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to