forked from Mirror/frr
ospf6d : Preparing for ospf6d VRF support.
1. Removed the VRF_DEFAULT dependency from ospf6d. 2. The dependency on show command still exist will be fixed when the ospf6 master is available. Co-authored-by: Harios <hari@niralnetworks.com> Signed-off-by: Kaushik <kaushik@niralnetworks.com>
This commit is contained in:
parent
ddffdcf728
commit
c5d28568c6
|
@ -72,7 +72,7 @@ static int ospf6_abr_nexthops_belong_to_area(struct ospf6_route *route,
|
|||
struct ospf6_interface *oi;
|
||||
|
||||
oi = ospf6_interface_lookup_by_ifindex(
|
||||
ospf6_route_get_first_nh_index(route));
|
||||
ospf6_route_get_first_nh_index(route), area->ospf6->vrf_id);
|
||||
if (oi && oi->area && oi->area == area)
|
||||
return 1;
|
||||
else
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
#include "ospf6_flood.h"
|
||||
#include "ospf6d.h"
|
||||
|
||||
static void ospf6_asbr_redistribute_set(int type);
|
||||
static void ospf6_asbr_redistribute_unset(int type);
|
||||
static void ospf6_asbr_redistribute_set(int type, vrf_id_t vrf_id);
|
||||
static void ospf6_asbr_redistribute_unset(int type, vrf_id_t vrf_id);
|
||||
|
||||
unsigned char conf_debug_ospf6_asbr = 0;
|
||||
|
||||
|
@ -881,8 +881,8 @@ static int ospf6_asbr_routemap_update_timer(struct thread *thread)
|
|||
__func__, ospf6->rmap[arg_type].name,
|
||||
ZROUTE_NAME(arg_type));
|
||||
|
||||
ospf6_zebra_no_redistribute(arg_type);
|
||||
ospf6_zebra_redistribute(arg_type);
|
||||
ospf6_zebra_no_redistribute(arg_type, ospf6->vrf_id);
|
||||
ospf6_zebra_redistribute(arg_type, ospf6->vrf_id);
|
||||
}
|
||||
|
||||
XFREE(MTYPE_OSPF6_DIST_ARGS, arg);
|
||||
|
@ -948,9 +948,11 @@ static void ospf6_asbr_routemap_update(const char *mapname)
|
|||
"%s: route-map %s deleted, reset redist %s",
|
||||
__func__, mapname,
|
||||
ZROUTE_NAME(type));
|
||||
ospf6_asbr_redistribute_unset(type);
|
||||
ospf6_asbr_redistribute_unset(
|
||||
type, ospf6->vrf_id);
|
||||
ospf6_asbr_routemap_set(type, mapname);
|
||||
ospf6_asbr_redistribute_set(type);
|
||||
ospf6_asbr_redistribute_set(
|
||||
type, ospf6->vrf_id);
|
||||
}
|
||||
}
|
||||
} else
|
||||
|
@ -977,17 +979,17 @@ int ospf6_asbr_is_asbr(struct ospf6 *o)
|
|||
return o->external_table->count;
|
||||
}
|
||||
|
||||
static void ospf6_asbr_redistribute_set(int type)
|
||||
static void ospf6_asbr_redistribute_set(int type, vrf_id_t vrf_id)
|
||||
{
|
||||
ospf6_zebra_redistribute(type);
|
||||
ospf6_zebra_redistribute(type, vrf_id);
|
||||
}
|
||||
|
||||
static void ospf6_asbr_redistribute_unset(int type)
|
||||
static void ospf6_asbr_redistribute_unset(int type, vrf_id_t vrf_id)
|
||||
{
|
||||
struct ospf6_route *route;
|
||||
struct ospf6_external_info *info;
|
||||
|
||||
ospf6_zebra_no_redistribute(type);
|
||||
ospf6_zebra_no_redistribute(type, vrf_id);
|
||||
|
||||
for (route = ospf6_route_head(ospf6->external_table); route;
|
||||
route = ospf6_route_next(route)) {
|
||||
|
@ -1031,7 +1033,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
|
|||
struct listnode *lnode, *lnnode;
|
||||
struct ospf6_area *oa;
|
||||
|
||||
if (!ospf6_zebra_is_redistribute(type))
|
||||
if (!ospf6_zebra_is_redistribute(type, ospf6->vrf_id))
|
||||
return;
|
||||
|
||||
memset(&troute, 0, sizeof(troute));
|
||||
|
@ -1243,13 +1245,15 @@ DEFUN (ospf6_redistribute,
|
|||
{
|
||||
int type;
|
||||
|
||||
OSPF6_CMD_CHECK_RUNNING();
|
||||
|
||||
char *proto = argv[argc - 1]->text;
|
||||
type = proto_redistnum(AFI_IP6, proto);
|
||||
if (type < 0)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
ospf6_asbr_redistribute_unset(type);
|
||||
ospf6_asbr_redistribute_set(type);
|
||||
ospf6_asbr_redistribute_unset(type, ospf6->vrf_id);
|
||||
ospf6_asbr_redistribute_set(type, ospf6->vrf_id);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1265,14 +1269,16 @@ DEFUN (ospf6_redistribute_routemap,
|
|||
int idx_word = 3;
|
||||
int type;
|
||||
|
||||
OSPF6_CMD_CHECK_RUNNING();
|
||||
|
||||
char *proto = argv[idx_protocol]->text;
|
||||
type = proto_redistnum(AFI_IP6, proto);
|
||||
if (type < 0)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
ospf6_asbr_redistribute_unset(type);
|
||||
ospf6_asbr_redistribute_unset(type, ospf6->vrf_id);
|
||||
ospf6_asbr_routemap_set(type, argv[idx_word]->arg);
|
||||
ospf6_asbr_redistribute_set(type);
|
||||
ospf6_asbr_redistribute_set(type, ospf6->vrf_id);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1288,12 +1294,14 @@ DEFUN (no_ospf6_redistribute,
|
|||
int idx_protocol = 2;
|
||||
int type;
|
||||
|
||||
OSPF6_CMD_CHECK_RUNNING();
|
||||
|
||||
char *proto = argv[idx_protocol]->text;
|
||||
type = proto_redistnum(AFI_IP6, proto);
|
||||
if (type < 0)
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
|
||||
ospf6_asbr_redistribute_unset(type);
|
||||
ospf6_asbr_redistribute_unset(type, ospf6->vrf_id);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -1305,7 +1313,7 @@ int ospf6_redistribute_config_write(struct vty *vty)
|
|||
for (type = 0; type < ZEBRA_ROUTE_MAX; type++) {
|
||||
if (type == ZEBRA_ROUTE_OSPF6)
|
||||
continue;
|
||||
if (!ospf6_zebra_is_redistribute(type))
|
||||
if (!ospf6_zebra_is_redistribute(type, ospf6->vrf_id))
|
||||
continue;
|
||||
|
||||
if (ospf6->rmap[type].name)
|
||||
|
@ -1340,7 +1348,7 @@ static void ospf6_redistribute_show_config(struct vty *vty)
|
|||
for (type = 0; type < ZEBRA_ROUTE_MAX; type++) {
|
||||
if (type == ZEBRA_ROUTE_OSPF6)
|
||||
continue;
|
||||
if (!ospf6_zebra_is_redistribute(type))
|
||||
if (!ospf6_zebra_is_redistribute(type, ospf6->vrf_id))
|
||||
continue;
|
||||
|
||||
if (ospf6->rmap[type].name)
|
||||
|
@ -1408,7 +1416,7 @@ ospf6_routemap_rule_match_interface(void *rule, const struct prefix *prefix,
|
|||
|
||||
if (type == RMAP_OSPF6) {
|
||||
ei = ((struct ospf6_route *)object)->route_option;
|
||||
ifp = if_lookup_by_name((char *)rule, VRF_DEFAULT);
|
||||
ifp = if_lookup_by_name_all_vrf((char *)rule);
|
||||
|
||||
if (ifp != NULL && ei->ifindex == ifp->ifindex)
|
||||
return RMAP_MATCH;
|
||||
|
@ -1880,15 +1888,15 @@ void ospf6_asbr_init(void)
|
|||
install_element(OSPF6_NODE, &no_ospf6_redistribute_cmd);
|
||||
}
|
||||
|
||||
void ospf6_asbr_redistribute_reset(void)
|
||||
void ospf6_asbr_redistribute_reset(vrf_id_t vrf_id)
|
||||
{
|
||||
int type;
|
||||
|
||||
for (type = 0; type < ZEBRA_ROUTE_MAX; type++) {
|
||||
if (type == ZEBRA_ROUTE_OSPF6)
|
||||
continue;
|
||||
if (ospf6_zebra_is_redistribute(type))
|
||||
ospf6_asbr_redistribute_unset(type);
|
||||
if (ospf6_zebra_is_redistribute(type, vrf_id))
|
||||
ospf6_asbr_redistribute_unset(type, vrf_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ extern void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex,
|
|||
extern int ospf6_redistribute_config_write(struct vty *vty);
|
||||
|
||||
extern void ospf6_asbr_init(void);
|
||||
extern void ospf6_asbr_redistribute_reset(void);
|
||||
extern void ospf6_asbr_redistribute_reset(vrf_id_t vrf_id);
|
||||
extern void ospf6_asbr_terminate(void);
|
||||
extern void ospf6_asbr_send_externals_to_area(struct ospf6_area *);
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ void ospf6_bfd_reg_dereg_nbr(struct ospf6_neighbor *on, int command)
|
|||
cbit = CHECK_FLAG(bfd_info->flags, BFD_FLAG_BFD_CBIT_ON);
|
||||
|
||||
bfd_peer_sendmsg(zclient, bfd_info, AF_INET6, &on->linklocal_addr,
|
||||
on->ospf6_if->linklocal_addr, ifp->name, 0, 0,
|
||||
cbit, command, 0, VRF_DEFAULT);
|
||||
on->ospf6_if->linklocal_addr, ifp->name, 0, 0, cbit,
|
||||
command, 0, ifp->vrf_id);
|
||||
|
||||
if (command == ZEBRA_BFD_DEST_DEREGISTER)
|
||||
bfd_info_free((struct bfd_info **)&on->bfd_info);
|
||||
|
@ -143,7 +143,7 @@ static void ospf6_bfd_reg_dereg_all_nbr(struct ospf6_interface *oi, int command)
|
|||
*/
|
||||
static int ospf6_bfd_nbr_replay(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
|
||||
struct listnode *node;
|
||||
struct interface *ifp;
|
||||
struct ospf6_interface *oi;
|
||||
|
|
|
@ -56,12 +56,13 @@ const char *const ospf6_interface_state_str[] = {
|
|||
"None", "Down", "Loopback", "Waiting", "PointToPoint",
|
||||
"DROther", "BDR", "DR", NULL};
|
||||
|
||||
struct ospf6_interface *ospf6_interface_lookup_by_ifindex(ifindex_t ifindex)
|
||||
struct ospf6_interface *ospf6_interface_lookup_by_ifindex(ifindex_t ifindex,
|
||||
vrf_id_t vrf_id)
|
||||
{
|
||||
struct ospf6_interface *oi;
|
||||
struct interface *ifp;
|
||||
|
||||
ifp = if_lookup_by_index(ifindex, VRF_DEFAULT);
|
||||
ifp = if_lookup_by_index(ifindex, vrf_id);
|
||||
if (ifp == NULL)
|
||||
return (struct ospf6_interface *)NULL;
|
||||
|
||||
|
@ -1022,7 +1023,7 @@ DEFUN (show_ipv6_ospf6_interface,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static int ospf6_interface_show_traffic(struct vty *vty, uint32_t vrf_id,
|
||||
static int ospf6_interface_show_traffic(struct vty *vty,
|
||||
struct interface *intf_ifp,
|
||||
int display_once)
|
||||
{
|
||||
|
@ -1030,7 +1031,7 @@ static int ospf6_interface_show_traffic(struct vty *vty, uint32_t vrf_id,
|
|||
struct vrf *vrf = NULL;
|
||||
struct ospf6_interface *oi = NULL;
|
||||
|
||||
vrf = vrf_lookup_by_id(vrf_id);
|
||||
vrf = vrf_lookup_by_id(intf_ifp->vrf_id);
|
||||
|
||||
if (!display_once) {
|
||||
vty_out(vty, "\n");
|
||||
|
@ -1105,7 +1106,7 @@ DEFUN (show_ipv6_ospf6_interface_traffic,
|
|||
}
|
||||
}
|
||||
|
||||
ospf6_interface_show_traffic(vty, VRF_DEFAULT, ifp, display_once);
|
||||
ospf6_interface_show_traffic(vty, ifp, display_once);
|
||||
|
||||
|
||||
return CMD_SUCCESS;
|
||||
|
|
|
@ -170,7 +170,8 @@ extern const char *const ospf6_interface_state_str[];
|
|||
|
||||
/* Function Prototypes */
|
||||
|
||||
extern struct ospf6_interface *ospf6_interface_lookup_by_ifindex(ifindex_t);
|
||||
extern struct ospf6_interface *
|
||||
ospf6_interface_lookup_by_ifindex(ifindex_t, vrf_id_t vrf_id);
|
||||
extern struct ospf6_interface *ospf6_interface_create(struct interface *);
|
||||
extern void ospf6_interface_delete(struct ospf6_interface *);
|
||||
|
||||
|
|
|
@ -1570,7 +1570,7 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
|
|||
== oa->ospf6->router_id) {
|
||||
ifp = if_lookup_prefix(
|
||||
&old_route->prefix,
|
||||
VRF_DEFAULT);
|
||||
oa->ospf6->vrf_id);
|
||||
if (ifp)
|
||||
ospf6_route_add_nexthop(
|
||||
old_route,
|
||||
|
@ -1714,7 +1714,8 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
|
|||
memcpy(&route->path.ls_prefix, &ls_prefix,
|
||||
sizeof(struct prefix));
|
||||
if (direct_connect) {
|
||||
ifp = if_lookup_prefix(&route->prefix, VRF_DEFAULT);
|
||||
ifp = if_lookup_prefix(&route->prefix,
|
||||
oa->ospf6->vrf_id);
|
||||
if (ifp)
|
||||
ospf6_route_add_nexthop(route, ifp->ifindex,
|
||||
NULL);
|
||||
|
|
|
@ -79,15 +79,17 @@ struct thread_master *master;
|
|||
|
||||
static void __attribute__((noreturn)) ospf6_exit(int status)
|
||||
{
|
||||
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||
struct vrf *vrf;
|
||||
struct interface *ifp;
|
||||
|
||||
frr_early_fini();
|
||||
|
||||
if (ospf6) {
|
||||
vrf = vrf_lookup_by_id(ospf6->vrf_id);
|
||||
ospf6_delete(ospf6);
|
||||
ospf6 = NULL;
|
||||
}
|
||||
} else
|
||||
vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||
|
||||
bfd_gbl_exit();
|
||||
|
||||
|
|
|
@ -1554,7 +1554,7 @@ int ospf6_receive(struct thread *thread)
|
|||
return 0;
|
||||
}
|
||||
|
||||
oi = ospf6_interface_lookup_by_ifindex(ifindex);
|
||||
oi = ospf6_interface_lookup_by_ifindex(ifindex, ospf6->vrf_id);
|
||||
if (oi == NULL || oi->area == NULL
|
||||
|| CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE)) {
|
||||
if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV))
|
||||
|
|
|
@ -307,14 +307,14 @@ void ospf6_route_zebra_copy_nexthops(struct ospf6_route *route,
|
|||
inet_ntop(AF_INET6, &nh->address, buf,
|
||||
sizeof(buf));
|
||||
ifname = ifindex2ifname(nh->ifindex,
|
||||
VRF_DEFAULT);
|
||||
ospf6->vrf_id);
|
||||
zlog_debug(" nexthop: %s%%%.*s(%d)", buf,
|
||||
IFNAMSIZ, ifname, nh->ifindex);
|
||||
}
|
||||
if (i >= entries)
|
||||
return;
|
||||
|
||||
nexthops[i].vrf_id = VRF_DEFAULT;
|
||||
nexthops[i].vrf_id = ospf6->vrf_id;
|
||||
nexthops[i].ifindex = nh->ifindex;
|
||||
if (!IN6_IS_ADDR_UNSPECIFIED(&nh->address)) {
|
||||
nexthops[i].gate.ipv6 = nh->address;
|
||||
|
@ -1042,6 +1042,11 @@ void ospf6_route_show(struct vty *vty, struct ospf6_route *route)
|
|||
struct listnode *node;
|
||||
struct ospf6_nexthop *nh;
|
||||
|
||||
if (ospf6 == NULL) {
|
||||
vty_out(vty, "OSPFv3 is not running\n");
|
||||
return;
|
||||
}
|
||||
|
||||
monotime(&now);
|
||||
timersub(&now, &route->changed, &res);
|
||||
timerstring(&res, duration, sizeof(duration));
|
||||
|
@ -1060,7 +1065,7 @@ void ospf6_route_show(struct vty *vty, struct ospf6_route *route)
|
|||
for (ALL_LIST_ELEMENTS_RO(route->nh_list, node, nh)) {
|
||||
/* nexthop */
|
||||
inet_ntop(AF_INET6, &nh->address, nexthop, sizeof(nexthop));
|
||||
ifname = ifindex2ifname(nh->ifindex, VRF_DEFAULT);
|
||||
ifname = ifindex2ifname(nh->ifindex, ospf6->vrf_id);
|
||||
|
||||
if (!i) {
|
||||
vty_out(vty, "%c%1s %2s %-30s %-25s %6.*s %s\n",
|
||||
|
@ -1086,6 +1091,11 @@ void ospf6_route_show_detail(struct vty *vty, struct ospf6_route *route)
|
|||
struct listnode *node;
|
||||
struct ospf6_nexthop *nh;
|
||||
|
||||
if (ospf6 == NULL) {
|
||||
vty_out(vty, "OSPFv3 is not running\n");
|
||||
return;
|
||||
}
|
||||
|
||||
monotime(&now);
|
||||
|
||||
/* destination */
|
||||
|
@ -1160,7 +1170,7 @@ void ospf6_route_show_detail(struct vty *vty, struct ospf6_route *route)
|
|||
for (ALL_LIST_ELEMENTS_RO(route->nh_list, node, nh)) {
|
||||
/* nexthop */
|
||||
inet_ntop(AF_INET6, &nh->address, nexthop, sizeof(nexthop));
|
||||
ifname = ifindex2ifname(nh->ifindex, VRF_DEFAULT);
|
||||
ifname = ifindex2ifname(nh->ifindex, ospf6->vrf_id);
|
||||
vty_out(vty, " %s %.*s\n", nexthop, IFNAMSIZ, ifname);
|
||||
}
|
||||
vty_out(vty, "\n");
|
||||
|
|
|
@ -837,7 +837,7 @@ static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length,
|
|||
int exact, size_t *var_len,
|
||||
WriteMethod **write_method)
|
||||
{
|
||||
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||
struct vrf *vrf;
|
||||
struct ospf6_lsa *lsa = NULL;
|
||||
ifindex_t ifindex;
|
||||
uint32_t area_id, id, instid, adv_router;
|
||||
|
@ -861,6 +861,7 @@ static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length,
|
|||
if (ospf6 == NULL)
|
||||
return NULL;
|
||||
|
||||
vrf = vrf_lookup_by_id(ospf6->vrf_id);
|
||||
/* Get variable length. */
|
||||
offset = name + v->namelen;
|
||||
offsetlen = *length - v->namelen;
|
||||
|
@ -926,7 +927,8 @@ static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length,
|
|||
return NULL;
|
||||
lsa = ospf6_lsdb_lookup(type, id, adv_router, oa->lsdb);
|
||||
} else if (v->magic & OSPFv3WWLINKTABLE) {
|
||||
oi = ospf6_interface_lookup_by_ifindex(ifindex);
|
||||
oi = ospf6_interface_lookup_by_ifindex(ifindex,
|
||||
ospf6->vrf_id);
|
||||
if (!oi || oi->instance_id != instid)
|
||||
return NULL;
|
||||
lsa = ospf6_lsdb_lookup(type, id, adv_router, oi->lsdb);
|
||||
|
@ -963,7 +965,7 @@ static uint8_t *ospfv3WwLsdbEntry(struct variable *v, oid *name, size_t *length,
|
|||
if (!iif->ifindex)
|
||||
continue;
|
||||
oi = ospf6_interface_lookup_by_ifindex(
|
||||
iif->ifindex);
|
||||
iif->ifindex, iif->vrf_id);
|
||||
if (!oi)
|
||||
continue;
|
||||
if (iif->ifindex < ifindex)
|
||||
|
@ -1038,7 +1040,7 @@ static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length,
|
|||
int exact, size_t *var_len,
|
||||
WriteMethod **write_method)
|
||||
{
|
||||
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||
struct vrf *vrf;
|
||||
ifindex_t ifindex = 0;
|
||||
unsigned int instid = 0;
|
||||
struct ospf6_interface *oi = NULL;
|
||||
|
@ -1058,6 +1060,7 @@ static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length,
|
|||
if (ospf6 == NULL)
|
||||
return NULL;
|
||||
|
||||
vrf = vrf_lookup_by_id(ospf6->vrf_id);
|
||||
/* Get variable length. */
|
||||
offset = name + v->namelen;
|
||||
offsetlen = *length - v->namelen;
|
||||
|
@ -1080,7 +1083,7 @@ static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length,
|
|||
// offsetlen -= len;
|
||||
|
||||
if (exact) {
|
||||
oi = ospf6_interface_lookup_by_ifindex(ifindex);
|
||||
oi = ospf6_interface_lookup_by_ifindex(ifindex, ospf6->vrf_id);
|
||||
if (!oi || oi->instance_id != instid)
|
||||
return NULL;
|
||||
} else {
|
||||
|
@ -1095,7 +1098,8 @@ static uint8_t *ospfv3IfEntry(struct variable *v, oid *name, size_t *length,
|
|||
for (ALL_LIST_ELEMENTS_RO(ifslist, i, iif)) {
|
||||
if (!iif->ifindex)
|
||||
continue;
|
||||
oi = ospf6_interface_lookup_by_ifindex(iif->ifindex);
|
||||
oi = ospf6_interface_lookup_by_ifindex(iif->ifindex,
|
||||
iif->vrf_id);
|
||||
if (!oi)
|
||||
continue;
|
||||
if (iif->ifindex > ifindex
|
||||
|
@ -1191,7 +1195,7 @@ static uint8_t *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length,
|
|||
int exact, size_t *var_len,
|
||||
WriteMethod **write_method)
|
||||
{
|
||||
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||
struct vrf *vrf;
|
||||
ifindex_t ifindex = 0;
|
||||
unsigned int instid, rtrid;
|
||||
struct ospf6_interface *oi = NULL;
|
||||
|
@ -1212,6 +1216,7 @@ static uint8_t *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length,
|
|||
if (ospf6 == NULL)
|
||||
return NULL;
|
||||
|
||||
vrf = vrf_lookup_by_id(ospf6->vrf_id);
|
||||
/* Get variable length. */
|
||||
offset = name + v->namelen;
|
||||
offsetlen = *length - v->namelen;
|
||||
|
@ -1241,7 +1246,7 @@ static uint8_t *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length,
|
|||
// offsetlen -= len;
|
||||
|
||||
if (exact) {
|
||||
oi = ospf6_interface_lookup_by_ifindex(ifindex);
|
||||
oi = ospf6_interface_lookup_by_ifindex(ifindex, ospf6->vrf_id);
|
||||
if (!oi || oi->instance_id != instid)
|
||||
return NULL;
|
||||
on = ospf6_neighbor_lookup(rtrid, oi);
|
||||
|
@ -1257,7 +1262,8 @@ static uint8_t *ospfv3NbrEntry(struct variable *v, oid *name, size_t *length,
|
|||
for (ALL_LIST_ELEMENTS_RO(ifslist, i, iif)) {
|
||||
if (!iif->ifindex)
|
||||
continue;
|
||||
oi = ospf6_interface_lookup_by_ifindex(iif->ifindex);
|
||||
oi = ospf6_interface_lookup_by_ifindex(iif->ifindex,
|
||||
iif->vrf_id);
|
||||
if (!oi)
|
||||
continue;
|
||||
for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, j, on)) {
|
||||
|
|
|
@ -278,7 +278,7 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v,
|
|||
return;
|
||||
}
|
||||
|
||||
oi = ospf6_interface_lookup_by_ifindex(ifindex);
|
||||
oi = ospf6_interface_lookup_by_ifindex(ifindex, ospf6->vrf_id);
|
||||
if (oi == NULL) {
|
||||
if (IS_OSPF6_DEBUG_SPF(PROCESS))
|
||||
zlog_debug("Can't find interface in SPF: ifindex %d",
|
||||
|
|
|
@ -232,7 +232,7 @@ static void ospf6_disable(struct ospf6 *o)
|
|||
ospf6_area_disable(oa);
|
||||
|
||||
/* XXX: This also changes persistent settings */
|
||||
ospf6_asbr_redistribute_reset();
|
||||
ospf6_asbr_redistribute_reset(o->vrf_id);
|
||||
|
||||
ospf6_lsdb_remove_all(o->lsdb);
|
||||
ospf6_route_remove_all(o->route_table);
|
||||
|
|
|
@ -75,25 +75,25 @@ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
|
|||
}
|
||||
|
||||
/* redistribute function */
|
||||
void ospf6_zebra_redistribute(int type)
|
||||
void ospf6_zebra_redistribute(int type, vrf_id_t vrf_id)
|
||||
{
|
||||
if (vrf_bitmap_check(zclient->redist[AFI_IP6][type], VRF_DEFAULT))
|
||||
if (vrf_bitmap_check(zclient->redist[AFI_IP6][type], vrf_id))
|
||||
return;
|
||||
vrf_bitmap_set(zclient->redist[AFI_IP6][type], VRF_DEFAULT);
|
||||
vrf_bitmap_set(zclient->redist[AFI_IP6][type], vrf_id);
|
||||
|
||||
if (zclient->sock > 0)
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient,
|
||||
AFI_IP6, type, 0, VRF_DEFAULT);
|
||||
AFI_IP6, type, 0, vrf_id);
|
||||
}
|
||||
|
||||
void ospf6_zebra_no_redistribute(int type)
|
||||
void ospf6_zebra_no_redistribute(int type, vrf_id_t vrf_id)
|
||||
{
|
||||
if (!vrf_bitmap_check(zclient->redist[AFI_IP6][type], VRF_DEFAULT))
|
||||
if (!vrf_bitmap_check(zclient->redist[AFI_IP6][type], vrf_id))
|
||||
return;
|
||||
vrf_bitmap_unset(zclient->redist[AFI_IP6][type], VRF_DEFAULT);
|
||||
vrf_bitmap_unset(zclient->redist[AFI_IP6][type], vrf_id);
|
||||
if (zclient->sock > 0)
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient,
|
||||
AFI_IP6, type, 0, VRF_DEFAULT);
|
||||
AFI_IP6, type, 0, vrf_id);
|
||||
}
|
||||
|
||||
static int ospf6_zebra_if_address_update_add(ZAPI_CALLBACK_ARGS)
|
||||
|
@ -279,7 +279,7 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request)
|
|||
dest = &request->prefix;
|
||||
|
||||
memset(&api, 0, sizeof(api));
|
||||
api.vrf_id = VRF_DEFAULT;
|
||||
api.vrf_id = ospf6->vrf_id;
|
||||
api.type = ZEBRA_ROUTE_OSPF6;
|
||||
api.safi = SAFI_UNICAST;
|
||||
api.prefix = *dest;
|
||||
|
@ -330,7 +330,7 @@ void ospf6_zebra_add_discard(struct ospf6_route *request)
|
|||
|
||||
if (!CHECK_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED)) {
|
||||
memset(&api, 0, sizeof(api));
|
||||
api.vrf_id = VRF_DEFAULT;
|
||||
api.vrf_id = ospf6->vrf_id;
|
||||
api.type = ZEBRA_ROUTE_OSPF6;
|
||||
api.safi = SAFI_UNICAST;
|
||||
api.prefix = *dest;
|
||||
|
@ -363,7 +363,7 @@ void ospf6_zebra_delete_discard(struct ospf6_route *request)
|
|||
|
||||
if (CHECK_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED)) {
|
||||
memset(&api, 0, sizeof(api));
|
||||
api.vrf_id = VRF_DEFAULT;
|
||||
api.vrf_id = ospf6->vrf_id;
|
||||
api.type = ZEBRA_ROUTE_OSPF6;
|
||||
api.safi = SAFI_UNICAST;
|
||||
api.prefix = *dest;
|
||||
|
|
|
@ -45,10 +45,10 @@ extern struct zclient *zclient;
|
|||
extern void ospf6_zebra_route_update_add(struct ospf6_route *request);
|
||||
extern void ospf6_zebra_route_update_remove(struct ospf6_route *request);
|
||||
|
||||
extern void ospf6_zebra_redistribute(int);
|
||||
extern void ospf6_zebra_no_redistribute(int);
|
||||
#define ospf6_zebra_is_redistribute(type) \
|
||||
vrf_bitmap_check(zclient->redist[AFI_IP6][type], VRF_DEFAULT)
|
||||
extern void ospf6_zebra_redistribute(int, vrf_id_t vrf_id);
|
||||
extern void ospf6_zebra_no_redistribute(int, vrf_id_t vrf_id);
|
||||
#define ospf6_zebra_is_redistribute(type, vrf_id) \
|
||||
vrf_bitmap_check(zclient->redist[AFI_IP6][type], vrf_id)
|
||||
extern void ospf6_zebra_init(struct thread_master *);
|
||||
extern void ospf6_zebra_add_discard(struct ospf6_route *request);
|
||||
extern void ospf6_zebra_delete_discard(struct ospf6_route *request);
|
||||
|
|
Loading…
Reference in a new issue