This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / sys / netinet / udp_usrreq.c
index cb875f0..3c5c17a 100644 (file)
  * SUCH DAMAGE.
  *
  *     from: @(#)udp_usrreq.c  7.20 (Berkeley) 4/20/91
  * SUCH DAMAGE.
  *
  *     from: @(#)udp_usrreq.c  7.20 (Berkeley) 4/20/91
- *     $Id$
+ *     $Id: udp_usrreq.c,v 1.6 1993/12/19 00:52:55 wollman Exp $
  */
 
 #include "param.h"
  */
 
 #include "param.h"
+#include "systm.h"
 #include "malloc.h"
 #include "mbuf.h"
 #include "protosw.h"
 #include "malloc.h"
 #include "mbuf.h"
 #include "protosw.h"
@@ -47,6 +48,7 @@
 
 #include "in.h"
 #include "in_systm.h"
 
 #include "in.h"
 #include "in_systm.h"
+#include "in_var.h"
 #include "ip.h"
 #include "in_pcb.h"
 #include "ip_var.h"
 #include "ip.h"
 #include "in_pcb.h"
 #include "ip_var.h"
 #include "udp.h"
 #include "udp_var.h"
 
 #include "udp.h"
 #include "udp_var.h"
 
-struct inpcb *udp_last_inpcb = &udb;
+struct   inpcb udb;     /* Can't be static, because of netstat want it */
+static struct  inpcb *udp_last_inpcb = &udb;
+
+static void udp_detach(struct inpcb *);
 
 /*
  * UDP protocol implementation.
  * Per RFC 768, August, 1980.
  */
 
 /*
  * UDP protocol implementation.
  * Per RFC 768, August, 1980.
  */
+void
 udp_init()
 {
 
        udb.inp_next = udb.inp_prev = &udb;
 }
 
 udp_init()
 {
 
        udb.inp_next = udb.inp_prev = &udb;
 }
 
-#ifndef        COMPAT_42
-int    udpcksum = 1;
-#else
-int    udpcksum = 0;           /* XXX */
-#endif
-int    udp_ttl = UDP_TTL;
-
-struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET };
+static struct  sockaddr_in udp_in = { sizeof(udp_in), AF_INET };
 
 
+void
 udp_input(m, iphlen)
        register struct mbuf *m;
        int iphlen;
 udp_input(m, iphlen)
        register struct mbuf *m;
        int iphlen;
@@ -169,7 +169,10 @@ udp_input(m, iphlen)
                }
                *ip = save_ip;
                ip->ip_len += iphlen;
                }
                *ip = save_ip;
                ip->ip_len += iphlen;
-               icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT);
+               {
+                 static struct in_addr fake;
+                 icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, fake, 0);
+               }
                return;
        }
 
                return;
        }
 
@@ -252,8 +255,10 @@ udp_saveopt(p, size, type)
  * Notify a udp user of an asynchronous error;
  * just wake up so that he can collect error status.
  */
  * Notify a udp user of an asynchronous error;
  * just wake up so that he can collect error status.
  */
+void
 udp_notify(inp, errno)
        register struct inpcb *inp;
 udp_notify(inp, errno)
        register struct inpcb *inp;
+       int errno;
 {
 
        inp->inp_socket->so_error = errno;
 {
 
        inp->inp_socket->so_error = errno;
@@ -261,6 +266,7 @@ udp_notify(inp, errno)
        sowwakeup(inp->inp_socket);
 }
 
        sowwakeup(inp->inp_socket);
 }
 
+void
 udp_ctlinput(cmd, sa, ip)
        int cmd;
        struct sockaddr *sa;
 udp_ctlinput(cmd, sa, ip)
        int cmd;
        struct sockaddr *sa;
@@ -280,6 +286,7 @@ udp_ctlinput(cmd, sa, ip)
                in_pcbnotify(&udb, sa, 0, zeroin_addr, 0, cmd, udp_notify);
 }
 
                in_pcbnotify(&udb, sa, 0, zeroin_addr, 0, cmd, udp_notify);
 }
 
+int
 udp_output(inp, m, addr, control)
        register struct inpcb *inp;
        register struct mbuf *m;
 udp_output(inp, m, addr, control)
        register struct inpcb *inp;
        register struct mbuf *m;
@@ -288,7 +295,7 @@ udp_output(inp, m, addr, control)
        register struct udpiphdr *ui;
        register int len = m->m_pkthdr.len;
        struct in_addr laddr;
        register struct udpiphdr *ui;
        register int len = m->m_pkthdr.len;
        struct in_addr laddr;
-       int s, error = 0;
+       int s = 0, error = 0;
 
        if (control)
                m_freem(control);               /* XXX */
 
        if (control)
                m_freem(control);               /* XXX */
@@ -362,11 +369,8 @@ release:
        return (error);
 }
 
        return (error);
 }
 
-u_long udp_sendspace = 9216;           /* really max datagram size */
-u_long udp_recvspace = 40 * (1024 + sizeof(struct sockaddr_in));
-                                       /* 40 1K datagrams */
-
 /*ARGSUSED*/
 /*ARGSUSED*/
+int
 udp_usrreq(so, req, m, addr, control)
        struct socket *so;
        int req;
 udp_usrreq(so, req, m, addr, control)
        struct socket *so;
        int req;
@@ -503,6 +507,7 @@ release:
        return (error);
 }
 
        return (error);
 }
 
+static void
 udp_detach(inp)
        struct inpcb *inp;
 {
 udp_detach(inp)
        struct inpcb *inp;
 {