These changes are the raw update to qemu-2.6.
[kvmfornfv.git] / qemu / slirp / ip6_output.c
1 /*
2  * Copyright (c) 2013
3  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
4  */
5
6 #include "qemu/osdep.h"
7 #include "qemu-common.h"
8 #include "slirp.h"
9
10 /* Number of packets queued before we start sending
11  * (to prevent allocing too many mbufs) */
12 #define IF6_THRESH 10
13
14 /*
15  * IPv6 output. The packet in mbuf chain m contains a IP header
16  */
17 int ip6_output(struct socket *so, struct mbuf *m, int fast)
18 {
19     struct ip6 *ip = mtod(m, struct ip6 *);
20
21     DEBUG_CALL("ip6_output");
22     DEBUG_ARG("so = %lx", (long)so);
23     DEBUG_ARG("m = %lx", (long)m);
24
25     /* Fill IPv6 header */
26     ip->ip_v = IP6VERSION;
27     ip->ip_hl = IP6_HOP_LIMIT;
28     ip->ip_tc_hi = 0;
29     ip->ip_tc_lo = 0;
30     ip->ip_fl_hi = 0;
31     ip->ip_fl_lo = 0;
32
33     if (fast) {
34         if_encap(m->slirp, m);
35     } else {
36         if_output(so, m);
37     }
38
39     return 0;
40 }