]> git.proxmox.com Git - mirror_frr.git/blame - zebra/zebra_ns.c
bgpd, lib, zebra: Rename if_update_vrf -> if_update
[mirror_frr.git] / zebra / zebra_ns.c
CommitLineData
fe18ee2d
DS
1/* zebra NS Routines
2 * Copyright (C) 2016 Cumulus Networks, Inc.
3 * Donald Sharp
4 *
5 * This file is part of Quagga.
6 *
7 * Quagga is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * Quagga is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Quagga; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 */
22#include "zebra.h"
23
13460c44 24#include "lib/ns.h"
fe18ee2d
DS
25#include "lib/vrf.h"
26#include "lib/prefix.h"
27#include "lib/memory.h"
28
29#include "rtadv.h"
30#include "zebra_ns.h"
7c551956 31#include "zebra_vrf.h"
4a1ab8e4
DL
32#include "zebra_memory.h"
33
34DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space")
fe18ee2d
DS
35
36struct zebra_ns *dzns;
37
38struct zebra_ns *
39zebra_ns_lookup (ns_id_t ns_id)
40{
41 return dzns;
42}
43
44int
45zebra_ns_enable (ns_id_t ns_id, void **info)
46{
47 struct zebra_ns *zns = (struct zebra_ns *) (*info);
fe18ee2d
DS
48
49#if defined (HAVE_RTADV)
50 rtadv_init (zns);
51#endif
52
fe18ee2d
DS
53 zns->if_table = route_table_init ();
54 kernel_init (zns);
55 interface_list (zns);
56 route_read (zns);
57
58 return 0;
59}
60
61int
62zebra_ns_disable (ns_id_t ns_id, void **info)
63{
64 struct zebra_ns *zns = (struct zebra_ns *) (*info);
65
58ac32e2 66 route_table_finish (zns->if_table);
fe18ee2d
DS
67#if defined (HAVE_RTADV)
68 rtadv_terminate (zns);
69#endif
70
71 kernel_terminate (zns);
72
73 return 0;
74}
75
76int
77zebra_ns_init (void)
78{
79 dzns = XCALLOC (MTYPE_ZEBRA_NS, sizeof (struct zebra_ns));
80
13460c44
FL
81 ns_init ();
82
fe18ee2d
DS
83 zebra_vrf_init ();
84
85 zebra_ns_enable (0, (void **)&dzns);
86
87 return 0;
88}