version 1.103.2.9, 2005/04/01 14:31:50 |
version 1.134.2.2, 2005/04/28 10:53:40 |
Line 1116 int udp_recvspace = 40 * (1024 + sizeof( |
|
Line 1116 int udp_recvspace = 40 * (1024 + sizeof( |
|
/*ARGSUSED*/ |
/*ARGSUSED*/ |
int |
int |
udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, |
udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, |
struct mbuf *control, struct lwp *l) |
struct mbuf *control, struct proc *p) |
{ |
{ |
struct inpcb *inp; |
struct inpcb *inp; |
struct proc *p; |
|
int s; |
int s; |
int error = 0; |
int error = 0; |
|
|
p = l ? l->l_proc : NULL; |
|
if (req == PRU_CONTROL) |
if (req == PRU_CONTROL) |
return (in_control(so, (long)m, (caddr_t)nam, |
return (in_control(so, (long)m, (caddr_t)nam, |
(struct ifnet *)control, p)); |
(struct ifnet *)control, p)); |
Line 1367 udp4_espinudp(m, off, src, so) |
|
Line 1365 udp4_espinudp(m, off, src, so) |
|
size_t iphdrlen; |
size_t iphdrlen; |
struct ip *ip; |
struct ip *ip; |
struct mbuf *n; |
struct mbuf *n; |
|
struct m_tag *tag; |
|
struct udphdr *udphdr; |
|
u_int16_t sport, dport; |
|
|
/* |
/* |
* Collapse the mbuf chain if the first mbuf is too short |
* Collapse the mbuf chain if the first mbuf is too short |
Line 1417 udp4_espinudp(m, off, src, so) |
|
Line 1418 udp4_espinudp(m, off, src, so) |
|
} |
} |
|
|
/* |
/* |
|
* Get the UDP ports. They are handled in network |
|
* order everywhere in IPSEC_NAT_T code. |
|
*/ |
|
udphdr = (struct udphdr *)(data - skip); |
|
sport = udphdr->uh_sport; |
|
dport = udphdr->uh_dport; |
|
|
|
/* |
* Remove the UDP header (and possibly the non ESP marker) |
* Remove the UDP header (and possibly the non ESP marker) |
* IP header lendth is iphdrlen |
* IP header lendth is iphdrlen |
* Before: |
* Before: |
Line 1449 udp4_espinudp(m, off, src, so) |
|
Line 1458 udp4_espinudp(m, off, src, so) |
|
return 0; |
return 0; |
} |
} |
|
|
|
/* |
|
* Add a PACKET_TAG_IPSEC_NAT_T_PORT tag to remember |
|
* the source UDP port. This is required if we want |
|
* to select the right SPD for multiple hosts behind |
|
* same NAT |
|
*/ |
|
if ((tag = m_tag_get(PACKET_TAG_IPSEC_NAT_T_PORTS, |
|
sizeof(sport) + sizeof(dport), M_DONTWAIT)) == NULL) { |
|
printf("udp4_espinudp: m_tag_get failed\n"); |
|
return 0; |
|
} |
|
((u_int16_t *)(tag + 1))[0] = sport; |
|
((u_int16_t *)(tag + 1))[1] = dport; |
|
m_tag_prepend(n, tag); |
|
|
esp4_input(n, iphdrlen); |
esp4_input(n, iphdrlen); |
|
|
/* We handled it, it shoudln't be handled by UDP */ |
/* We handled it, it shoudln't be handled by UDP */ |