| 2062 | } |
| 2063 | |
| 2064 | static void |
| 2065 | rt_dispatch(struct mbuf *m, sa_family_t saf) |
| 2066 | { |
| 2067 | struct m_tag *tag; |
| 2068 | |
| 2069 | /* |
| 2070 | * Preserve the family from the sockaddr, if any, in an m_tag for |
| 2071 | * use when injecting the mbuf into the routing socket buffer from |
| 2072 | * the netisr. |
| 2073 | */ |
| 2074 | if (saf != AF_UNSPEC) { |
| 2075 | tag = m_tag_get(PACKET_TAG_RTSOCKFAM, sizeof(unsigned short), |
| 2076 | M_NOWAIT); |
| 2077 | if (tag == NULL) { |
| 2078 | m_freem(m); |
| 2079 | return; |
| 2080 | } |
| 2081 | *(unsigned short *)(tag + 1) = saf; |
| 2082 | m_tag_prepend(m, tag); |
| 2083 | } |
| 2084 | #ifdef VIMAGE |
| 2085 | if (V_loif) |
| 2086 | m->m_pkthdr.rcvif = V_loif; |
| 2087 | else { |
| 2088 | m_freem(m); |
| 2089 | return; |
| 2090 | } |
| 2091 | #endif |
| 2092 | netisr_queue(NETISR_ROUTE, m); /* mbuf is free'd on failure. */ |
| 2093 | } |
| 2094 | |
| 2095 | /* |
| 2096 | * Checks if rte can be exported v.r.t jails/vnets. |
no test coverage detected