Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet/udp_usrreq.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/netinet/udp_usrreq.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.5 retrieving revision 1.8 diff -u -p -r1.5 -r1.8 --- src/sys/netinet/udp_usrreq.c 1993/12/18 00:42:15 1.5 +++ src/sys/netinet/udp_usrreq.c 1994/01/08 23:19:48 1.8 @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)udp_usrreq.c 7.20 (Berkeley) 4/20/91 - * $Id: udp_usrreq.c,v 1.5 1993/12/18 00:42:15 mycroft Exp $ + * $Id: udp_usrreq.c,v 1.8 1994/01/08 23:19:48 mycroft Exp $ */ #include @@ -54,18 +54,10 @@ #include #include -struct inpcb *udp_last_inpcb = &udb; - /* * UDP protocol implementation. * Per RFC 768, August, 1980. */ -udp_init() -{ - - udb.inp_next = udb.inp_prev = &udb; -} - #ifndef COMPAT_42 int udpcksum = 1; #else @@ -74,7 +66,21 @@ int udpcksum = 0; /* XXX */ int udp_ttl = UDP_TTL; struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET }; +struct inpcb *udp_last_inpcb = &udb; +static void udp_detach __P((struct inpcb *)); +static void udp_notify __P((struct inpcb *, int)); +static struct mbuf * + udp_saveopt __P((caddr_t, int, int)); + +void +udp_init() +{ + + udb.inp_next = udb.inp_prev = &udb; +} + +void udp_input(m, iphlen) register struct mbuf *m; int iphlen; @@ -164,7 +170,6 @@ udp_input(m, iphlen) * compatibility we avoid the problem here rather than * fixing the interface. Maybe 4.4BSD will remedy this?) */ - /* * Construct sockaddr format source address. */ @@ -186,7 +191,7 @@ udp_input(m, iphlen) continue; } if (inp->inp_faddr.s_addr != INADDR_ANY) { - if (inp->inp_faddr.s_addr != + if (inp->inp_faddr.s_addr != ip->ip_src.s_addr || inp->inp_fport != uh->uh_sport) continue; @@ -216,7 +221,7 @@ udp_input(m, iphlen) if ((last->so_options & SO_REUSEADDR) == 0) break; } - + if (last == NULL) { /* * No matching pcb found; discard datagram. @@ -270,7 +275,6 @@ udp_input(m, iphlen) udp_in.sin_addr = ip->ip_src; if (inp->inp_flags & INP_CONTROLOPTS) { struct mbuf **mp = &opts; - struct mbuf *udp_saveopt(); if (inp->inp_flags & INP_RECVDSTADDR) { *mp = udp_saveopt((caddr_t) &ip->ip_dst, @@ -316,7 +320,7 @@ bad: * Create a "control" mbuf containing the specified data * with the specified type for presentation with a datagram. */ -struct mbuf * +static struct mbuf * udp_saveopt(p, size, type) caddr_t p; register int size; @@ -341,8 +345,10 @@ udp_saveopt(p, size, type) * Notify a udp user of an asynchronous error; * just wake up so that he can collect error status. */ +static void udp_notify(inp, errno) register struct inpcb *inp; + int errno; { inp->inp_socket->so_error = errno; @@ -350,6 +356,7 @@ udp_notify(inp, errno) sowwakeup(inp->inp_socket); } +void udp_ctlinput(cmd, sa, ip) int cmd; struct sockaddr *sa; @@ -369,6 +376,7 @@ udp_ctlinput(cmd, sa, ip) 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; @@ -460,6 +468,7 @@ u_long udp_recvspace = 40 * (1024 + size /* 40 1K datagrams */ /*ARGSUSED*/ +int udp_usrreq(so, req, m, addr, control) struct socket *so; int req; @@ -596,6 +605,7 @@ release: return (error); } +static void udp_detach(inp) struct inpcb *inp; {