version 1.25, 1995/11/21 01:07:46 |
version 1.26, 1996/01/31 03:49:38 |
Line 68 int udpcksum = 0; /* XXX */ |
|
Line 68 int udpcksum = 0; /* XXX */ |
|
#endif |
#endif |
|
|
struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET }; |
struct sockaddr_in udp_in = { sizeof(udp_in), AF_INET }; |
struct inpcb *udp_last_inpcb = 0; |
|
|
|
static void udp_detach __P((struct inpcb *)); |
static void udp_detach __P((struct inpcb *)); |
static void udp_notify __P((struct inpcb *, int)); |
static void udp_notify __P((struct inpcb *, int)); |
static struct mbuf *udp_saveopt __P((caddr_t, int, int)); |
static struct mbuf *udp_saveopt __P((caddr_t, int, int)); |
|
|
|
#ifndef UDBHASHSIZE |
|
#define UDBHASHSIZE 128 |
|
#endif |
|
int udbhashsize = UDBHASHSIZE; |
|
|
void |
void |
udp_init() |
udp_init() |
{ |
{ |
|
|
in_pcbinit(&udbtable); |
in_pcbinit(&udbtable, udbhashsize); |
} |
} |
|
|
void |
void |
Line 246 udp_input(m, iphlen) |
|
Line 250 udp_input(m, iphlen) |
|
/* |
/* |
* Locate pcb for datagram. |
* Locate pcb for datagram. |
*/ |
*/ |
inp = udp_last_inpcb; |
inp = in_pcbhashlookup(&udbtable, ip->ip_src, uh->uh_sport, |
if (inp == 0 || |
ip->ip_dst, uh->uh_dport); |
inp->inp_lport != uh->uh_dport || |
if (inp == 0) { |
inp->inp_fport != uh->uh_sport || |
++udpstat.udps_pcbhashmiss; |
inp->inp_faddr.s_addr != ip->ip_src.s_addr || |
|
inp->inp_laddr.s_addr != ip->ip_dst.s_addr) { |
|
udpstat.udpps_pcbcachemiss++; |
|
inp = in_pcblookup(&udbtable, ip->ip_src, uh->uh_sport, |
inp = in_pcblookup(&udbtable, ip->ip_src, uh->uh_sport, |
ip->ip_dst, uh->uh_dport, INPLOOKUP_WILDCARD); |
ip->ip_dst, uh->uh_dport, INPLOOKUP_WILDCARD); |
if (inp == 0) { |
if (inp == 0) { |
Line 266 udp_input(m, iphlen) |
|
Line 267 udp_input(m, iphlen) |
|
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); |
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); |
return; |
return; |
} |
} |
udp_last_inpcb = inp; |
|
} |
} |
|
|
/* |
/* |
|
|
{ |
{ |
int s = splsoftnet(); |
int s = splsoftnet(); |
|
|
if (inp == udp_last_inpcb) |
|
udp_last_inpcb = 0; |
|
in_pcbdetach(inp); |
in_pcbdetach(inp); |
splx(s); |
splx(s); |
} |
} |