| version 1.46, 1999/09/13 12:15:55 |
version 1.46.2.3, 2001/03/12 13:31:51 |
|
|
| #include <netinet6/ipsec.h> |
#include <netinet6/ipsec.h> |
| #endif /*IPSEC*/ |
#endif /*IPSEC*/ |
| |
|
| extern u_char ip_protox[]; |
|
| extern struct protosw inetsw[]; |
|
| struct inpcbtable rawcbtable; |
struct inpcbtable rawcbtable; |
| |
|
| int rip_bind __P((struct inpcb *, struct mbuf *)); |
int rip_bind __P((struct inpcb *, struct mbuf *)); |
| Line 140 rip_input(m, va_alist) |
|
| Line 138 rip_input(m, va_alist) |
|
| #endif |
#endif |
| { |
{ |
| int off, proto; |
int off, proto; |
| register struct ip *ip = mtod(m, struct ip *); |
struct ip *ip = mtod(m, struct ip *); |
| register struct inpcb *inp; |
struct inpcb *inp; |
| struct inpcb *last = 0; |
struct inpcb *last = 0; |
| struct mbuf *opts = 0; |
struct mbuf *opts = 0; |
| struct sockaddr_in ripsrc; |
struct sockaddr_in ripsrc; |
| Line 177 rip_input(m, va_alist) |
|
| Line 175 rip_input(m, va_alist) |
|
| continue; |
continue; |
| if (last) { |
if (last) { |
| struct mbuf *n; |
struct mbuf *n; |
| |
|
| |
#ifdef IPSEC |
| |
/* check AH/ESP integrity. */ |
| |
if (ipsec4_in_reject_so(m, last->inp_socket)) { |
| |
ipsecstat.in_polvio++; |
| |
/* do not inject data to pcb */ |
| |
} else |
| |
#endif /*IPSEC*/ |
| if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { |
if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { |
| if (last->inp_flags & INP_CONTROLOPTS || |
if (last->inp_flags & INP_CONTROLOPTS || |
| last->inp_socket->so_options & SO_TIMESTAMP) |
last->inp_socket->so_options & SO_TIMESTAMP) |
| Line 194 rip_input(m, va_alist) |
|
| Line 200 rip_input(m, va_alist) |
|
| } |
} |
| last = inp; |
last = inp; |
| } |
} |
| |
#ifdef IPSEC |
| |
/* check AH/ESP integrity. */ |
| |
if (last && ipsec4_in_reject_so(m, last->inp_socket)) { |
| |
m_freem(m); |
| |
ipsecstat.in_polvio++; |
| |
ipstat.ips_delivered--; |
| |
/* do not inject data to pcb */ |
| |
} else |
| |
#endif /*IPSEC*/ |
| if (last) { |
if (last) { |
| if (last->inp_flags & INP_CONTROLOPTS || |
if (last->inp_flags & INP_CONTROLOPTS || |
| last->inp_socket->so_options & SO_TIMESTAMP) |
last->inp_socket->so_options & SO_TIMESTAMP) |
| Line 207 rip_input(m, va_alist) |
|
| Line 222 rip_input(m, va_alist) |
|
| sorwakeup(last->inp_socket); |
sorwakeup(last->inp_socket); |
| } else { |
} else { |
| if (inetsw[ip_protox[ip->ip_p]].pr_input == rip_input) { |
if (inetsw[ip_protox[ip->ip_p]].pr_input == rip_input) { |
| icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PROTOCOL,0,0); |
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PROTOCOL, |
| |
0, 0); |
| ipstat.ips_noproto++; |
ipstat.ips_noproto++; |
| ipstat.ips_delivered--; |
ipstat.ips_delivered--; |
| } else |
} else |
| Line 229 rip_output(m, va_alist) |
|
| Line 245 rip_output(m, va_alist) |
|
| va_dcl |
va_dcl |
| #endif |
#endif |
| { |
{ |
| register struct inpcb *inp; |
struct inpcb *inp; |
| register struct ip *ip; |
struct ip *ip; |
| struct mbuf *opts; |
struct mbuf *opts; |
| int flags; |
int flags; |
| va_list ap; |
va_list ap; |
| Line 280 rip_output(m, va_alist) |
|
| Line 296 rip_output(m, va_alist) |
|
| ipstat.ips_rawout++; |
ipstat.ips_rawout++; |
| } |
} |
| #ifdef IPSEC |
#ifdef IPSEC |
| m->m_pkthdr.rcvif = (struct ifnet *)inp->inp_socket; /*XXX*/ |
if (ipsec_setsocket(m, inp->inp_socket) != 0) { |
| |
m_freem(m); |
| |
return ENOBUFS; |
| |
} |
| #endif /*IPSEC*/ |
#endif /*IPSEC*/ |
| return (ip_output(m, opts, &inp->inp_route, flags, inp->inp_moptions, &inp->inp_errormtu)); |
return (ip_output(m, opts, &inp->inp_route, flags, inp->inp_moptions, &inp->inp_errormtu)); |
| } |
} |
| Line 295 rip_ctloutput(op, so, level, optname, m) |
|
| Line 314 rip_ctloutput(op, so, level, optname, m) |
|
| int level, optname; |
int level, optname; |
| struct mbuf **m; |
struct mbuf **m; |
| { |
{ |
| register struct inpcb *inp = sotoinpcb(so); |
struct inpcb *inp = sotoinpcb(so); |
| int error = 0; |
int error = 0; |
| |
|
| if (level != IPPROTO_IP) { |
if (level != IPPROTO_IP) { |
| Line 414 u_long rip_recvspace = RIPRCVQ; |
|
| Line 433 u_long rip_recvspace = RIPRCVQ; |
|
| /*ARGSUSED*/ |
/*ARGSUSED*/ |
| int |
int |
| rip_usrreq(so, req, m, nam, control, p) |
rip_usrreq(so, req, m, nam, control, p) |
| register struct socket *so; |
struct socket *so; |
| int req; |
int req; |
| struct mbuf *m, *nam, *control; |
struct mbuf *m, *nam, *control; |
| struct proc *p; |
struct proc *p; |
| { |
{ |
| register struct inpcb *inp; |
struct inpcb *inp; |
| int s; |
int s; |
| register int error = 0; |
int error = 0; |
| #ifdef MROUTING |
#ifdef MROUTING |
| extern struct socket *ip_mrouter; |
extern struct socket *ip_mrouter; |
| #endif |
#endif |
| Line 430 rip_usrreq(so, req, m, nam, control, p) |
|
| Line 449 rip_usrreq(so, req, m, nam, control, p) |
|
| 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)); |
| |
|
| |
if (req == PRU_PURGEIF) { |
| |
in_purgeif((struct ifnet *)control); |
| |
in_pcbpurgeif(&rawcbtable, (struct ifnet *)control); |
| |
return (0); |
| |
} |
| |
|
| s = splsoftnet(); |
s = splsoftnet(); |
| inp = sotoinpcb(so); |
inp = sotoinpcb(so); |
| #ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
| Line 463 rip_usrreq(so, req, m, nam, control, p) |
|
| Line 488 rip_usrreq(so, req, m, nam, control, p) |
|
| inp = sotoinpcb(so); |
inp = sotoinpcb(so); |
| inp->inp_ip.ip_p = (long)nam; |
inp->inp_ip.ip_p = (long)nam; |
| #ifdef IPSEC |
#ifdef IPSEC |
| if ((error = ipsec_init_policy(&inp->inp_sp)) != 0) |
error = ipsec_init_policy(so, &inp->inp_sp); |
| |
if (error != 0) { |
| in_pcbdetach(inp); |
in_pcbdetach(inp); |
| |
break; |
| |
} |
| #endif /*IPSEC*/ |
#endif /*IPSEC*/ |
| break; |
break; |
| |
|