2016-04-14 04:40:18 +02:00
|
|
|
/* zebra NS Routines
|
|
|
|
* Copyright (C) 2016 Cumulus Networks, Inc.
|
|
|
|
* Donald Sharp
|
|
|
|
*
|
|
|
|
* This file is part of Quagga.
|
|
|
|
*
|
|
|
|
* Quagga is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
* later version.
|
|
|
|
*
|
|
|
|
* Quagga is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
2017-05-13 10:25:29 +02:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; see the file COPYING; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2016-04-14 04:40:18 +02:00
|
|
|
*/
|
|
|
|
#include "zebra.h"
|
|
|
|
|
2014-07-03 12:24:34 +02:00
|
|
|
#include "lib/ns.h"
|
2016-04-14 04:40:18 +02:00
|
|
|
#include "lib/vrf.h"
|
|
|
|
#include "lib/prefix.h"
|
|
|
|
#include "lib/memory.h"
|
|
|
|
|
|
|
|
#include "rtadv.h"
|
|
|
|
#include "zebra_ns.h"
|
2016-04-14 15:20:47 +02:00
|
|
|
#include "zebra_vrf.h"
|
2015-05-29 05:48:31 +02:00
|
|
|
#include "zebra_memory.h"
|
|
|
|
|
|
|
|
DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space")
|
2016-04-14 04:40:18 +02:00
|
|
|
|
|
|
|
struct zebra_ns *dzns;
|
|
|
|
|
|
|
|
struct zebra_ns *
|
|
|
|
zebra_ns_lookup (ns_id_t ns_id)
|
|
|
|
{
|
|
|
|
return dzns;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
zebra_ns_enable (ns_id_t ns_id, void **info)
|
|
|
|
{
|
|
|
|
struct zebra_ns *zns = (struct zebra_ns *) (*info);
|
|
|
|
|
|
|
|
#if defined (HAVE_RTADV)
|
|
|
|
rtadv_init (zns);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
zns->if_table = route_table_init ();
|
|
|
|
kernel_init (zns);
|
|
|
|
interface_list (zns);
|
|
|
|
route_read (zns);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
zebra_ns_disable (ns_id_t ns_id, void **info)
|
|
|
|
{
|
|
|
|
struct zebra_ns *zns = (struct zebra_ns *) (*info);
|
|
|
|
|
2016-11-01 21:57:53 +01:00
|
|
|
route_table_finish (zns->if_table);
|
2016-04-14 04:40:18 +02:00
|
|
|
#if defined (HAVE_RTADV)
|
|
|
|
rtadv_terminate (zns);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
kernel_terminate (zns);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
zebra_ns_init (void)
|
|
|
|
{
|
|
|
|
dzns = XCALLOC (MTYPE_ZEBRA_NS, sizeof (struct zebra_ns));
|
|
|
|
|
2014-07-03 12:24:34 +02:00
|
|
|
ns_init ();
|
|
|
|
|
2016-04-14 04:40:18 +02:00
|
|
|
zebra_vrf_init ();
|
|
|
|
|
|
|
|
zebra_ns_enable (0, (void **)&dzns);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|