]> git.proxmox.com Git - mirror_frr.git/blame - zebra/zebra_ns.h
Merge pull request #2057 from donaldsharp/fix_1916
[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 *
896014f4
DL
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
fe18ee2d
DS
21 */
22#if !defined(__ZEBRA_NS_H__)
23#define __ZEBRA_NS_H__
24
13460c44 25#include <lib/ns.h>
942bf97b 26#include <lib/vrf.h>
13460c44 27
fe18ee2d
DS
28#ifdef HAVE_NETLINK
29/* Socket interface to kernel */
d62a17ae 30struct nlsock {
31 int sock;
32 int seq;
33 struct sockaddr_nl snl;
34 char name[64];
fe18ee2d
DS
35};
36#endif
37
5335613b
DS
38struct zebra_ns_table {
39 RB_ENTRY(zebra_ns_table) zebra_ns_table_entry;
40
41 uint32_t tableid;
42 afi_t afi;
43
44 struct route_table *table;
45};
46RB_HEAD(zebra_ns_table_head, zebra_ns_table);
47RB_PROTOTYPE(zebra_ns_table_head, zebra_ns_table, zebra_ns_table_entry,
48 zebra_ns_table_entry_compare)
49
d62a17ae 50struct zebra_ns {
51 /* net-ns name. */
52 char name[VRF_NAMSIZ];
fe18ee2d 53
d62a17ae 54 /* Identifier. */
55 ns_id_t ns_id;
fe18ee2d
DS
56
57#ifdef HAVE_NETLINK
d62a17ae 58 struct nlsock netlink; /* kernel messages */
59 struct nlsock netlink_cmd; /* command channel */
60 struct thread *t_netlink;
fe18ee2d
DS
61#endif
62
d62a17ae 63 struct route_table *if_table;
fe18ee2d 64
b7cfce93
MK
65 /* L3-VNI hash table (for EVPN). Only in default instance */
66 struct hash *l3vni_table;
67
d62a17ae 68#if defined(HAVE_RTADV)
69 struct rtadv rtadv;
fe18ee2d 70#endif /* HAVE_RTADV */
5335613b
DS
71
72 struct zebra_ns_table_head ns_tables;
3347430b 73
43fe6a2a
DS
74 struct hash *rules_hash;
75
7661461a
PG
76 struct hash *ipset_hash;
77
78 struct hash *ipset_entry_hash;
79
7abd6c4f
PG
80 struct hash *iptable_hash;
81
3347430b
PG
82 /* Back pointer */
83 struct ns *ns;
fe18ee2d
DS
84};
85
d62a17ae 86struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id);
fe18ee2d 87
d62a17ae 88int zebra_ns_init(void);
89int zebra_ns_enable(ns_id_t ns_id, void **info);
ff705b15 90int zebra_ns_disabled(struct ns *ns);
d62a17ae 91int zebra_ns_disable(ns_id_t ns_id, void **info);
5335613b 92
ae825b8b
DS
93extern struct route_table *zebra_ns_find_table(struct zebra_ns *zns,
94 uint32_t tableid, afi_t afi);
5335613b
DS
95extern struct route_table *zebra_ns_get_table(struct zebra_ns *zns,
96 struct zebra_vrf *zvrf,
97 uint32_t tableid, afi_t afi);
b95c1883 98int zebra_ns_config_write(struct vty *vty, struct ns *ns);
47a08aa9 99
d7c0a89a 100unsigned long zebra_ns_score_proto(uint8_t proto, unsigned short instance);
95a29032 101void zebra_ns_sweep_route(void);
fe18ee2d 102#endif