]> git.proxmox.com Git - mirror_frr.git/blame - lib/netns_other.c
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
[mirror_frr.git] / lib / netns_other.c
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
e26aedbe
PG
2/*
3 * NetNS backend for non Linux systems
4 * Copyright (C) 2018 6WIND S.A.
e26aedbe
PG
5 */
6
7
cae8bc96
DS
8#if !defined(GNU_LINUX) && defined(OPEN_BSD)
9/* OPEN_BSD */
e26aedbe
PG
10
11#include <zebra.h>
12#include "ns.h"
13#include "log.h"
14#include "memory.h"
15
bf8d3d6a
DL
16DEFINE_MTYPE_STATIC(LIB, NS, "NetNS Context");
17DEFINE_MTYPE_STATIC(LIB, NS_NAME, "NetNS Name");
e26aedbe
PG
18
19
20static inline int ns_compare(const struct ns *ns, const struct ns *ns2);
21
22RB_GENERATE(ns_head, ns, entry, ns_compare)
23
1b3e9a21 24static struct ns_head ns_tree = RB_INITIALIZER(&ns_tree);
e26aedbe
PG
25
26static inline int ns_compare(const struct ns *a, const struct ns *b)
27{
28 return (a->ns_id - b->ns_id);
29}
30
31void ns_terminate(void)
32{
33}
34
35/* API to initialize NETNS managerment
36 * parameter is the default ns_id
37 */
38void 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 */
49int 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 */
55char *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 */
61void ns_walk_func(int (*func)(struct ns *))
62{
63}
64
65/* API to get the NETNS name, from the ns pointer */
66const char *ns_get_name(struct ns *ns)
67{
68 return NULL;
69}
70
71/* only called from vrf ( when removing netns from vrf)
c7975431 72 * or at VRF termination
e26aedbe
PG
73 */
74void 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 */
81int ns_have_netns(void)
82{
83 return 0;
84}
85
86/* API to get context information of a NS */
87void *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 */
96void ns_init(void)
97{
98}
99
e26aedbe
PG
100/* API that can be used to change from NS */
101int ns_switchback_to_initial(void)
102{
103 return 0;
104}
105int 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 */
116struct ns *ns_lookup(ns_id_t ns_id)
117{
118 return NULL;
119}
120
121struct 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 */
131int ns_enable(struct ns *ns, int (*func)(ns_id_t, void *))
132{
133 return 0;
134}
135
03aff2d8
PG
136ns_id_t ns_map_nsid_with_external(ns_id_t ns_id, bool maporunmap)
137{
138 return NS_UNKNOWN;
139}
140
e26aedbe
PG
141struct ns *ns_get_created(struct ns *ns, char *name, ns_id_t ns_id)
142{
143 return NULL;
144}
145
146void ns_disable(struct ns *ns)
147{
148}
149
150#endif /* !GNU_LINUX */