]> git.proxmox.com Git - mirror_frr.git/blame - zebra/zebra_ns.h
lib, zebra: Rework zebra_ns to be a bit more modular
[mirror_frr.git] / zebra / zebra_ns.h
CommitLineData
fe18ee2d
DS
1/*
2 * Zebra NS header
3 * Copyright (C) 2016 Cumulus Networks, Inc.
4 * Donald Sharp
5 *
6 * This file is part of Quagga.
7 *
8 * Quagga is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * Quagga is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with Quagga; see the file COPYING. If not, write to the Free
20 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 * 02111-1307, USA.
22 */
23#if !defined(__ZEBRA_NS_H__)
24#define __ZEBRA_NS_H__
25
26#ifdef HAVE_NETLINK
27/* Socket interface to kernel */
28struct nlsock
29{
30 int sock;
31 int seq;
32 struct sockaddr_nl snl;
33 const char *name;
34};
35#endif
36
37/* NetNS ID type. */
38typedef u_int16_t ns_id_t;
39
40struct zebra_ns
41{
42 /* net-ns name. */
43 char name[VRF_NAMSIZ];
44
45 /* Identifier. */
46 ns_id_t ns_id;
47
48#ifdef HAVE_NETLINK
49 struct nlsock netlink; /* kernel messages */
50 struct nlsock netlink_cmd; /* command channel */
51 struct thread *t_netlink;
52#endif
53
54 struct route_table *if_table;
55
56#if defined (HAVE_RTADV)
57 struct rtadv rtadv;
58#endif /* HAVE_RTADV */
59};
60
61#define NS_DEFAULT 0
62#define NS_UNKNOWN UINT16_MAX
63
64struct zebra_ns *zebra_ns_lookup (ns_id_t ns_id);
65
66int zebra_ns_init (void);
67int zebra_ns_enable (ns_id_t ns_id, void **info);
68int zebra_ns_disable (ns_id_t ns_id, void **info);
69#endif