]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_ns.h
bgpd: Refactor subgroup_announce_table() to reuse an existing helpers
[mirror_frr.git] / zebra / zebra_ns.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Zebra NS header
4 * Copyright (C) 2016 Cumulus Networks, Inc.
5 * Donald Sharp
6 */
7 #if !defined(__ZEBRA_NS_H__)
8 #define __ZEBRA_NS_H__
9
10 #include <lib/ns.h>
11 #include <lib/vrf.h>
12
13 #include "zebra/rib.h"
14 #include "zebra/zebra_vrf.h"
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 #ifdef HAVE_NETLINK
21 /* Socket interface to kernel */
22 struct nlsock {
23 int sock;
24 int seq;
25 struct sockaddr_nl snl;
26 char name[64];
27
28 uint8_t *buf;
29 size_t buflen;
30 };
31 #endif
32
33 struct zebra_ns {
34 /* net-ns name. */
35 char name[VRF_NAMSIZ];
36
37 /* Identifier. */
38 ns_id_t ns_id;
39
40 #ifdef HAVE_NETLINK
41 struct nlsock netlink; /* kernel messages */
42 struct nlsock netlink_cmd; /* command channel */
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;
49 struct event *t_netlink;
50 #endif
51
52 struct route_table *if_table;
53
54 /* Back pointer */
55 struct ns *ns;
56 };
57
58 struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id);
59
60 int zebra_ns_init(void);
61 int zebra_ns_enable(ns_id_t ns_id, void **info);
62 int zebra_ns_disabled(struct ns *ns);
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)));
69 int zebra_ns_config_write(struct vty *vty, struct ns *ns);
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75 #endif