Path: blob/a-new-beginning/SharedDependencies/Sources/libslirp/ip6_output.c
2 views
/* SPDX-License-Identifier: BSD-3-Clause */1/*2* Copyright (c) 20133* Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.4*/56#include "slirp.h"78/* Number of packets queued before we start sending9* (to prevent allocing too many mbufs) */10#define IF6_THRESH 101112/*13* IPv6 output. The packet in mbuf chain m contains a IP header14*/15int ip6_output(struct socket *so, struct mbuf *m, int fast)16{17Slirp *slirp = m->slirp;18M_DUP_DEBUG(slirp, m, 0, 0);1920struct ip6 *ip = mtod(m, struct ip6 *);2122DEBUG_CALL("ip6_output");23DEBUG_ARG("so = %p", so);24DEBUG_ARG("m = %p", m);2526/* Fill IPv6 header */27ip->ip_v = IP6VERSION;28ip->ip_hl = IP6_HOP_LIMIT;29ip->ip_tc_hi = 0;30ip->ip_tc_lo = 0;31ip->ip_fl_hi = 0;32ip->ip_fl_lo = 0;3334if (fast) {35/* We cannot fast-send non-multicast, we'd need a NDP NS */36assert(IN6_IS_ADDR_MULTICAST(&ip->ip_dst));37if_encap(m->slirp, m);38m_free(m);39} else {40if_output(so, m);41}4243return 0;44}454647