[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.108.2.1 and 1.118

version 1.108.2.1, 2009/01/19 13:20:13 version 1.118, 2014/02/25 18:30:12
Line 94  __KERNEL_RCSID(0, "$NetBSD$");
Line 94  __KERNEL_RCSID(0, "$NetBSD$");
 #include <netinet/in_proto.h>  #include <netinet/in_proto.h>
 #include <netinet/in_var.h>  #include <netinet/in_var.h>
   
 #include <machine/stdarg.h>  
   
 #ifdef IPSEC  #ifdef IPSEC
 #include <netinet6/ipsec.h>  
 #include <netinet6/ipsec_private.h>  
 #endif /* IPSEC */  
   
 #ifdef FAST_IPSEC  
 #include <netipsec/ipsec.h>  #include <netipsec/ipsec.h>
 #include <netipsec/ipsec_var.h>  #include <netipsec/ipsec_var.h>
 #include <netipsec/ipsec_private.h>  #include <netipsec/ipsec_private.h>
 #endif  /* FAST_IPSEC */  #endif  /* IPSEC */
   
 #ifdef COMPAT_50  #ifdef COMPAT_50
 #include <compat/sys/socket.h>  #include <compat/sys/socket.h>
Line 119  int  rip_bind(struct inpcb *, struct mbu
Line 112  int  rip_bind(struct inpcb *, struct mbu
 int      rip_connect(struct inpcb *, struct mbuf *);  int      rip_connect(struct inpcb *, struct mbuf *);
 void     rip_disconnect(struct inpcb *);  void     rip_disconnect(struct inpcb *);
   
   static void sysctl_net_inet_raw_setup(struct sysctllog **);
   
 /*  /*
  * Nominal space allocated to a raw ip socket.   * Nominal space allocated to a raw ip socket.
  */   */
Line 136  void
Line 131  void
 rip_init(void)  rip_init(void)
 {  {
   
           sysctl_net_inet_raw_setup(NULL);
         in_pcbinit(&rawcbtable, 1, 1);          in_pcbinit(&rawcbtable, 1, 1);
 }  }
   
Line 193  rip_input(struct mbuf *m, ...)
Line 189  rip_input(struct mbuf *m, ...)
         ip->ip_len = ntohs(ip->ip_len) - hlen;          ip->ip_len = ntohs(ip->ip_len) - hlen;
         NTOHS(ip->ip_off);          NTOHS(ip->ip_off);
   
         CIRCLEQ_FOREACH(inph, &rawcbtable.inpt_queue, inph_queue) {          TAILQ_FOREACH(inph, &rawcbtable.inpt_queue, inph_queue) {
                 inp = (struct inpcb *)inph;                  inp = (struct inpcb *)inph;
                 if (inp->inp_af != AF_INET)                  if (inp->inp_af != AF_INET)
                         continue;                          continue;
Line 207  rip_input(struct mbuf *m, ...)
Line 203  rip_input(struct mbuf *m, ...)
                         continue;                          continue;
                 if (last == NULL)                  if (last == NULL)
                         ;                          ;
 #if defined(IPSEC) || defined(FAST_IPSEC)  #if defined(IPSEC)
                 /* check AH/ESP integrity. */                  /* check AH/ESP integrity. */
                 else if (ipsec4_in_reject_so(m, last->inp_socket)) {                  else if (ipsec4_in_reject_so(m, last->inp_socket)) {
                         IPSEC_STATINC(IPSEC_STAT_IN_POLVIO);                          IPSEC_STATINC(IPSEC_STAT_IN_POLVIO);
Line 221  rip_input(struct mbuf *m, ...)
Line 217  rip_input(struct mbuf *m, ...)
                 }                  }
                 last = inp;                  last = inp;
         }          }
 #if defined(IPSEC) || defined(FAST_IPSEC)  #if defined(IPSEC)
         /* check AH/ESP integrity. */          /* check AH/ESP integrity. */
         if (last != NULL && ipsec4_in_reject_so(m, last->inp_socket)) {          if (last != NULL && ipsec4_in_reject_so(m, last->inp_socket)) {
                 m_freem(m);                  m_freem(m);
Line 251  rip_pcbnotify(struct inpcbtable *table,
Line 247  rip_pcbnotify(struct inpcbtable *table,
     struct in_addr faddr, struct in_addr laddr, int proto, int errno,      struct in_addr faddr, struct in_addr laddr, int proto, int errno,
     void (*notify)(struct inpcb *, int))      void (*notify)(struct inpcb *, int))
 {  {
         struct inpcb *inp, *ninp;          struct inpcb_hdr *inph, *ninph;
         int nmatch;          int nmatch;
   
         nmatch = 0;          nmatch = 0;
         for (inp = (struct inpcb *)CIRCLEQ_FIRST(&table->inpt_queue);          TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
             inp != (struct inpcb *)&table->inpt_queue;                  struct inpcb *inp = (struct inpcb *)inph;
             inp = ninp) {  
                 ninp = (struct inpcb *)inp->inp_queue.cqe_next;  
                 if (inp->inp_af != AF_INET)                  if (inp->inp_af != AF_INET)
                         continue;                          continue;
                 if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != proto)                  if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != proto)
Line 482  rip_bind(struct inpcb *inp, struct mbuf 
Line 476  rip_bind(struct inpcb *inp, struct mbuf 
                 return (EINVAL);                  return (EINVAL);
         if (TAILQ_FIRST(&ifnet) == 0)          if (TAILQ_FIRST(&ifnet) == 0)
                 return (EADDRNOTAVAIL);                  return (EADDRNOTAVAIL);
         if (addr->sin_family != AF_INET &&          if (addr->sin_family != AF_INET)
             addr->sin_family != AF_IMPLINK)  
                 return (EAFNOSUPPORT);                  return (EAFNOSUPPORT);
         if (!in_nullhost(addr->sin_addr) &&          if (!in_nullhost(addr->sin_addr) &&
             ifa_ifwithaddr(sintosa(addr)) == 0)              ifa_ifwithaddr(sintosa(addr)) == 0)
Line 501  rip_connect(struct inpcb *inp, struct mb
Line 494  rip_connect(struct inpcb *inp, struct mb
                 return (EINVAL);                  return (EINVAL);
         if (TAILQ_FIRST(&ifnet) == 0)          if (TAILQ_FIRST(&ifnet) == 0)
                 return (EADDRNOTAVAIL);                  return (EADDRNOTAVAIL);
         if (addr->sin_family != AF_INET &&          if (addr->sin_family != AF_INET)
             addr->sin_family != AF_IMPLINK)  
                 return (EAFNOSUPPORT);                  return (EAFNOSUPPORT);
         inp->inp_faddr = addr->sin_addr;          inp->inp_faddr = addr->sin_addr;
         return (0);          return (0);
Line 531  rip_usrreq(struct socket *so, int req,
Line 523  rip_usrreq(struct socket *so, int req,
 #endif  #endif
   
         if (req == PRU_CONTROL)          if (req == PRU_CONTROL)
                 return (in_control(so, (long)m, (void *)nam,                  return in_control(so, (long)m, nam, (struct ifnet *)control, l);
                     (struct ifnet *)control, l));  
   
         s = splsoftnet();          s = splsoftnet();
   
Line 551  rip_usrreq(struct socket *so, int req,
Line 542  rip_usrreq(struct socket *so, int req,
         if (req != PRU_SEND && req != PRU_SENDOOB && control)          if (req != PRU_SEND && req != PRU_SENDOOB && control)
                 panic("rip_usrreq: unexpected control mbuf");                  panic("rip_usrreq: unexpected control mbuf");
 #endif  #endif
         if (inp == 0 && req != PRU_ATTACH) {          if (inp == NULL && req != PRU_ATTACH) {
                 error = EINVAL;                  error = EINVAL;
                 goto release;                  goto release;
         }          }
Line 696  release:
Line 687  release:
         return (error);          return (error);
 }  }
   
 SYSCTL_SETUP(sysctl_net_inet_raw_setup, "sysctl net.inet.raw subtree setup")  static void
   sysctl_net_inet_raw_setup(struct sysctllog **clog)
 {  {
   
         sysctl_createv(clog, 0, NULL, NULL,          sysctl_createv(clog, 0, NULL, NULL,
                        CTLFLAG_PERMANENT,                         CTLFLAG_PERMANENT,
                        CTLTYPE_NODE, "net", NULL,  
                        NULL, 0, NULL, 0,  
                        CTL_NET, CTL_EOL);  
         sysctl_createv(clog, 0, NULL, NULL,  
                        CTLFLAG_PERMANENT,  
                        CTLTYPE_NODE, "inet", NULL,                         CTLTYPE_NODE, "inet", NULL,
                        NULL, 0, NULL, 0,                         NULL, 0, NULL, 0,
                        CTL_NET, PF_INET, CTL_EOL);                         CTL_NET, PF_INET, CTL_EOL);

Legend:
Removed from v.1.108.2.1  
changed lines
  Added in v.1.118

CVSweb <webmaster@jp.NetBSD.org>