-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathicmpv6.h
46 lines (37 loc) · 1.04 KB
/
icmpv6.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef CURO_ICMPV6_H
#define CURO_ICMPV6_H
#include "ipv6.h"
#include <iostream>
#define ICMPV6_TYPE_ECHO_REQUEST 128
#define ICMPV6_TYPE_ECHO_REPLY 129
#define ICMPV6_TYPE_ROUTER_SOLICIATION 133
#define ICMPV6_TYPE_NEIGHBOR_SOLICIATION 135
#define ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT 136
#define ICMPV6_NA_FLAG_ROUTER 0b10000000
#define ICMPV6_NA_FLAG_SOLICITED 0b01000000
#define ICMPV6_NA_FLAG_OVERRIDE 0b00100000
struct icmpv6_hdr {
uint8_t type;
uint8_t code;
uint16_t checksum;
} __attribute__((packed));
struct icmpv6_echo {
icmpv6_hdr hdr;
uint16_t id;
uint16_t seq;
uint8_t data[];
} __attribute__((packed));
struct icmpv6_na {
icmpv6_hdr hdr;
uint8_t flags;
uint8_t reserved1;
uint16_t reserved2;
in6_addr target_addr;
// options area
uint8_t opt_type;
uint8_t opt_length;
uint8_t opt_mac_addr[6];
} __attribute__((packed));
void icmpv6_input(ipv6_device *v6dev, in6_addr source, in6_addr dstination, void *buffer, size_t len);
void send_ns_packet(net_device *dev, in6_addr target_addr);
#endif // CURO_ICMPV6_H