[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.138.2.2 and 1.160.6.2

version 1.138.2.2, 2006/12/30 20:50:34 version 1.160.6.2, 2007/12/03 16:15:11
Line 384  udp_input(struct mbuf *m, ...)
Line 384  udp_input(struct mbuf *m, ...)
                 goto badcsum;                  goto badcsum;
   
         /* construct source and dst sockaddrs. */          /* construct source and dst sockaddrs. */
         bzero(&src, sizeof(src));          sockaddr_in_init(&src, &ip->ip_src, uh->uh_sport);
         src.sin_family = AF_INET;          sockaddr_in_init(&dst, &ip->ip_dst, uh->uh_dport);
         src.sin_len = sizeof(struct sockaddr_in);  
         bcopy(&ip->ip_src, &src.sin_addr, sizeof(src.sin_addr));  
         src.sin_port = uh->uh_sport;  
         bzero(&dst, sizeof(dst));  
         dst.sin_family = AF_INET;  
         dst.sin_len = sizeof(struct sockaddr_in);  
         bcopy(&ip->ip_dst, &dst.sin_addr, sizeof(dst.sin_addr));  
         dst.sin_port = uh->uh_dport;  
   
         if ((n = udp4_realinput(&src, &dst, &m, iphlen)) == -1) {          if ((n = udp4_realinput(&src, &dst, &m, iphlen)) == -1) {
                 udpstat.udps_hdrops++;                  udpstat.udps_hdrops++;
Line 625  udp4_sendup(struct mbuf *m, int off /* o
Line 617  udp4_sendup(struct mbuf *m, int off /* o
         /* check AH/ESP integrity. */          /* check AH/ESP integrity. */
         if (so != NULL && ipsec4_in_reject_so(m, so)) {          if (so != NULL && ipsec4_in_reject_so(m, so)) {
                 ipsecstat.in_polvio++;                  ipsecstat.in_polvio++;
                 if ((n = m_copy(m, 0, M_COPYALL)) != NULL)                  if ((n = m_copypacket(m, M_DONTWAIT)) != NULL)
                         icmp_error(n, ICMP_UNREACH, ICMP_UNREACH_ADMIN_PROHIBIT,                          icmp_error(n, ICMP_UNREACH, ICMP_UNREACH_ADMIN_PROHIBIT,
                             0, 0);                              0, 0);
                 return;                  return;
         }          }
 #endif /*IPSEC*/  #endif /*IPSEC*/
   
         if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {          if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) {
                 if (inp && (inp->inp_flags & INP_CONTROLOPTS                  if (inp && (inp->inp_flags & INP_CONTROLOPTS
                          || so->so_options & SO_TIMESTAMP)) {                           || so->so_options & SO_TIMESTAMP)) {
                         struct ip *ip = mtod(n, struct ip *);                          struct ip *ip = mtod(n, struct ip *);
Line 672  udp6_sendup(struct mbuf *m, int off /* o
Line 664  udp6_sendup(struct mbuf *m, int off /* o
         /* check AH/ESP integrity. */          /* check AH/ESP integrity. */
         if (so != NULL && ipsec6_in_reject_so(m, so)) {          if (so != NULL && ipsec6_in_reject_so(m, so)) {
                 ipsec6stat.in_polvio++;                  ipsec6stat.in_polvio++;
                 if ((n = m_copy(m, 0, M_COPYALL)) != NULL)                  if ((n = m_copypacket(m, M_DONTWAIT)) != NULL)
                         icmp6_error(n, ICMP6_DST_UNREACH,                          icmp6_error(n, ICMP6_DST_UNREACH,
                             ICMP6_DST_UNREACH_ADMIN, 0);                              ICMP6_DST_UNREACH_ADMIN, 0);
                 return;                  return;
         }          }
 #endif /*IPSEC*/  #endif /*IPSEC*/
   
         if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {          if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) {
                 if (in6p && (in6p->in6p_flags & IN6P_CONTROLOPTS                  if (in6p && (in6p->in6p_flags & IN6P_CONTROLOPTS
                           || in6p->in6p_socket->so_options & SO_TIMESTAMP)) {                            || in6p->in6p_socket->so_options & SO_TIMESTAMP)) {
                         struct ip6_hdr *ip6 = mtod(n, struct ip6_hdr *);                          struct ip6_hdr *ip6 = mtod(n, struct ip6_hdr *);
Line 963  udp_notify(struct inpcb *inp, int errno)
Line 955  udp_notify(struct inpcb *inp, int errno)
 }  }
   
 void *  void *
 udp_ctlinput(int cmd, struct sockaddr *sa, void *v)  udp_ctlinput(int cmd, const struct sockaddr *sa, void *v)
 {  {
         struct ip *ip = v;          struct ip *ip = v;
         struct udphdr *uh;          struct udphdr *uh;
Line 983  udp_ctlinput(int cmd, struct sockaddr *s
Line 975  udp_ctlinput(int cmd, struct sockaddr *s
         else if (errno == 0)          else if (errno == 0)
                 return NULL;                  return NULL;
         if (ip) {          if (ip) {
                 uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2));                  uh = (struct udphdr *)((char *)ip + (ip->ip_hl << 2));
                 in_pcbnotify(&udbtable, satosin(sa)->sin_addr, uh->uh_dport,                  in_pcbnotify(&udbtable, satocsin(sa)->sin_addr, uh->uh_dport,
                     ip->ip_src, uh->uh_sport, errno, notify);                      ip->ip_src, uh->uh_sport, errno, notify);
   
                 /* XXX mapped address case */                  /* XXX mapped address case */
         } else          } else
                 in_pcbnotifyall(&udbtable, satosin(sa)->sin_addr, errno,                  in_pcbnotifyall(&udbtable, satocsin(sa)->sin_addr, errno,
                     notify);                      notify);
         return NULL;          return NULL;
 }  }
Line 1037  udp_ctloutput(int op, struct socket *so,
Line 1029  udp_ctloutput(int op, struct socket *so,
   
                 switch (optname) {                  switch (optname) {
                 case UDP_ENCAP:                  case UDP_ENCAP:
                         if (m == NULL || m->m_len < sizeof (int)) {                          if (m == NULL || m->m_len != sizeof(int)) {
                                 error = EINVAL;                                  error = EINVAL;
                                 break;                                  break;
                         }                          }
Line 1175  udp_usrreq(struct socket *so, int req, s
Line 1167  udp_usrreq(struct socket *so, int req, s
         int error = 0;          int error = 0;
   
         if (req == PRU_CONTROL)          if (req == PRU_CONTROL)
                 return (in_control(so, (long)m, (caddr_t)nam,                  return (in_control(so, (long)m, (void *)nam,
                     (struct ifnet *)control, l));                      (struct ifnet *)control, l));
   
         s = splsoftnet();          s = splsoftnet();
Line 1417  udp4_espinudp(struct mbuf **mp, int off,
Line 1409  udp4_espinudp(struct mbuf **mp, int off,
     struct socket *so)      struct socket *so)
 {  {
         size_t len;          size_t len;
         caddr_t data;          void *data;
         struct inpcb *inp;          struct inpcb *inp;
         size_t skip = 0;          size_t skip = 0;
         size_t minlen;          size_t minlen;
Line 1446  udp4_espinudp(struct mbuf **mp, int off,
Line 1438  udp4_espinudp(struct mbuf **mp, int off,
         }          }
   
         len = m->m_len - off;          len = m->m_len - off;
         data = mtod(m, caddr_t) + off;          data = mtod(m, char *) + off;
         inp = sotoinpcb(so);          inp = sotoinpcb(so);
   
         /* Ignore keepalive packets */          /* Ignore keepalive packets */
         if ((len == 1) && (data[0] == '\xff')) {          if ((len == 1) && (*(unsigned char *)data == 0xff)) {
                 return 1;                  return 1;
         }          }
   
Line 1482  udp4_espinudp(struct mbuf **mp, int off,
Line 1474  udp4_espinudp(struct mbuf **mp, int off,
          * Get the UDP ports. They are handled in network           * Get the UDP ports. They are handled in network
          * order everywhere in IPSEC_NAT_T code.           * order everywhere in IPSEC_NAT_T code.
          */           */
         udphdr = (struct udphdr *)(data - skip);          udphdr = (struct udphdr *)((char *)data - skip);
         sport = udphdr->uh_sport;          sport = udphdr->uh_sport;
         dport = udphdr->uh_dport;          dport = udphdr->uh_dport;
   
Line 1502  udp4_espinudp(struct mbuf **mp, int off,
Line 1494  udp4_espinudp(struct mbuf **mp, int off,
          *   <-skip->           *   <-skip->
          */           */
         iphdrlen = off - sizeof(struct udphdr);          iphdrlen = off - sizeof(struct udphdr);
         memmove(mtod(m, caddr_t) + skip, mtod(m, caddr_t), iphdrlen);          memmove(mtod(m, char *) + skip, mtod(m, void *), iphdrlen);
         m_adj(m, skip);          m_adj(m, skip);
   
         ip = mtod(m, struct ip *);          ip = mtod(m, struct ip *);
Line 1536  udp4_espinudp(struct mbuf **mp, int off,
Line 1528  udp4_espinudp(struct mbuf **mp, int off,
         m_tag_prepend(n, tag);          m_tag_prepend(n, tag);
   
 #ifdef FAST_IPSEC  #ifdef FAST_IPSEC
         ipsec4_common_input(n, iphdrlen);          ipsec4_common_input(n, iphdrlen, IPPROTO_ESP);
 #else  #else
         esp4_input(n, iphdrlen);          esp4_input(n, iphdrlen);
 #endif  #endif

Legend:
Removed from v.1.138.2.2  
changed lines
  Added in v.1.160.6.2

CVSweb <webmaster@jp.NetBSD.org>