]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d : Preparing for ospf6d VRF support.
authorKaushik <kaushik@niralnetworks.com>
Tue, 1 Sep 2020 08:31:49 +0000 (01:31 -0700)
committerKaushik <kaushik@niralnetworks.com>
Tue, 1 Sep 2020 10:02:46 +0000 (03:02 -0700)
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>
15 files changed:
ospf6d/ospf6_abr.c
ospf6d/ospf6_asbr.c
ospf6d/ospf6_asbr.h
ospf6d/ospf6_bfd.c
ospf6d/ospf6_interface.c
ospf6d/ospf6_interface.h
ospf6d/ospf6_intra.c
ospf6d/ospf6_main.c
ospf6d/ospf6_message.c
ospf6d/ospf6_route.c
ospf6d/ospf6_snmp.c
ospf6d/ospf6_spf.c
ospf6d/ospf6_top.c
ospf6d/ospf6_zebra.c
ospf6d/ospf6_zebra.h

index b3397904925cf2396aeeb065b25bca658da417bc..6fe3a289cec4fbebbd3d8d8714b43ba6c1f8f5a6 100644 (file)
@@ -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
index 5562529ea82ad679bfb2c9596f6f3ae78eac0d8a..71ca5afcd22d06e395611696e296a6cd624f5f37 100644 (file)
@@ -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);
        }
 }
 
index 9890ef06194a08232d8cfc4566f7b60180e0fe6a..41b1ac70e9ff190501b99eb17bbd7fa0909e9be9 100644 (file)
@@ -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 *);
 
index 916e59baf0388236658f75af5bb8c06b590e648c..1b58cd14f6f71ec246ea38c0d12428516d79a24e 100644 (file)
@@ -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;
index d10329a93b335b7a598e4eae5987f18e8a9a44c6..3985b08620ebbfca792992f9448214d8452861fa 100644 (file)
@@ -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;
index 6cbfe04c441638e7dcac030107bd407f691327a2..dd7f4d1b1ea23d688825cb6bb32ec3f4c589cb17 100644 (file)
@@ -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 *);
 
index ef5d1d058356ba4a5cd37a63200485f21cb5d430..6eda9f750c882a35ce6753a622381771a4188290 100644 (file)
@@ -1569,8 +1569,8 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
                                if (intra_prefix_lsa->ref_adv_router
                                     == oa->ospf6->router_id) {
                                        ifp = if_lookup_prefix(
-                                                       &old_route->prefix,
-                                                       VRF_DEFAULT);
+                                               &old_route->prefix,
+                                               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);
index 8ae5fdcf06541532817500744426e9a5606f0ac2..182faf0038f4eb28af67a94861bba901060861e4 100644 (file)
@@ -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();
 
index f891f548ae8ad3e61b4d0988d97eb7e1181b11c0..4830b38a66614496dcafcda2d238cc6f2dd47cab 100644 (file)
@@ -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))
index 723746c4719f11fa8ce5f0277f2380142afac89c..a443e4c3ba06808b024b942d0e654be0758150a9 100644 (file)
@@ -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");
index 9a1141f631f3b7cdf268d23cefda1ed458eb6135..57cc05529685a53e60d2273c5de61d29dd4287ff 100644 (file)
@@ -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)) {
index e75c132956b0ab9e14a3da909c292f050645b55a..e5eb8d74eb7877a9aed18bbca4c5d0294729795b 100644 (file)
@@ -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",
index 50687a72907c1c6c95d75e48a044e0231a147d13..6f23051dc3e32f85dedc22419d2c3ea27a4f424d 100644 (file)
@@ -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);
index 2773a666a3f0d3bf421bd0f731b4a5f4fabc54c5..62e0e149b86e51c6e21e5c699c88d03379c5ca76 100644 (file)
@@ -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;
index e2f778fa72c4094a03a420c800f541e0183a525c..d23268303aba319c51c8e244f9d2d8196299aeff 100644 (file)
@@ -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);