mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 22:29:23 +00:00
ospfd: OSPFv2 VRF Changes II
Accomodate review comments Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
This commit is contained in:
parent
c0f3f7cdf8
commit
43b8d1d8a1
1
ospfd/.gitignore
vendored
1
ospfd/.gitignore
vendored
@ -15,3 +15,4 @@ TAGS
|
|||||||
*~
|
*~
|
||||||
*.loT
|
*.loT
|
||||||
*.a
|
*.a
|
||||||
|
*.clippy.c
|
||||||
|
@ -51,7 +51,7 @@ static void ospf_route_map_update(const char *name)
|
|||||||
if (listcount(om->ospf) == 0)
|
if (listcount(om->ospf) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO (om->ospf, n1, ospf)) {
|
for (ALL_LIST_ELEMENTS_RO(om->ospf, n1, ospf)) {
|
||||||
/* Update route-map */
|
/* Update route-map */
|
||||||
for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
|
for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
|
||||||
struct list *red_list;
|
struct list *red_list;
|
||||||
|
@ -2570,10 +2570,13 @@ DEFUN (show_ip_ospf_mpls_te_link,
|
|||||||
}
|
}
|
||||||
/* Show All Interfaces. */
|
/* Show All Interfaces. */
|
||||||
if (argc == 5) {
|
if (argc == 5) {
|
||||||
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
|
for (ALL_LIST_ELEMENTS_RO(om->ospf, n1, ospf)) {
|
||||||
for (ALL_LIST_ELEMENTS(vrf_iflist(ospf->vrf_id), node, nnode,
|
if (!ospf->oi_running)
|
||||||
ifp))
|
continue;
|
||||||
show_mpls_te_link_sub(vty, ifp);
|
for (ALL_LIST_ELEMENTS(vrf_iflist(ospf->vrf_id), node,
|
||||||
|
nnode, ifp))
|
||||||
|
show_mpls_te_link_sub(vty, ifp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Interface name is specified. */
|
/* Interface name is specified. */
|
||||||
else {
|
else {
|
||||||
|
959
ospfd/ospf_vty.c
959
ospfd/ospf_vty.c
File diff suppressed because it is too large
Load Diff
@ -107,6 +107,8 @@ static int ospf_interface_add(int command, struct zclient *zclient,
|
|||||||
struct ospf *ospf = NULL;
|
struct ospf *ospf = NULL;
|
||||||
|
|
||||||
ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
|
ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
|
||||||
|
if (ifp == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
@ -123,6 +125,8 @@ static int ospf_interface_add(int command, struct zclient *zclient,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ospf = ospf_lookup_by_vrf_id(vrf_id);
|
ospf = ospf_lookup_by_vrf_id(vrf_id);
|
||||||
|
if (!ospf)
|
||||||
|
return 0;
|
||||||
|
|
||||||
ospf_if_update(ospf, ifp);
|
ospf_if_update(ospf, ifp);
|
||||||
|
|
||||||
@ -282,6 +286,8 @@ static int ospf_interface_address_add(int command, struct zclient *zclient,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ospf = ospf_lookup_by_vrf_id(vrf_id);
|
ospf = ospf_lookup_by_vrf_id(vrf_id);
|
||||||
|
if (!ospf)
|
||||||
|
return 0;
|
||||||
|
|
||||||
ospf_if_update(ospf, c->ifp);
|
ospf_if_update(ospf, c->ifp);
|
||||||
|
|
||||||
@ -1123,8 +1129,8 @@ void ospf_distribute_list_update(struct ospf *ospf, int type,
|
|||||||
{
|
{
|
||||||
struct route_table *rt;
|
struct route_table *rt;
|
||||||
struct ospf_external *ext;
|
struct ospf_external *ext;
|
||||||
|
void **args = XCALLOC(MTYPE_OSPF_DIST_ARGS, sizeof(void *)*2);
|
||||||
|
|
||||||
void **args = XCALLOC(MTYPE_OSPF_DIST_ARGS, sizeof (void * )*2);
|
|
||||||
args[0] = ospf;
|
args[0] = ospf;
|
||||||
args[1] = (void *)((ptrdiff_t) type);
|
args[1] = (void *)((ptrdiff_t) type);
|
||||||
|
|
||||||
@ -1158,7 +1164,7 @@ static void ospf_filter_update(struct access_list *access)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Iterate all ospf [VRF] instances */
|
/* Iterate all ospf [VRF] instances */
|
||||||
for (ALL_LIST_ELEMENTS_RO (om->ospf, n1, ospf)) {
|
for (ALL_LIST_ELEMENTS_RO(om->ospf, n1, ospf)) {
|
||||||
/* Update distribute-list, and apply filter. */
|
/* Update distribute-list, and apply filter. */
|
||||||
for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
|
for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
|
||||||
struct list *red_list;
|
struct list *red_list;
|
||||||
|
@ -447,14 +447,19 @@ struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ospf *ospf_lookup_by_name(const char *name)
|
/* It should only be used when processing incoming info update from zebra.
|
||||||
|
* Other situations, it is not sufficient to lookup the ospf instance by
|
||||||
|
* vrf_name only without using the instance number.
|
||||||
|
*/
|
||||||
|
static struct ospf *ospf_lookup_by_name(const char *vrf_name)
|
||||||
{
|
{
|
||||||
struct ospf *ospf = NULL;
|
struct ospf *ospf = NULL;
|
||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf))
|
for (ALL_LIST_ELEMENTS(om->ospf, node, nnode, ospf))
|
||||||
if ((ospf->name == NULL && name == NULL)
|
if ((ospf->name == NULL && vrf_name == NULL)
|
||||||
|| (ospf->name && name && strcmp(ospf->name, name) == 0))
|
|| (ospf->name && vrf_name &&
|
||||||
|
strcmp(ospf->name, vrf_name) == 0))
|
||||||
return ospf;
|
return ospf;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1283,8 +1288,9 @@ void ospf_ls_upd_queue_empty(struct ospf_interface *oi)
|
|||||||
|
|
||||||
void ospf_if_update(struct ospf *ospf, struct interface *ifp)
|
void ospf_if_update(struct ospf *ospf, struct interface *ifp)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!ospf)
|
if (!ospf)
|
||||||
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
|
return;
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF_EVENT)
|
if (IS_DEBUG_OSPF_EVENT)
|
||||||
zlog_debug("%s: interface %s ifp->vrf_id %u ospf vrf %s vrf_id %u router_id %s",
|
zlog_debug("%s: interface %s ifp->vrf_id %u ospf vrf %s vrf_id %u router_id %s",
|
||||||
|
@ -510,14 +510,9 @@ extern const char *ospf_redist_string(u_int route_type);
|
|||||||
extern struct ospf *ospf_lookup_instance(u_short);
|
extern struct ospf *ospf_lookup_instance(u_short);
|
||||||
extern struct ospf *ospf_get(u_short instance, const char *name);
|
extern struct ospf *ospf_get(u_short instance, const char *name);
|
||||||
extern struct ospf *ospf_get_instance(u_short);
|
extern struct ospf *ospf_get_instance(u_short);
|
||||||
extern struct ospf *ospf_lookup_by_name(const char *name);
|
|
||||||
extern struct ospf *ospf_lookup_by_inst_name(u_short instance,
|
extern struct ospf *ospf_lookup_by_inst_name(u_short instance,
|
||||||
const char *name);
|
const char *name);
|
||||||
extern struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id);
|
extern struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id);
|
||||||
extern struct ospf *ospf_lookup_by_name(const char *name);
|
|
||||||
extern struct ospf *ospf_lookup_by_inst_name(u_short instance,
|
|
||||||
const char *name);
|
|
||||||
extern struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id);
|
|
||||||
extern void ospf_finish(struct ospf *);
|
extern void ospf_finish(struct ospf *);
|
||||||
extern void ospf_router_id_update(struct ospf *ospf);
|
extern void ospf_router_id_update(struct ospf *ospf);
|
||||||
extern int ospf_network_set(struct ospf *, struct prefix_ipv4 *, struct in_addr,
|
extern int ospf_network_set(struct ospf *, struct prefix_ipv4 *, struct in_addr,
|
||||||
|
@ -58,6 +58,9 @@ ospfdheader_HEADERS = \
|
|||||||
# end
|
# end
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ospfd/ospf_vty_clippy.c: $(CLIPPY_DEPS)
|
||||||
|
ospfd/ospf_vty.$(OBJEXT): ospfd/ospf_vty_clippy.c
|
||||||
|
|
||||||
noinst_HEADERS += \
|
noinst_HEADERS += \
|
||||||
ospfd/ospf_abr.h \
|
ospfd/ospf_abr.h \
|
||||||
ospfd/ospf_apiserver.h \
|
ospfd/ospf_apiserver.h \
|
||||||
|
Loading…
Reference in New Issue
Block a user