]> git.proxmox.com Git - mirror_frr.git/blob - lib/netns_other.c
Merge pull request #12819 from isabelladeleon12/isis_load_config_before_lsp_gen
[mirror_frr.git] / lib / netns_other.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * NetNS backend for non Linux systems
4 * Copyright (C) 2018 6WIND S.A.
5 */
6
7
8 #if !defined(GNU_LINUX) && defined(OPEN_BSD)
9 /* OPEN_BSD */
10
11 #include <zebra.h>
12 #include "ns.h"
13 #include "log.h"
14 #include "memory.h"
15
16 DEFINE_MTYPE_STATIC(LIB, NS, "NetNS Context");
17 DEFINE_MTYPE_STATIC(LIB, NS_NAME, "NetNS Name");
18
19
20 static inline int ns_compare(const struct ns *ns, const struct ns *ns2);
21
22 RB_GENERATE(ns_head, ns, entry, ns_compare)
23
24 static struct ns_head ns_tree = RB_INITIALIZER(&ns_tree);
25
26 static inline int ns_compare(const struct ns *a, const struct ns *b)
27 {
28 return (a->ns_id - b->ns_id);
29 }
30
31 void ns_terminate(void)
32 {
33 }
34
35 /* API to initialize NETNS managerment
36 * parameter is the default ns_id
37 */
38 void ns_init_management(ns_id_t ns_id)
39 {
40 }
41
42
43 /*
44 * NS utilities
45 */
46
47 /* Create a socket serving for the given NS
48 */
49 int ns_socket(int domain, int type, int protocol, ns_id_t ns_id)
50 {
51 return -1;
52 }
53
54 /* return the path of the NETNS */
55 char *ns_netns_pathname(struct vty *vty, const char *name)
56 {
57 return NULL;
58 }
59
60 /* Parse and execute a function on all the NETNS */
61 void ns_walk_func(int (*func)(struct ns *))
62 {
63 }
64
65 /* API to get the NETNS name, from the ns pointer */
66 const char *ns_get_name(struct ns *ns)
67 {
68 return NULL;
69 }
70
71 /* only called from vrf ( when removing netns from vrf)
72 * or at VRF termination
73 */
74 void ns_delete(struct ns *ns)
75 {
76 }
77
78 /* return > 0 if netns is available
79 * called by VRF to check netns backend is available for VRF
80 */
81 int ns_have_netns(void)
82 {
83 return 0;
84 }
85
86 /* API to get context information of a NS */
87 void *ns_info_lookup(ns_id_t ns_id)
88 {
89 return NULL;
90 }
91
92 /*
93 * NS init routine
94 * should be called from backendx
95 */
96 void ns_init(void)
97 {
98 }
99
100 /* API that can be used to change from NS */
101 int ns_switchback_to_initial(void)
102 {
103 return 0;
104 }
105 int ns_switch_to_netns(const char *netns_name)
106 {
107 return 0;
108 }
109
110 /*
111 * NS handling routines.
112 * called by modules that use NS backend
113 */
114
115 /* API to search for already present NETNS */
116 struct ns *ns_lookup(ns_id_t ns_id)
117 {
118 return NULL;
119 }
120
121 struct ns *ns_lookup_name(const char *name)
122 {
123 return NULL;
124 }
125
126 /* API to handle NS : creation, enable, disable
127 * for enable, a callback function is passed as parameter
128 * the callback belongs to the module that uses NS as backend
129 * upon enabling the NETNS, the upper layer is informed
130 */
131 int ns_enable(struct ns *ns, int (*func)(ns_id_t, void *))
132 {
133 return 0;
134 }
135
136 ns_id_t ns_map_nsid_with_external(ns_id_t ns_id, bool maporunmap)
137 {
138 return NS_UNKNOWN;
139 }
140
141 struct ns *ns_get_created(struct ns *ns, char *name, ns_id_t ns_id)
142 {
143 return NULL;
144 }
145
146 void ns_disable(struct ns *ns)
147 {
148 }
149
150 #endif /* !GNU_LINUX */