]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_ns.h
Merge pull request #2112 from mjstapp/ospf_debug
[mirror_frr.git] / zebra / zebra_ns.h
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 along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22 #if !defined(__ZEBRA_NS_H__)
23 #define __ZEBRA_NS_H__
24
25 #include <lib/ns.h>
26 #include <lib/vrf.h>
27
28 #include "zebra/rib.h"
29 #include "zebra/zebra_vrf.h"
30
31 #ifdef HAVE_NETLINK
32 /* Socket interface to kernel */
33 struct nlsock {
34 int sock;
35 int seq;
36 struct sockaddr_nl snl;
37 char name[64];
38 };
39 #endif
40
41 struct zebra_ns_table {
42 RB_ENTRY(zebra_ns_table) zebra_ns_table_entry;
43
44 uint32_t tableid;
45 afi_t afi;
46
47 struct route_table *table;
48 };
49 RB_HEAD(zebra_ns_table_head, zebra_ns_table);
50 RB_PROTOTYPE(zebra_ns_table_head, zebra_ns_table, zebra_ns_table_entry,
51 zebra_ns_table_entry_compare)
52
53 struct zebra_ns {
54 /* net-ns name. */
55 char name[VRF_NAMSIZ];
56
57 /* Identifier. */
58 ns_id_t ns_id;
59
60 #ifdef HAVE_NETLINK
61 struct nlsock netlink; /* kernel messages */
62 struct nlsock netlink_cmd; /* command channel */
63 struct thread *t_netlink;
64 #endif
65
66 struct route_table *if_table;
67
68 /* L3-VNI hash table (for EVPN). Only in default instance */
69 struct hash *l3vni_table;
70
71 #if defined(HAVE_RTADV)
72 struct rtadv rtadv;
73 #endif /* HAVE_RTADV */
74
75 struct zebra_ns_table_head ns_tables;
76
77 struct hash *rules_hash;
78
79 struct hash *ipset_hash;
80
81 struct hash *ipset_entry_hash;
82
83 struct hash *iptable_hash;
84
85 /* Back pointer */
86 struct ns *ns;
87 };
88
89 struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id);
90
91 int zebra_ns_init(void);
92 int zebra_ns_enable(ns_id_t ns_id, void **info);
93 int zebra_ns_disabled(struct ns *ns);
94 int zebra_ns_disable(ns_id_t ns_id, void **info);
95
96 extern struct route_table *zebra_ns_find_table(struct zebra_ns *zns,
97 uint32_t tableid, afi_t afi);
98 extern struct route_table *zebra_ns_get_table(struct zebra_ns *zns,
99 struct zebra_vrf *zvrf,
100 uint32_t tableid, afi_t afi);
101 int zebra_ns_config_write(struct vty *vty, struct ns *ns);
102
103 unsigned long zebra_ns_score_proto(uint8_t proto, unsigned short instance);
104 void zebra_ns_sweep_route(void);
105 #endif