diff options
| author | Stephen Hemminger <shemminger@osdl.org> | 2004-11-30 05:26:12 -0800 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2004-11-30 05:26:12 -0800 |
| commit | edea8fef1415a7499c09149b383a171e83480375 (patch) | |
| tree | 6b1d5b3edfcdb2c42e4dcfad91be4110480f6e53 /include | |
| parent | d21093c2d5b8d2663c7ae10499119b7cc2ae0308 (diff) | |
[UDP]: Select handling of bad checksums.
Alternate workaround for blocking usage of select() by UDP applications.
The problem is Linux optimizes the UDP receive checksum path so that checksum
validation is not performed until the application read. This is a performance win
but can cause applications that do select with blocking file descriptors to get false
positives if the received message has a checksum error.
There is a long running thread about this on LKML.
This patch makes these applications work, but keeps the one-pass performance gain
for those applications smart enough to use non-blocking file descriptors with
select/poll. There is still a possibility to get a false positive if application does
select on non-blocking fd then makes it blocking before doing the receive, but that
is unlikely.
Tested by injecting bad packets with SOCK_RAW.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/udp.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/udp.h b/include/net/udp.h index 2ef99a71bc30..c496d10101db 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -71,6 +71,8 @@ extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, extern int udp_rcv(struct sk_buff *skb); extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); extern int udp_disconnect(struct sock *sk, int flags); +extern unsigned int udp_poll(struct file *file, struct socket *sock, + poll_table *wait); DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); #define UDP_INC_STATS(field) SNMP_INC_STATS(udp_statistics, field) |
