* Ethernet link layer output routine to send a raw frame to the device. * * This assumes that the 14 byte Ethernet header is present and contiguous * in the first mbuf (if BRIDGE'ing). */
| 465 | * in the first mbuf (if BRIDGE'ing). |
| 466 | */ |
| 467 | int |
| 468 | ether_output_frame(struct ifnet *ifp, struct mbuf *m) |
| 469 | { |
| 470 | uint8_t pcp; |
| 471 | |
| 472 | pcp = ifp->if_pcp; |
| 473 | if (pcp != IFNET_PCP_NONE && ifp->if_type != IFT_L2VLAN && |
| 474 | !ether_set_pcp(&m, ifp, pcp)) |
| 475 | return (0); |
| 476 | |
| 477 | if (PFIL_HOOKED_OUT(V_link_pfil_head)) |
| 478 | switch (pfil_run_hooks(V_link_pfil_head, &m, ifp, PFIL_OUT, |
| 479 | NULL)) { |
| 480 | case PFIL_DROPPED: |
| 481 | return (EACCES); |
| 482 | case PFIL_CONSUMED: |
| 483 | return (0); |
| 484 | } |
| 485 | |
| 486 | #ifdef EXPERIMENTAL |
| 487 | #if defined(INET6) && defined(INET) |
| 488 | /* draft-ietf-6man-ipv6only-flag */ |
| 489 | /* Catch ETHERTYPE_IP, and ETHERTYPE_[REV]ARP if we are v6-only. */ |
| 490 | if ((ND_IFINFO(ifp)->flags & ND6_IFF_IPV6_ONLY_MASK) != 0) { |
| 491 | struct ether_header *eh; |
| 492 | |
| 493 | eh = mtod(m, struct ether_header *); |
| 494 | switch (ntohs(eh->ether_type)) { |
| 495 | case ETHERTYPE_IP: |
| 496 | case ETHERTYPE_ARP: |
| 497 | case ETHERTYPE_REVARP: |
| 498 | m_freem(m); |
| 499 | return (EAFNOSUPPORT); |
| 500 | /* NOTREACHED */ |
| 501 | break; |
| 502 | }; |
| 503 | } |
| 504 | #endif |
| 505 | #endif |
| 506 | |
| 507 | /* |
| 508 | * Queue message on interface, update output statistics if |
| 509 | * successful, and start output if interface not yet active. |
| 510 | */ |
| 511 | return ((ifp->if_transmit)(ifp, m)); |
| 512 | } |
| 513 | |
| 514 | /* |
| 515 | * Process a received Ethernet packet; the packet is in the |
no test coverage detected