]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet6/udp6_output.c
xnu-1504.7.4.tar.gz
[apple/xnu.git] / bsd / netinet6 / udp6_output.c
index 191896a47842adf3a7821684aa6454deb5e59f35..3713c80d352b8dee2632935a04a619620002db09 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -341,8 +341,26 @@ udp6_output(in6p, m, addr6, control, p)
                }
 #endif /*IPSEC*/
                m->m_pkthdr.socket_id = get_socket_id(in6p->in6p_socket);
+#if PKT_PRIORITY
+               if (soisbackground(in6p->in6p_socket))
+                       m_prio_background(m);
+#endif /* PKT_PRIORITY */
                error = ip6_output(m, in6p->in6p_outputopts, &in6p->in6p_route,
                    flags, in6p->in6p_moptions, NULL, 0);
+
+#if IFNET_ROUTE_REFCNT
+               /*
+                * Always discard the cached route for unconnected socket
+                * or if it is a multicast route.
+                */
+               if (in6p->in6p_route.ro_rt != NULL &&
+                   ((in6p->in6p_route.ro_rt->rt_flags & RTF_MULTICAST) ||
+                   in6p->in6p_socket == NULL ||
+                   in6p->in6p_socket->so_state != SS_ISCONNECTED)) {
+                       rtfree(in6p->in6p_route.ro_rt);
+                       in6p->in6p_route.ro_rt = NULL;
+               }
+#endif /* IFNET_ROUTE_REFCNT */
                break;
        case AF_INET:
                error = EAFNOSUPPORT;