[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.103.2.4 and 1.116.2.4

version 1.103.2.4, 2004/09/21 13:37:15 version 1.116.2.4, 2004/05/28 07:24:17
Line 146  struct inpcbtable udbtable;
Line 146  struct inpcbtable udbtable;
 struct  udpstat udpstat;  struct  udpstat udpstat;
   
 #ifdef INET  #ifdef INET
 static void udp4_sendup (struct mbuf *, int, struct sockaddr *,  static void udp4_sendup __P((struct mbuf *, int, struct sockaddr *,
         struct socket *);          struct socket *));
 static int udp4_realinput (struct sockaddr_in *, struct sockaddr_in *,  static int udp4_realinput __P((struct sockaddr_in *, struct sockaddr_in *,
         struct mbuf *, int);          struct mbuf *, int));
 #endif  #endif
 #ifdef INET6  #ifdef INET6
 static void udp6_sendup (struct mbuf *, int, struct sockaddr *,  static void udp6_sendup __P((struct mbuf *, int, struct sockaddr *,
         struct socket *);          struct socket *));
 static int udp6_realinput (int, struct sockaddr_in6 *,  static int udp6_realinput __P((int, struct sockaddr_in6 *,
         struct sockaddr_in6 *, struct mbuf *, int);          struct sockaddr_in6 *, struct mbuf *, int));
 #endif  #endif
 #ifdef INET  #ifdef INET
 static  void udp_notify (struct inpcb *, int);  static  void udp_notify __P((struct inpcb *, int));
 #endif  #endif
   
 #ifndef UDBHASHSIZE  #ifndef UDBHASHSIZE
Line 186  struct evcnt udp_swcsum = EVCNT_INITIALI
Line 186  struct evcnt udp_swcsum = EVCNT_INITIALI
   
 #define UDP_CSUM_COUNTER_INCR(ev)       (ev)->ev_count++  #define UDP_CSUM_COUNTER_INCR(ev)       (ev)->ev_count++
   
 EVCNT_ATTACH_STATIC(udp_hwcsum_bad);  
 EVCNT_ATTACH_STATIC(udp_hwcsum_ok);  
 EVCNT_ATTACH_STATIC(udp_hwcsum_data);  
 EVCNT_ATTACH_STATIC(udp_swcsum);  
   
 #else  #else
   
 #define UDP_CSUM_COUNTER_INCR(ev)       /* nothing */  #define UDP_CSUM_COUNTER_INCR(ev)       /* nothing */
Line 198  EVCNT_ATTACH_STATIC(udp_swcsum);
Line 193  EVCNT_ATTACH_STATIC(udp_swcsum);
 #endif /* UDP_CSUM_COUNTERS */  #endif /* UDP_CSUM_COUNTERS */
   
 void  void
 udp_init(void)  udp_init()
 {  {
   
         in_pcbinit(&udbtable, udbhashsize, udbhashsize);          in_pcbinit(&udbtable, udbhashsize, udbhashsize);
   
   #ifdef UDP_CSUM_COUNTERS
           evcnt_attach_static(&udp_hwcsum_bad);
           evcnt_attach_static(&udp_hwcsum_ok);
           evcnt_attach_static(&udp_hwcsum_data);
           evcnt_attach_static(&udp_swcsum);
   #endif /* UDP_CSUM_COUNTERS */
   
         MOWNER_ATTACH(&udp_tx_mowner);          MOWNER_ATTACH(&udp_tx_mowner);
         MOWNER_ATTACH(&udp_rx_mowner);          MOWNER_ATTACH(&udp_rx_mowner);
         MOWNER_ATTACH(&udp_mowner);          MOWNER_ATTACH(&udp_mowner);
Line 210  udp_init(void)
Line 212  udp_init(void)
   
 #ifdef INET  #ifdef INET
 void  void
   #if __STDC__
 udp_input(struct mbuf *m, ...)  udp_input(struct mbuf *m, ...)
   #else
   udp_input(m, va_alist)
           struct mbuf *m;
           va_dcl
   #endif
 {  {
         va_list ap;          va_list ap;
         struct sockaddr_in src, dst;          struct sockaddr_in src, dst;
Line 365  badcsum:
Line 373  badcsum:
   
 #ifdef INET6  #ifdef INET6
 int  int
 udp6_input(struct mbuf **mp, int *offp, int proto)  udp6_input(mp, offp, proto)
           struct mbuf **mp;
           int *offp, proto;
 {  {
         struct mbuf *m = *mp;          struct mbuf *m = *mp;
         int off = *offp;          int off = *offp;
Line 466  bad:
Line 476  bad:
   
 #ifdef INET  #ifdef INET
 static void  static void
 udp4_sendup(struct mbuf *m, int off /* offset of data portion */,  udp4_sendup(m, off, src, so)
         struct sockaddr *src, struct socket *so)          struct mbuf *m;
           int off;        /* offset of data portion */
           struct sockaddr *src;
           struct socket *so;
 {  {
         struct mbuf *opts = NULL;          struct mbuf *opts = NULL;
         struct mbuf *n;          struct mbuf *n;
Line 511  udp4_sendup(struct mbuf *m, int off /* o
Line 524  udp4_sendup(struct mbuf *m, int off /* o
                         m_freem(n);                          m_freem(n);
                         if (opts)                          if (opts)
                                 m_freem(opts);                                  m_freem(opts);
                         so->so_rcv.sb_overflowed++;  
                         udpstat.udps_fullsock++;                          udpstat.udps_fullsock++;
                 } else                  } else
                         sorwakeup(so);                          sorwakeup(so);
Line 521  udp4_sendup(struct mbuf *m, int off /* o
Line 533  udp4_sendup(struct mbuf *m, int off /* o
   
 #ifdef INET6  #ifdef INET6
 static void  static void
 udp6_sendup(struct mbuf *m, int off /* offset of data portion */,  udp6_sendup(m, off, src, so)
         struct sockaddr *src, struct socket *so)          struct mbuf *m;
           int off;        /* offset of data portion */
           struct sockaddr *src;
           struct socket *so;
 {  {
         struct mbuf *opts = NULL;          struct mbuf *opts = NULL;
         struct mbuf *n;          struct mbuf *n;
Line 557  udp6_sendup(struct mbuf *m, int off /* o
Line 572  udp6_sendup(struct mbuf *m, int off /* o
                         m_freem(n);                          m_freem(n);
                         if (opts)                          if (opts)
                                 m_freem(opts);                                  m_freem(opts);
                         so->so_rcv.sb_overflowed++;  
                         udp6stat.udp6s_fullsock++;                          udp6stat.udp6s_fullsock++;
                 } else                  } else
                         sorwakeup(so);                          sorwakeup(so);
Line 567  udp6_sendup(struct mbuf *m, int off /* o
Line 581  udp6_sendup(struct mbuf *m, int off /* o
   
 #ifdef INET  #ifdef INET
 static int  static int
 udp4_realinput(struct sockaddr_in *src, struct sockaddr_in *dst,  udp4_realinput(src, dst, m, off)
         struct mbuf *m, int off /* offset of udphdr */)          struct sockaddr_in *src;
           struct sockaddr_in *dst;
           struct mbuf *m;
           int off;        /* offset of udphdr */
 {  {
         u_int16_t *sport, *dport;          u_int16_t *sport, *dport;
         int rcvcnt;          int rcvcnt;
Line 668  bad:
Line 685  bad:
   
 #ifdef INET6  #ifdef INET6
 static int  static int
 udp6_realinput(int af, struct sockaddr_in6 *src, struct sockaddr_in6 *dst,  udp6_realinput(af, src, dst, m, off)
         struct mbuf *m, int off)          int af;         /* af on packet */
           struct sockaddr_in6 *src;
           struct sockaddr_in6 *dst;
           struct mbuf *m;
           int off;        /* offset of udphdr */
 {  {
         u_int16_t sport, dport;          u_int16_t sport, dport;
         int rcvcnt;          int rcvcnt;
Line 786  bad:
Line 807  bad:
  * just wake up so that he can collect error status.   * just wake up so that he can collect error status.
  */   */
 static void  static void
 udp_notify(struct inpcb *inp, int errno)  udp_notify(inp, errno)
           struct inpcb *inp;
           int errno;
 {  {
   
         inp->inp_socket->so_error = errno;          inp->inp_socket->so_error = errno;
         sorwakeup(inp->inp_socket);          sorwakeup(inp->inp_socket);
         sowwakeup(inp->inp_socket);          sowwakeup(inp->inp_socket);
 }  }
   
 void *  void *
 udp_ctlinput(int cmd, struct sockaddr *sa, void *v)  udp_ctlinput(cmd, sa, v)
           int cmd;
           struct sockaddr *sa;
           void *v;
 {  {
         struct ip *ip = v;          struct ip *ip = v;
         struct udphdr *uh;          struct udphdr *uh;
         void (*notify)(struct inpcb *, int) = udp_notify;          void (*notify) __P((struct inpcb *, int)) = udp_notify;
         int errno;          int errno;
   
         if (sa->sa_family != AF_INET          if (sa->sa_family != AF_INET
Line 826  udp_ctlinput(int cmd, struct sockaddr *s
Line 853  udp_ctlinput(int cmd, struct sockaddr *s
 }  }
   
 int  int
   #if __STDC__
 udp_output(struct mbuf *m, ...)  udp_output(struct mbuf *m, ...)
   #else
   udp_output(m, va_alist)
           struct mbuf *m;
           va_dcl
   #endif
 {  {
         struct inpcb *inp;          struct inpcb *inp;
         struct udpiphdr *ui;          struct udpiphdr *ui;
Line 905  int udp_recvspace = 40 * (1024 + sizeof(
Line 938  int udp_recvspace = 40 * (1024 + sizeof(
   
 /*ARGSUSED*/  /*ARGSUSED*/
 int  int
 udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,  udp_usrreq(so, req, m, nam, control, p)
         struct mbuf *control, struct lwp *l)          struct socket *so;
           int req;
           struct mbuf *m, *nam, *control;
           struct proc *p;
 {  {
         struct inpcb *inp;          struct inpcb *inp;
         struct proc *p;  
         int s;          int s;
         int error = 0;          int error = 0;
   
         p = l ? l->l_proc : NULL;  
         if (req == PRU_CONTROL)          if (req == PRU_CONTROL)
                 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));
Line 1101  SYSCTL_SETUP(sysctl_net_inet_udp_setup, 
Line 1135  SYSCTL_SETUP(sysctl_net_inet_udp_setup, 
         sysctl_createv(clog, 0, NULL, NULL,          sysctl_createv(clog, 0, NULL, NULL,
                        CTLFLAG_PERMANENT|CTLFLAG_READWRITE,                         CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                        CTLTYPE_INT, "checksum",                         CTLTYPE_INT, "checksum",
                        SYSCTL_DESCR("Compute UDP checksums"),                         SYSCTL_DESCR("Compute and check UDP checksums"),
                        NULL, 0, &udpcksum, 0,                         NULL, 0, &udpcksum, 0,
                        CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_CHECKSUM,                         CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_CHECKSUM,
                        CTL_EOL);                         CTL_EOL);

Legend:
Removed from v.1.103.2.4  
changed lines
  Added in v.1.116.2.4

CVSweb <webmaster@jp.NetBSD.org>