-
Notifications
You must be signed in to change notification settings - Fork 2
/
neighsnoopd_shared.h
42 lines (35 loc) · 1.09 KB
/
neighsnoopd_shared.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
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* SPDX-FileCopyrightText: 2024 - 1984 Hosting Company <[email protected]> */
/* SPDX-FileCopyrightText: 2024 - Freyx Solutions <[email protected]> */
/* SPDX-FileContributor: Freysteinn Alfredsson <[email protected]> */
/* SPDX-FileContributor: Julius Thor Bess Rikardsson <[email protected]> */
#ifndef NEIGHSNOOPD_SHARED_H_
#define NEIGHSNOOPD_SHARED_H_
struct network_entry {
__u32 prefixlen;
struct in6_addr network;
};
struct network_value {
__u32 network_id;
};
struct neighbor_reply {
__u8 mac[6];
__be32 vlan_id;
__u32 network_id;
struct in6_addr ip;
__u8 in_family;
__u32 ingress_ifindex;
};
/*
* Maps an IPv4 address into an IPv6 address according to RFC 4291 sec 2.5.5.2
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static void map_ipv4_to_ipv6(struct in6_addr *ipv6, __be32 ipv4)
{
__builtin_memset(((__u8 *)ipv6), 0x00, 10);
__builtin_memset(((__u8 *)ipv6) + 10, 0xff, 2);
((__u32 *)ipv6)[3] = ipv4;
}
#pragma GCC diagnostic pop
#endif // NEIGHSNOOPD_SHARED_H_