version 1.116, 2004/03/24 15:34:54 |
version 1.119, 2004/04/18 23:35:56 |
Line 145 struct inpcbtable udbtable; |
|
Line 145 struct inpcbtable udbtable; |
|
struct udpstat udpstat; |
struct udpstat udpstat; |
|
|
#ifdef INET |
#ifdef INET |
static void udp4_sendup __P((struct mbuf *, int, struct sockaddr *, |
static void udp4_sendup (struct mbuf *, int, struct sockaddr *, |
struct socket *)); |
struct socket *); |
static int udp4_realinput __P((struct sockaddr_in *, struct sockaddr_in *, |
static int udp4_realinput (struct sockaddr_in *, struct sockaddr_in *, |
struct mbuf *, int)); |
struct mbuf *, int); |
#endif |
#endif |
#ifdef INET6 |
#ifdef INET6 |
static void udp6_sendup __P((struct mbuf *, int, struct sockaddr *, |
static void udp6_sendup (struct mbuf *, int, struct sockaddr *, |
struct socket *)); |
struct socket *); |
static int udp6_realinput __P((int, struct sockaddr_in6 *, |
static int udp6_realinput (int, struct sockaddr_in6 *, |
struct sockaddr_in6 *, struct mbuf *, int)); |
struct sockaddr_in6 *, struct mbuf *, int); |
#endif |
#endif |
#ifdef INET |
#ifdef INET |
static void udp_notify __P((struct inpcb *, int)); |
static void udp_notify (struct inpcb *, int); |
#endif |
#endif |
|
|
#ifndef UDBHASHSIZE |
#ifndef UDBHASHSIZE |
Line 192 struct evcnt udp_swcsum = EVCNT_INITIALI |
|
Line 192 struct evcnt udp_swcsum = EVCNT_INITIALI |
|
#endif /* UDP_CSUM_COUNTERS */ |
#endif /* UDP_CSUM_COUNTERS */ |
|
|
void |
void |
udp_init() |
udp_init(void) |
{ |
{ |
|
|
in_pcbinit(&udbtable, udbhashsize, udbhashsize); |
in_pcbinit(&udbtable, udbhashsize, udbhashsize); |
|
|
|
|
#ifdef INET |
#ifdef INET |
void |
void |
#if __STDC__ |
|
udp_input(struct mbuf *m, ...) |
udp_input(struct mbuf *m, ...) |
#else |
|
udp_input(m, va_alist) |
|
struct mbuf *m; |
|
va_dcl |
|
#endif |
|
{ |
{ |
va_list ap; |
va_list ap; |
struct sockaddr_in src, dst; |
struct sockaddr_in src, dst; |
|
|
|
|
#ifdef INET6 |
#ifdef INET6 |
int |
int |
udp6_input(mp, offp, proto) |
udp6_input(struct mbuf **mp, int *offp, int proto) |
struct mbuf **mp; |
|
int *offp, proto; |
|
{ |
{ |
struct mbuf *m = *mp; |
struct mbuf *m = *mp; |
int off = *offp; |
int off = *offp; |
Line 430 udp6_input(mp, offp, proto) |
|
Line 422 udp6_input(mp, offp, proto) |
|
/* |
/* |
* Checksum extended UDP header and data. |
* Checksum extended UDP header and data. |
*/ |
*/ |
if (uh->uh_sum == 0) |
if (uh->uh_sum == 0) { |
udp6stat.udp6s_nosum++; |
udp6stat.udp6s_nosum++; |
else if (in6_cksum(m, IPPROTO_UDP, off, ulen) != 0) { |
goto bad; |
|
} |
|
if (in6_cksum(m, IPPROTO_UDP, off, ulen) != 0) { |
udp6stat.udp6s_badsum++; |
udp6stat.udp6s_badsum++; |
goto bad; |
goto bad; |
} |
} |
|
|
|
|
#ifdef INET |
#ifdef INET |
static void |
static void |
udp4_sendup(m, off, src, so) |
udp4_sendup(struct mbuf *m, int off /* offset of data portion */, |
struct mbuf *m; |
struct sockaddr *src, struct socket *so) |
int off; /* offset of data portion */ |
|
struct sockaddr *src; |
|
struct socket *so; |
|
{ |
{ |
struct mbuf *opts = NULL; |
struct mbuf *opts = NULL; |
struct mbuf *n; |
struct mbuf *n; |
Line 530 udp4_sendup(m, off, src, so) |
|
Line 521 udp4_sendup(m, off, src, so) |
|
|
|
#ifdef INET6 |
#ifdef INET6 |
static void |
static void |
udp6_sendup(m, off, src, so) |
udp6_sendup(struct mbuf *m, int off /* offset of data portion */, |
struct mbuf *m; |
struct sockaddr *src, struct socket *so) |
int off; /* offset of data portion */ |
|
struct sockaddr *src; |
|
struct socket *so; |
|
{ |
{ |
struct mbuf *opts = NULL; |
struct mbuf *opts = NULL; |
struct mbuf *n; |
struct mbuf *n; |
Line 578 udp6_sendup(m, off, src, so) |
|
Line 566 udp6_sendup(m, off, src, so) |
|
|
|
#ifdef INET |
#ifdef INET |
static int |
static int |
udp4_realinput(src, dst, m, off) |
udp4_realinput(struct sockaddr_in *src, struct sockaddr_in *dst, |
struct sockaddr_in *src; |
struct mbuf *m, int off /* offset of udphdr */) |
struct sockaddr_in *dst; |
|
struct mbuf *m; |
|
int off; /* offset of udphdr */ |
|
{ |
{ |
u_int16_t *sport, *dport; |
u_int16_t *sport, *dport; |
int rcvcnt; |
int rcvcnt; |
|
|
|
|
#ifdef INET6 |
#ifdef INET6 |
static int |
static int |
udp6_realinput(af, src, dst, m, off) |
udp6_realinput(int af, struct sockaddr_in6 *src, struct sockaddr_in6 *dst, |
int af; /* af on packet */ |
struct mbuf *m, int off) |
struct sockaddr_in6 *src; |
|
struct sockaddr_in6 *dst; |
|
struct mbuf *m; |
|
int off; /* offset of udphdr */ |
|
{ |
{ |
u_int16_t sport, dport; |
u_int16_t sport, dport; |
int rcvcnt; |
int rcvcnt; |
|
|
* just wake up so that he can collect error status. |
* just wake up so that he can collect error status. |
*/ |
*/ |
static void |
static void |
udp_notify(inp, errno) |
udp_notify(struct inpcb *inp, int errno) |
struct inpcb *inp; |
|
int errno; |
|
{ |
{ |
|
|
inp->inp_socket->so_error = errno; |
inp->inp_socket->so_error = errno; |
sorwakeup(inp->inp_socket); |
sorwakeup(inp->inp_socket); |
sowwakeup(inp->inp_socket); |
sowwakeup(inp->inp_socket); |
} |
} |
|
|
void * |
void * |
udp_ctlinput(cmd, sa, v) |
udp_ctlinput(int cmd, struct sockaddr *sa, void *v) |
int cmd; |
|
struct sockaddr *sa; |
|
void *v; |
|
{ |
{ |
struct ip *ip = v; |
struct ip *ip = v; |
struct udphdr *uh; |
struct udphdr *uh; |
void (*notify) __P((struct inpcb *, int)) = udp_notify; |
void (*notify)(struct inpcb *, int) = udp_notify; |
int errno; |
int errno; |
|
|
if (sa->sa_family != AF_INET |
if (sa->sa_family != AF_INET |
Line 850 udp_ctlinput(cmd, sa, v) |
|
Line 825 udp_ctlinput(cmd, sa, v) |
|
} |
} |
|
|
int |
int |
#if __STDC__ |
|
udp_output(struct mbuf *m, ...) |
udp_output(struct mbuf *m, ...) |
#else |
|
udp_output(m, va_alist) |
|
struct mbuf *m; |
|
va_dcl |
|
#endif |
|
{ |
{ |
struct inpcb *inp; |
struct inpcb *inp; |
struct udpiphdr *ui; |
struct udpiphdr *ui; |
Line 935 int udp_recvspace = 40 * (1024 + sizeof( |
|
Line 904 int udp_recvspace = 40 * (1024 + sizeof( |
|
|
|
/*ARGSUSED*/ |
/*ARGSUSED*/ |
int |
int |
udp_usrreq(so, req, m, nam, control, p) |
udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, |
struct socket *so; |
struct mbuf *control, struct proc *p) |
int req; |
|
struct mbuf *m, *nam, *control; |
|
struct proc *p; |
|
{ |
{ |
struct inpcb *inp; |
struct inpcb *inp; |
int s; |
int s; |