]>
git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_ns.c
2 * Copyright (C) 2016 Cumulus Networks, Inc.
5 * This file is part of Quagga.
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
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.
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
26 #include "lib/prefix.h"
27 #include "lib/memory.h"
31 #include "zebra_vrf.h"
32 #include "zebra_memory.h"
34 DEFINE_MTYPE(ZEBRA
, ZEBRA_NS
, "Zebra Name Space")
35 DEFINE_MTYPE(ZEBRA
, NETLINK_NAME
, "Netlink name")
37 struct zebra_ns
*dzns
;
40 zebra_ns_lookup (ns_id_t ns_id
)
46 zebra_ns_enable (ns_id_t ns_id
, void **info
)
48 struct zebra_ns
*zns
= (struct zebra_ns
*) (*info
);
53 #if defined (HAVE_RTADV)
58 /* Initialize netlink sockets */
59 snprintf (nl_name
, 64, "netlink-listen (NS %u)", ns_id
);
60 zns
->netlink
.sock
= -1;
61 zns
->netlink
.name
= XSTRDUP (MTYPE_NETLINK_NAME
, nl_name
);
63 snprintf (nl_name
, 64, "netlink-cmd (NS %u)", ns_id
);
64 zns
->netlink_cmd
.sock
= -1;
65 zns
->netlink_cmd
.name
= XSTRDUP (MTYPE_NETLINK_NAME
, nl_name
);
67 zns
->if_table
= route_table_init ();
76 zebra_ns_disable (ns_id_t ns_id
, void **info
)
78 struct zebra_ns
*zns
= (struct zebra_ns
*) (*info
);
80 #if defined (HAVE_RTADV)
81 rtadv_terminate (zns
);
84 kernel_terminate (zns
);
92 dzns
= XCALLOC (MTYPE_ZEBRA_NS
, sizeof (struct zebra_ns
));
98 zebra_ns_enable (0, (void **)&dzns
);