Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
folium-app
GitHub Repository: folium-app/Folium
Path: blob/a-new-beginning/SharedDependencies/Sources/libslirp/ip6_output.c
2 views
1
/* SPDX-License-Identifier: BSD-3-Clause */
2
/*
3
* Copyright (c) 2013
4
* Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
5
*/
6
7
#include "slirp.h"
8
9
/* Number of packets queued before we start sending
10
* (to prevent allocing too many mbufs) */
11
#define IF6_THRESH 10
12
13
/*
14
* IPv6 output. The packet in mbuf chain m contains a IP header
15
*/
16
int ip6_output(struct socket *so, struct mbuf *m, int fast)
17
{
18
Slirp *slirp = m->slirp;
19
M_DUP_DEBUG(slirp, m, 0, 0);
20
21
struct ip6 *ip = mtod(m, struct ip6 *);
22
23
DEBUG_CALL("ip6_output");
24
DEBUG_ARG("so = %p", so);
25
DEBUG_ARG("m = %p", m);
26
27
/* Fill IPv6 header */
28
ip->ip_v = IP6VERSION;
29
ip->ip_hl = IP6_HOP_LIMIT;
30
ip->ip_tc_hi = 0;
31
ip->ip_tc_lo = 0;
32
ip->ip_fl_hi = 0;
33
ip->ip_fl_lo = 0;
34
35
if (fast) {
36
/* We cannot fast-send non-multicast, we'd need a NDP NS */
37
assert(IN6_IS_ADDR_MULTICAST(&ip->ip_dst));
38
if_encap(m->slirp, m);
39
m_free(m);
40
} else {
41
if_output(so, m);
42
}
43
44
return 0;
45
}
46
47