]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet6/raw_ip6.c
xnu-1504.7.4.tar.gz
[apple/xnu.git] / bsd / netinet6 / raw_ip6.c
index 762258e4554d67e4d1ec39f5a64660f39820b12a..79eda381ee86c3b4f622333253f117a22a4ccacf 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@
  * 
@@ -487,8 +487,28 @@ rip6_output(
                in6p->in6p_route.ro_rt = NULL;
        }
 
+#if PKT_PRIORITY
+       if (soisbackground(so))
+               m_prio_background(m);
+#endif /* PKT_PRIORITY */
+
        error = ip6_output(m, optp, &in6p->in6p_route, 0,
                           in6p->in6p_moptions, &oifp, 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 */
+
        if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) {
                if (oifp)
                        icmp6_ifoutstat_inc(oifp, type, code);
@@ -566,8 +586,10 @@ rip6_ctloutput(
                case MRT6_ADD_MFC:
                case MRT6_DEL_MFC:
                case MRT6_PIM:
+#if MROUTING
                        error = ip6_mrouter_get(so, sopt);
                        break;
+#endif
                default:
                        error = ip6_ctloutput(so, sopt);
                        break;
@@ -597,8 +619,10 @@ rip6_ctloutput(
                case MRT6_ADD_MFC:
                case MRT6_DEL_MFC:
                case MRT6_PIM:
+#if MROUTING
                        error = ip6_mrouter_set(so, sopt);
                        break;
+#endif
                default:
                        error = ip6_ctloutput(so, sopt);
                        break;
@@ -649,8 +673,10 @@ rip6_detach(struct socket *so)
        if (inp == 0)
                panic("rip6_detach");
        /* xxx: RSVP */
+#if MROUTING
        if (so == ip6_mrouter)
                ip6_mrouter_done();
+#endif
        if (inp->in6p_icmp6filt) {
                FREE(inp->in6p_icmp6filt, M_PCB);
                inp->in6p_icmp6filt = NULL;