| 201 | DECLARE_MODULE(if_lo, loop_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); |
| 202 | |
| 203 | int |
| 204 | looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, |
| 205 | struct route *ro) |
| 206 | { |
| 207 | u_int32_t af; |
| 208 | #ifdef MAC |
| 209 | int error; |
| 210 | #endif |
| 211 | |
| 212 | M_ASSERTPKTHDR(m); /* check if we have the packet header */ |
| 213 | |
| 214 | #ifdef MAC |
| 215 | error = mac_ifnet_check_transmit(ifp, m); |
| 216 | if (error) { |
| 217 | m_freem(m); |
| 218 | return (error); |
| 219 | } |
| 220 | #endif |
| 221 | |
| 222 | if (ro != NULL && ro->ro_flags & (RT_REJECT|RT_BLACKHOLE)) { |
| 223 | m_freem(m); |
| 224 | return (ro->ro_flags & RT_BLACKHOLE ? 0 : EHOSTUNREACH); |
| 225 | } |
| 226 | |
| 227 | if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); |
| 228 | if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len); |
| 229 | |
| 230 | #ifdef RSS |
| 231 | M_HASHTYPE_CLEAR(m); |
| 232 | #endif |
| 233 | |
| 234 | /* BPF writes need to be handled specially. */ |
| 235 | if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) |
| 236 | bcopy(dst->sa_data, &af, sizeof(af)); |
| 237 | else |
| 238 | af = dst->sa_family; |
| 239 | |
| 240 | #if 1 /* XXX */ |
| 241 | switch (af) { |
| 242 | case AF_INET: |
| 243 | if (ifp->if_capenable & IFCAP_RXCSUM) { |
| 244 | m->m_pkthdr.csum_data = 0xffff; |
| 245 | m->m_pkthdr.csum_flags = LO_CSUM_SET; |
| 246 | } |
| 247 | m->m_pkthdr.csum_flags &= ~LO_CSUM_FEATURES; |
| 248 | break; |
| 249 | case AF_INET6: |
| 250 | #if 0 |
| 251 | /* |
| 252 | * XXX-BZ for now always claim the checksum is good despite |
| 253 | * any interface flags. This is a workaround for 9.1-R and |
| 254 | * a proper solution ought to be sought later. |
| 255 | */ |
| 256 | if (ifp->if_capenable & IFCAP_RXCSUM_IPV6) { |
| 257 | m->m_pkthdr.csum_data = 0xffff; |
| 258 | m->m_pkthdr.csum_flags = LO_CSUM_SET; |
| 259 | } |
| 260 | #else |
nothing calls this directly
no test coverage detected