MCPcopy Create free account
hub / github.com/F-Stack/f-stack / phyint_send

Function phyint_send

freebsd/netinet6/ip6_mroute.c:1526–1624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1524}
1525
1526static void
1527phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
1528{
1529#ifdef MRT6DEBUG
1530 char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
1531#endif
1532 struct mbuf *mb_copy;
1533 struct ifnet *ifp = mifp->m6_ifp;
1534 int error = 0;
1535 u_long linkmtu;
1536
1537 /*
1538 * Make a new reference to the packet; make sure that
1539 * the IPv6 header is actually copied, not just referenced,
1540 * so that ip6_output() only scribbles on the copy.
1541 */
1542 mb_copy = m_copym(m, 0, M_COPYALL, M_NOWAIT);
1543 if (mb_copy &&
1544 (!M_WRITABLE(mb_copy) || mb_copy->m_len < sizeof(struct ip6_hdr)))
1545 mb_copy = m_pullup(mb_copy, sizeof(struct ip6_hdr));
1546 if (mb_copy == NULL) {
1547 return;
1548 }
1549 /* set MCAST flag to the outgoing packet */
1550 mb_copy->m_flags |= M_MCAST;
1551
1552 /*
1553 * If we sourced the packet, call ip6_output since we may devide
1554 * the packet into fragments when the packet is too big for the
1555 * outgoing interface.
1556 * Otherwise, we can simply send the packet to the interface
1557 * sending queue.
1558 */
1559 if (m->m_pkthdr.rcvif == NULL) {
1560 struct ip6_moptions im6o;
1561 struct epoch_tracker et;
1562
1563 im6o.im6o_multicast_ifp = ifp;
1564 /* XXX: ip6_output will override ip6->ip6_hlim */
1565 im6o.im6o_multicast_hlim = ip6->ip6_hlim;
1566 im6o.im6o_multicast_loop = 1;
1567 NET_EPOCH_ENTER(et);
1568 error = ip6_output(mb_copy, NULL, NULL, IPV6_FORWARDING, &im6o,
1569 NULL, NULL);
1570 NET_EPOCH_EXIT(et);
1571
1572 MRT6_DLOG(DEBUG_XMIT, "mif %u err %d",
1573 (uint16_t)(mifp - mif6table), error);
1574 return;
1575 }
1576
1577 /*
1578 * If configured to loop back multicasts by default,
1579 * loop back a copy now.
1580 */
1581 if (in6_mcast_loop)
1582 ip6_mloopback(ifp, m);
1583

Callers 1

ip6_mdqFunction · 0.70

Calls 9

m_copymFunction · 0.85
m_pullupFunction · 0.85
ip6_outputFunction · 0.85
ip6_mloopbackFunction · 0.85
bzeroFunction · 0.85
icmp6_errorFunction · 0.85
ip6_sprintfFunction · 0.85
m_clrprotoflagsFunction · 0.50
m_freemFunction · 0.50

Tested by

no test coverage detected