[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.31 and 1.35

version 1.31, 1996/06/23 12:12:49 version 1.35, 1996/10/25 06:33:36
Line 81  void
Line 81  void
 rip_init()  rip_init()
 {  {
   
         in_pcbinit(&rawcbtable, 1);          in_pcbinit(&rawcbtable, 1, 1);
 }  }
   
 struct  sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET };  
 /*  /*
  * Setup generic address and protocol structures   * Setup generic address and protocol structures
  * for raw_input routine, then pass them along with   * for raw_input routine, then pass them along with
Line 102  rip_input(m, va_alist)
Line 101  rip_input(m, va_alist)
         register struct ip *ip = mtod(m, struct ip *);          register struct ip *ip = mtod(m, struct ip *);
         register struct inpcb *inp;          register struct inpcb *inp;
         struct socket *last = 0;          struct socket *last = 0;
           struct sockaddr_in ripsrc;
   
           ripsrc.sin_family = AF_INET;
           ripsrc.sin_len = sizeof(struct sockaddr_in);
         ripsrc.sin_addr = ip->ip_src;          ripsrc.sin_addr = ip->ip_src;
           ripsrc.sin_port = 0;
           bzero((caddr_t)ripsrc.sin_zero, sizeof(ripsrc.sin_zero));
   
         for (inp = rawcbtable.inpt_queue.cqh_first;          for (inp = rawcbtable.inpt_queue.cqh_first;
             inp != (struct inpcb *)&rawcbtable.inpt_queue;              inp != (struct inpcb *)&rawcbtable.inpt_queue;
             inp = inp->inp_queue.cqe_next) {              inp = inp->inp_queue.cqe_next) {
                 if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != ip->ip_p)                  if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != ip->ip_p)
                         continue;                          continue;
                 if (inp->inp_laddr.s_addr != INADDR_ANY &&                  if (!in_nullhost(inp->inp_laddr) &&
                     inp->inp_laddr.s_addr != ip->ip_dst.s_addr)                      !in_hosteq(inp->inp_laddr, ip->ip_dst))
                         continue;                          continue;
                 if (inp->inp_faddr.s_addr != INADDR_ANY &&                  if (!in_nullhost(inp->inp_faddr) &&
                     inp->inp_faddr.s_addr != ip->ip_src.s_addr)                      !in_hosteq(inp->inp_faddr, ip->ip_src))
                         continue;                          continue;
                 if (last) {                  if (last) {
                         struct mbuf *n;                          struct mbuf *n;
Line 173  rip_output(m, va_alist)
Line 178  rip_output(m, va_alist)
          * Otherwise, allocate an mbuf for a header and fill it in.           * Otherwise, allocate an mbuf for a header and fill it in.
          */           */
         if ((inp->inp_flags & INP_HDRINCL) == 0) {          if ((inp->inp_flags & INP_HDRINCL) == 0) {
                   if ((m->m_pkthdr.len + sizeof(struct ip)) > IP_MAXPACKET) {
                           m_freem(m);
                           return (EMSGSIZE);
                   }
                 M_PREPEND(m, sizeof(struct ip), M_WAIT);                  M_PREPEND(m, sizeof(struct ip), M_WAIT);
                 ip = mtod(m, struct ip *);                  ip = mtod(m, struct ip *);
                 ip->ip_tos = 0;                  ip->ip_tos = 0;
Line 184  rip_output(m, va_alist)
Line 193  rip_output(m, va_alist)
                 ip->ip_ttl = MAXTTL;                  ip->ip_ttl = MAXTTL;
                 opts = inp->inp_options;                  opts = inp->inp_options;
         } else {          } else {
                   if (m->m_pkthdr.len > IP_MAXPACKET) {
                           m_freem(m);
                           return (EMSGSIZE);
                   }
                 ip = mtod(m, struct ip *);                  ip = mtod(m, struct ip *);
                 if (ip->ip_id == 0)                  if (ip->ip_id == 0)
                         ip->ip_id = htons(ip_id++);                          ip->ip_id = htons(ip_id++);
Line 285  rip_bind(inp, nam)
Line 298  rip_bind(inp, nam)
         if (addr->sin_family != AF_INET &&          if (addr->sin_family != AF_INET &&
             addr->sin_family != AF_IMPLINK)              addr->sin_family != AF_IMPLINK)
                 return (EAFNOSUPPORT);                  return (EAFNOSUPPORT);
         if (addr->sin_addr.s_addr != INADDR_ANY &&          if (!in_nullhost(addr->sin_addr) &&
             ifa_ifwithaddr(sintosa(addr)) == 0)              ifa_ifwithaddr(sintosa(addr)) == 0)
                 return (EADDRNOTAVAIL);                  return (EADDRNOTAVAIL);
         inp->inp_laddr = addr->sin_addr;          inp->inp_laddr = addr->sin_addr;
Line 315  rip_disconnect(inp)
Line 328  rip_disconnect(inp)
         struct inpcb *inp;          struct inpcb *inp;
 {  {
   
         inp->inp_faddr.s_addr = INADDR_ANY;          inp->inp_faddr = zeroin_addr;
 }  }
   
 u_long  rip_sendspace = RIPSNDQ;  u_long  rip_sendspace = RIPSNDQ;

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.35

CVSweb <webmaster@jp.NetBSD.org>