This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / net / ipv4 / udp.c
index 519694c..0b5d21e 100644 (file)
@@ -530,7 +530,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                        return -EINVAL;
                if (usin->sin_family != AF_INET) {
                        if (usin->sin_family != AF_UNSPEC)
-                               return -EAFNOSUPPORT;
+                               return -EINVAL;
                }
 
                daddr = usin->sin_addr.s_addr;
@@ -1236,16 +1236,11 @@ int udp_rcv(struct sk_buff *skb)
        if (udp_checksum_complete(skb))
                goto csum_error;
 
-#if defined(CONFIG_VNET) || defined(CONFIG_VNET_MODULE)
-       if (vnet_active && skb->sk) {
-               /* VNET: Suppress ICMP Unreachable if the port was bound to a (presumably raw) socket */
-               kfree_skb(skb);
-               return 0;
+       /* VNET: Suppress ICMP Unreachable if the port was bound to a (presumably raw) socket */
+       if (!skb->sk) {
+               UDP_INC_STATS_BH(UDP_MIB_NOPORTS);
+               icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
        }
-#endif
-
-       UDP_INC_STATS_BH(UDP_MIB_NOPORTS);
-       icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
 
        /*
         * Hmm.  We got an UDP packet to a port to which we
@@ -1383,56 +1378,9 @@ static int udp_getsockopt(struct sock *sk, int level, int optname,
        return 0;
 }
 
-/**
- *     udp_poll - wait for a UDP event.
- *     @file - file struct
- *     @sock - socket
- *     @wait - poll table
- *
- *     This is same as datagram poll, except for the special case of 
- *     blocking sockets. If application is using a blocking fd
- *     and a packet with checksum error is in the queue;
- *     then it could get return from select indicating data available
- *     but then block when reading it. Add special case code
- *     to work around these arguably broken applications.
- */
-unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
-{
-       unsigned int mask = datagram_poll(file, sock, wait);
-       struct sock *sk = sock->sk;
-       
-       /* Check for false positives due to checksum errors */
-       if ( (mask & POLLRDNORM) &&
-            !(file->f_flags & O_NONBLOCK) &&
-            !(sk->sk_shutdown & RCV_SHUTDOWN)){
-               struct sk_buff_head *rcvq = &sk->sk_receive_queue;
-               struct sk_buff *skb;
-
-               spin_lock_irq(&rcvq->lock);
-               while ((skb = skb_peek(rcvq)) != NULL) {
-                       if (udp_checksum_complete(skb)) {
-                               UDP_INC_STATS_BH(UDP_MIB_INERRORS);
-                               __skb_unlink(skb, rcvq);
-                               kfree_skb(skb);
-                       } else {
-                               skb->ip_summed = CHECKSUM_UNNECESSARY;
-                               break;
-                       }
-               }
-               spin_unlock_irq(&rcvq->lock);
-
-               /* nothing to see, move along */
-               if (skb == NULL)
-                       mask &= ~(POLLIN | POLLRDNORM);
-       }
-
-       return mask;
-       
-}
 
 struct proto udp_prot = {
        .name =         "UDP",
-       .owner =        THIS_MODULE,
        .close =        udp_close,
        .connect =      ip4_datagram_connect,
        .disconnect =   udp_disconnect,
@@ -1646,7 +1594,6 @@ EXPORT_SYMBOL(udp_ioctl);
 EXPORT_SYMBOL(udp_port_rover);
 EXPORT_SYMBOL(udp_prot);
 EXPORT_SYMBOL(udp_sendmsg);
-EXPORT_SYMBOL(udp_poll);
 
 #ifdef CONFIG_PROC_FS
 EXPORT_SYMBOL(udp_proc_register);