]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
fe18ee2d DS |
2 | /* |
3 | * Zebra NS header | |
4 | * Copyright (C) 2016 Cumulus Networks, Inc. | |
5 | * Donald Sharp | |
fe18ee2d DS |
6 | */ |
7 | #if !defined(__ZEBRA_NS_H__) | |
8 | #define __ZEBRA_NS_H__ | |
9 | ||
13460c44 | 10 | #include <lib/ns.h> |
942bf97b | 11 | #include <lib/vrf.h> |
13460c44 | 12 | |
bf094f69 QY |
13 | #include "zebra/rib.h" |
14 | #include "zebra/zebra_vrf.h" | |
15 | ||
51e94aa7 EDP |
16 | #ifdef __cplusplus |
17 | extern "C" { | |
18 | #endif | |
19 | ||
fe18ee2d DS |
20 | #ifdef HAVE_NETLINK |
21 | /* Socket interface to kernel */ | |
d62a17ae | 22 | struct nlsock { |
23 | int sock; | |
24 | int seq; | |
25 | struct sockaddr_nl snl; | |
26 | char name[64]; | |
2cf7651f DS |
27 | |
28 | uint8_t *buf; | |
29 | size_t buflen; | |
fe18ee2d DS |
30 | }; |
31 | #endif | |
32 | ||
d62a17ae | 33 | struct zebra_ns { |
34 | /* net-ns name. */ | |
35 | char name[VRF_NAMSIZ]; | |
fe18ee2d | 36 | |
d62a17ae | 37 | /* Identifier. */ |
38 | ns_id_t ns_id; | |
fe18ee2d DS |
39 | |
40 | #ifdef HAVE_NETLINK | |
62b8bb7a MS |
41 | struct nlsock netlink; /* kernel messages */ |
42 | struct nlsock netlink_cmd; /* command channel */ | |
80dcc388 MS |
43 | |
44 | /* dplane system's channels: one for outgoing programming, | |
45 | * for the FIB e.g., and one for incoming events from the OS. | |
46 | */ | |
47 | struct nlsock netlink_dplane_out; | |
48 | struct nlsock netlink_dplane_in; | |
e6685141 | 49 | struct event *t_netlink; |
fe18ee2d DS |
50 | #endif |
51 | ||
d62a17ae | 52 | struct route_table *if_table; |
fe18ee2d | 53 | |
3347430b PG |
54 | /* Back pointer */ |
55 | struct ns *ns; | |
fe18ee2d DS |
56 | }; |
57 | ||
d62a17ae | 58 | struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id); |
fe18ee2d | 59 | |
ac2cb9bf | 60 | int zebra_ns_init(void); |
d62a17ae | 61 | int zebra_ns_enable(ns_id_t ns_id, void **info); |
ff705b15 | 62 | int zebra_ns_disabled(struct ns *ns); |
2961d060 PG |
63 | int zebra_ns_early_shutdown(struct ns *ns, |
64 | void *param_in __attribute__((unused)), | |
65 | void **param_out __attribute__((unused))); | |
66 | int zebra_ns_final_shutdown(struct ns *ns, | |
67 | void *param_in __attribute__((unused)), | |
68 | void **param_out __attribute__((unused))); | |
b95c1883 | 69 | int zebra_ns_config_write(struct vty *vty, struct ns *ns); |
47a08aa9 | 70 | |
51e94aa7 EDP |
71 | #ifdef __cplusplus |
72 | } | |
73 | #endif | |
74 | ||
fe18ee2d | 75 | #endif |