[BACK]Return to udp_usrreq.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/udp_usrreq.c between version 1.6 and 1.10

version 1.6, 1994/01/08 21:22:06 version 1.10, 1994/01/10 20:14:34
Line 54 
Line 54 
 #include <netinet/udp.h>  #include <netinet/udp.h>
 #include <netinet/udp_var.h>  #include <netinet/udp_var.h>
   
 struct  inpcb *udp_last_inpcb = &udb;  
   
 /*  /*
  * UDP protocol implementation.   * UDP protocol implementation.
  * Per RFC 768, August, 1980.   * Per RFC 768, August, 1980.
  */   */
 udp_init()  
 {  
   
         udb.inp_next = udb.inp_prev = &udb;  
 }  
   
 #ifndef COMPAT_42  #ifndef COMPAT_42
 int     udpcksum = 1;  int     udpcksum = 1;
 #else  #else
Line 74  int udpcksum = 0;  /* XXX */
Line 66  int udpcksum = 0;  /* XXX */
 int     udp_ttl = UDP_TTL;  int     udp_ttl = UDP_TTL;
   
 struct  sockaddr_in udp_in = { sizeof(udp_in), AF_INET };  struct  sockaddr_in udp_in = { sizeof(udp_in), AF_INET };
   struct  inpcb *udp_last_inpcb = &udb;
   
   static void     udp_detach __P((struct inpcb *));
   static void     udp_notify __P((struct inpcb *, int));
   static struct mbuf *
                   udp_saveopt __P((caddr_t, int, int));
   
   void
   udp_init()
   {
   
           udb.inp_next = udb.inp_prev = &udb;
   }
   
   void
 udp_input(m, iphlen)  udp_input(m, iphlen)
         register struct mbuf *m;          register struct mbuf *m;
         int iphlen;          int iphlen;
Line 257  udp_input(m, iphlen)
Line 263  udp_input(m, iphlen)
 #endif  #endif
                 *ip = save_ip;                  *ip = save_ip;
                 ip->ip_len += iphlen;                  ip->ip_len += iphlen;
                 icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT);              {
                   register struct in_addr foo = {};
                   icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, foo);
               }
                 return;                  return;
         }          }
   
Line 269  udp_input(m, iphlen)
Line 278  udp_input(m, iphlen)
         udp_in.sin_addr = ip->ip_src;          udp_in.sin_addr = ip->ip_src;
         if (inp->inp_flags & INP_CONTROLOPTS) {          if (inp->inp_flags & INP_CONTROLOPTS) {
                 struct mbuf **mp = &opts;                  struct mbuf **mp = &opts;
                 struct mbuf *udp_saveopt();  
   
                 if (inp->inp_flags & INP_RECVDSTADDR) {                  if (inp->inp_flags & INP_RECVDSTADDR) {
                         *mp = udp_saveopt((caddr_t) &ip->ip_dst,                          *mp = udp_saveopt((caddr_t) &ip->ip_dst,
Line 315  bad:
Line 323  bad:
  * Create a "control" mbuf containing the specified data   * Create a "control" mbuf containing the specified data
  * with the specified type for presentation with a datagram.   * with the specified type for presentation with a datagram.
  */   */
 struct mbuf *  static struct mbuf *
 udp_saveopt(p, size, type)  udp_saveopt(p, size, type)
         caddr_t p;          caddr_t p;
         register int size;          register int size;
Line 340  udp_saveopt(p, size, type)
Line 348  udp_saveopt(p, size, type)
  * Notify a udp user of an asynchronous error;   * Notify a udp user of an asynchronous error;
  * just wake up so that he can collect error status.   * just wake up so that he can collect error status.
  */   */
   static void
 udp_notify(inp, errno)  udp_notify(inp, errno)
         register struct inpcb *inp;          register struct inpcb *inp;
           int errno;
 {  {
   
         inp->inp_socket->so_error = errno;          inp->inp_socket->so_error = errno;
Line 349  udp_notify(inp, errno)
Line 359  udp_notify(inp, errno)
         sowwakeup(inp->inp_socket);          sowwakeup(inp->inp_socket);
 }  }
   
   void
 udp_ctlinput(cmd, sa, ip)  udp_ctlinput(cmd, sa, ip)
         int cmd;          int cmd;
         struct sockaddr *sa;          struct sockaddr *sa;
Line 368  udp_ctlinput(cmd, sa, ip)
Line 379  udp_ctlinput(cmd, sa, ip)
                 in_pcbnotify(&udb, sa, 0, zeroin_addr, 0, cmd, udp_notify);                  in_pcbnotify(&udb, sa, 0, zeroin_addr, 0, cmd, udp_notify);
 }  }
   
   int
 udp_output(inp, m, addr, control)  udp_output(inp, m, addr, control)
         register struct inpcb *inp;          register struct inpcb *inp;
         register struct mbuf *m;          register struct mbuf *m;
Line 438  udp_output(inp, m, addr, control)
Line 450  udp_output(inp, m, addr, control)
         error = ip_output(m, inp->inp_options, &inp->inp_route,          error = ip_output(m, inp->inp_options, &inp->inp_route,
             inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST)              inp->inp_socket->so_options & (SO_DONTROUTE | SO_BROADCAST)
 #ifdef MULTICAST  #ifdef MULTICAST
                 | IP_MULTICASTOPTS, inp->inp_moptions              , inp->inp_moptions
   #else
               , NULL
 #endif  #endif
                 );              );
   
         if (addr) {          if (addr) {
                 in_pcbdisconnect(inp);                  in_pcbdisconnect(inp);
Line 459  u_long udp_recvspace = 40 * (1024 + size
Line 473  u_long udp_recvspace = 40 * (1024 + size
                                         /* 40 1K datagrams */                                          /* 40 1K datagrams */
   
 /*ARGSUSED*/  /*ARGSUSED*/
   int
 udp_usrreq(so, req, m, addr, control)  udp_usrreq(so, req, m, addr, control)
         struct socket *so;          struct socket *so;
         int req;          int req;
Line 595  release:
Line 610  release:
         return (error);          return (error);
 }  }
   
   static void
 udp_detach(inp)  udp_detach(inp)
         struct inpcb *inp;          struct inpcb *inp;
 {  {

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.10

CVSweb <webmaster@jp.NetBSD.org>