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.4 retrieving revision 1.9 diff -u -p -r1.4 -r1.9 --- src/sys/netinet/udp_usrreq.c 1993/12/06 04:59:45 1.4 +++ src/sys/netinet/udp_usrreq.c 1994/01/08 23:50:47 1.9 @@ -31,41 +31,33 @@ * SUCH DAMAGE. * * from: @(#)udp_usrreq.c 7.20 (Berkeley) 4/20/91 - * $Id: udp_usrreq.c,v 1.4 1993/12/06 04:59:45 hpeyerl Exp $ + * $Id: udp_usrreq.c,v 1.9 1994/01/08 23:50:47 mycroft Exp $ */ -#include "param.h" -#include "malloc.h" -#include "mbuf.h" -#include "protosw.h" -#include "socket.h" -#include "socketvar.h" -#include "stat.h" - -#include "../net/if.h" -#include "../net/route.h" - -#include "in.h" -#include "in_systm.h" -#include "ip.h" -#include "in_pcb.h" -#include "ip_var.h" -#include "ip_icmp.h" -#include "udp.h" -#include "udp_var.h" - -struct inpcb *udp_last_inpcb = &udb; +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include /* * 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. @@ -258,7 +263,10 @@ udp_input(m, iphlen) #endif *ip = save_ip; ip->ip_len += iphlen; - icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT); + { + register struct in_addr foo = {}; + icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, foo); + } return; } @@ -270,7 +278,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 +323,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 +348,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 +359,7 @@ udp_notify(inp, errno) sowwakeup(inp->inp_socket); } +void udp_ctlinput(cmd, sa, ip) int cmd; struct sockaddr *sa; @@ -369,6 +379,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 +471,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 +608,7 @@ release: return (error); } +static void udp_detach(inp) struct inpcb *inp; {