]>
Commit | Line | Data |
---|---|---|
0d6ff71a GS |
1 | /* |
2 | * Copyright (c) 2013 | |
3 | * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne. | |
4 | */ | |
5 | ||
6 | #include "qemu/osdep.h" | |
7 | #include "slirp.h" | |
8 | #include "ip6_icmp.h" | |
9 | ||
10 | /* | |
11 | * IP initialization: fill in IP protocol switch table. | |
12 | * All protocols not implemented in kernel go to raw IP protocol handler. | |
13 | */ | |
14 | void ip6_init(Slirp *slirp) | |
15 | { | |
16 | icmp6_init(slirp); | |
17 | } | |
18 | ||
19 | void ip6_cleanup(Slirp *slirp) | |
20 | { | |
21 | icmp6_cleanup(slirp); | |
22 | } | |
23 | ||
24 | void ip6_input(struct mbuf *m) | |
25 | { | |
26 | struct ip6 *ip6; | |
27 | ||
28 | DEBUG_CALL("ip6_input"); | |
29 | DEBUG_ARG("m = %lx", (long)m); | |
30 | DEBUG_ARG("m_len = %d", m->m_len); | |
31 | ||
32 | if (m->m_len < sizeof(struct ip6)) { | |
33 | goto bad; | |
34 | } | |
35 | ||
36 | ip6 = mtod(m, struct ip6 *); | |
37 | ||
38 | if (ip6->ip_v != IP6VERSION) { | |
39 | goto bad; | |
40 | } | |
41 | ||
42 | /* check ip_ttl for a correct ICMP reply */ | |
43 | if (ip6->ip_hl == 0) { | |
de40abfe | 44 | /*icmp_send_error(m, ICMP_TIMXCEED,ICMP_TIMXCEED_INTRANS, 0,"ttl");*/ |
0d6ff71a GS |
45 | goto bad; |
46 | } | |
47 | ||
48 | /* | |
49 | * Switch out to protocol's input routine. | |
50 | */ | |
51 | switch (ip6->ip_nh) { | |
52 | case IPPROTO_TCP: | |
53 | /*tcp_input(m, hlen, (struct socket *)NULL);*/ | |
54 | break; | |
55 | case IPPROTO_UDP: | |
56 | /*udp_input(m, hlen);*/ | |
57 | break; | |
58 | case IPPROTO_ICMPV6: | |
59 | icmp6_input(m); | |
60 | break; | |
61 | default: | |
62 | m_free(m); | |
63 | } | |
64 | return; | |
65 | bad: | |
66 | m_free(m); | |
67 | } |