[BACK]Return to raw_ip.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / netinet

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/netinet/raw_ip.c between version 1.46.2.3 and 1.47

version 1.46.2.3, 2001/03/12 13:31:51 version 1.47, 1999/12/13 15:17:20
Line 95 
Line 95 
 #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 138  rip_input(m, va_alist)
Line 140  rip_input(m, va_alist)
 #endif  #endif
 {  {
         int off, proto;          int off, proto;
         struct ip *ip = mtod(m, struct ip *);          register struct ip *ip = mtod(m, struct ip *);
         struct inpcb *inp;          register 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 175  rip_input(m, va_alist)
Line 177  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 200  rip_input(m, va_alist)
Line 194  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 245  rip_output(m, va_alist)
Line 230  rip_output(m, va_alist)
         va_dcl          va_dcl
 #endif  #endif
 {  {
         struct inpcb *inp;          register struct inpcb *inp;
         struct ip *ip;          register struct ip *ip;
         struct mbuf *opts;          struct mbuf *opts;
         int flags;          int flags;
         va_list ap;          va_list ap;
Line 296  rip_output(m, va_alist)
Line 281  rip_output(m, va_alist)
                 ipstat.ips_rawout++;                  ipstat.ips_rawout++;
         }          }
 #ifdef IPSEC  #ifdef IPSEC
         if (ipsec_setsocket(m, inp->inp_socket) != 0) {          m->m_pkthdr.rcvif = (struct ifnet *)inp->inp_socket;    /*XXX*/
                 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 314  rip_ctloutput(op, so, level, optname, m)
Line 296  rip_ctloutput(op, so, level, optname, m)
         int level, optname;          int level, optname;
         struct mbuf **m;          struct mbuf **m;
 {  {
         struct inpcb *inp = sotoinpcb(so);          register struct inpcb *inp = sotoinpcb(so);
         int error = 0;          int error = 0;
   
         if (level != IPPROTO_IP) {          if (level != IPPROTO_IP) {
Line 433  u_long rip_recvspace = RIPRCVQ;
Line 415  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)
         struct socket *so;          register struct socket *so;
         int req;          int req;
         struct mbuf *m, *nam, *control;          struct mbuf *m, *nam, *control;
         struct proc *p;          struct proc *p;
 {  {
         struct inpcb *inp;          register struct inpcb *inp;
         int s;          int s;
         int error = 0;          register int error = 0;
 #ifdef MROUTING  #ifdef MROUTING
         extern struct socket *ip_mrouter;          extern struct socket *ip_mrouter;
 #endif  #endif
Line 449  rip_usrreq(so, req, m, nam, control, p)
Line 431  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 488  rip_usrreq(so, req, m, nam, control, p)
Line 464  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
                 error = ipsec_init_policy(so, &inp->inp_sp);                  error = ipsec_init_policy(&inp->inp_sp);
                 if (error != 0) {                  if (error != 0) {
                         in_pcbdetach(inp);                          in_pcbdetach(inp);
                         break;                          break;

Legend:
Removed from v.1.46.2.3  
changed lines
  Added in v.1.47

CVSweb <webmaster@jp.NetBSD.org>