]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_ns.c
ospf6d: When removing a vertex free memory associated with it
[mirror_frr.git] / zebra / zebra_ns.c
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
24 #include "lib/ns.h"
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"
31 #include "zebra_vrf.h"
32 #include "zebra_memory.h"
33
34 DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space")
35
36 struct zebra_ns *dzns;
37
38 struct zebra_ns *zebra_ns_lookup(ns_id_t ns_id)
39 {
40 return dzns;
41 }
42
43 int zebra_ns_enable(ns_id_t ns_id, void **info)
44 {
45 struct zebra_ns *zns = (struct zebra_ns *)(*info);
46
47 #if defined(HAVE_RTADV)
48 rtadv_init(zns);
49 #endif
50
51 zns->if_table = route_table_init();
52 kernel_init(zns);
53 interface_list(zns);
54 route_read(zns);
55
56 return 0;
57 }
58
59 int zebra_ns_disable(ns_id_t ns_id, void **info)
60 {
61 struct zebra_ns *zns = (struct zebra_ns *)(*info);
62
63 route_table_finish(zns->if_table);
64 #if defined(HAVE_RTADV)
65 rtadv_terminate(zns);
66 #endif
67
68 kernel_terminate(zns);
69
70 return 0;
71 }
72
73 int zebra_ns_init(void)
74 {
75 dzns = XCALLOC(MTYPE_ZEBRA_NS, sizeof(struct zebra_ns));
76
77 ns_init();
78
79 zebra_vrf_init();
80
81 zebra_ns_enable(0, (void **)&dzns);
82
83 return 0;
84 }