Author: bryanv
Date: Thu Oct  9 05:42:07 2014
New Revision: 272801
URL: https://svnweb.freebsd.org/changeset/base/272801

Log:
  Move the calls to u_tun_func() into udp6_append()
  
  A similar cleanup for UDPv4 was performed in r220620.
  
  Phabricator:  https://reviews.freebsd.org/D383
  Reviewed by:  gnn
  MFC after:    1 month

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==============================================================================
--- head/sys/netinet6/udp6_usrreq.c     Thu Oct  9 05:34:28 2014        
(r272800)
+++ head/sys/netinet6/udp6_usrreq.c     Thu Oct  9 05:42:07 2014        
(r272801)
@@ -141,9 +141,18 @@ udp6_append(struct inpcb *inp, struct mb
 {
        struct socket *so;
        struct mbuf *opts;
+       struct udpcb *up;
 
        INP_LOCK_ASSERT(inp);
 
+       /*
+        * Engage the tunneling protocol.
+        */
+       up = intoudpcb(inp);
+       if (up->u_tun_func != NULL) {
+               (*up->u_tun_func)(n, off, inp);
+               return;
+       }
 #ifdef IPSEC
        /* Check AH/ESP integrity. */
        if (ipsec6_in_reject(n, inp)) {
@@ -361,20 +370,7 @@ udp6_input(struct mbuf **mp, int *offp, 
 
                                if ((n = m_copy(m, 0, M_COPYALL)) != NULL) {
                                        INP_RLOCK(last);
-                                       up = intoudpcb(last);
-                                       if (up->u_tun_func == NULL) {
-                                               udp6_append(last, n, off, 
&fromsa);
-                                       } else {
-                                               /*
-                                                * Engage the tunneling
-                                                * protocol we will have to
-                                                * leave the info_lock up,
-                                                * since we are hunting
-                                                * through multiple UDP's.
-                                                * 
-                                                */
-                                               (*up->u_tun_func)(n, off, last);
-                                       }
+                                       udp6_append(last, n, off, &fromsa);
                                        INP_RUNLOCK(last);
                                }
                        }
@@ -404,16 +400,8 @@ udp6_input(struct mbuf **mp, int *offp, 
                }
                INP_RLOCK(last);
                INP_INFO_RUNLOCK(pcbinfo);
-               up = intoudpcb(last);
                UDP_PROBE(receive, NULL, last, ip6, last, uh);
-               if (up->u_tun_func == NULL) {
-                       udp6_append(last, m, off, &fromsa);
-               } else {
-                       /*
-                        * Engage the tunneling protocol.
-                        */
-                       (*up->u_tun_func)(m, off, last);
-               }
+               udp6_append(last, m, off, &fromsa);
                INP_RUNLOCK(last);
                return (IPPROTO_DONE);
        }
@@ -492,15 +480,7 @@ udp6_input(struct mbuf **mp, int *offp, 
                }
        }
        UDP_PROBE(receive, NULL, inp, ip6, inp, uh);
-       if (up->u_tun_func == NULL) {
-               udp6_append(inp, m, off, &fromsa);
-       } else {
-               /*
-                * Engage the tunneling protocol.
-                */
-
-               (*up->u_tun_func)(m, off, inp);
-       }
+       udp6_append(inp, m, off, &fromsa);
        INP_RUNLOCK(inp);
        return (IPPROTO_DONE);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to