Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ospfd: OSPF multi-instance default origination fixes (backport #17436) #17482

Closed
wants to merge 2 commits into from

tests: Add topotest for OSPF multi-instance default origination.

9e79dc0
Select commit
Loading
Failed to load commit list.
Closed

ospfd: OSPF multi-instance default origination fixes (backport #17436) #17482

tests: Add topotest for OSPF multi-instance default origination.
9e79dc0
Select commit
Loading
Failed to load commit list.
frrbot / frrbot completed Nov 21, 2024 in 33s

Style and/or linter errors found

Style and/or linter errors found

Details

Thanks for your contribution to FRR!

Click for style suggestions

diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c
index 087ae6467..acbccf9b4 100644
--- a/ospfd/ospf_asbr.c
+++ b/ospfd/ospf_asbr.c
@@ -174,7 +174,8 @@ void ospf_external_info_delete(struct ospf *ospf, uint8_t type,
  * The preserve_instance parameter may be used to prevent the current instance
  * from being deleted.
  */
-void ospf_external_info_delete_multi_instance(struct ospf *ospf, uint8_t type, struct prefix_ipv4 p,
+void ospf_external_info_delete_multi_instance(struct ospf *ospf, uint8_t type,
+					      struct prefix_ipv4 p,
 					      unsigned long preserve_instance)
 {
 	struct route_node *rn;
@@ -188,7 +189,8 @@ void ospf_external_info_delete_multi_instance(struct ospf *ospf, uint8_t type, s
 
 	for (ALL_LIST_ELEMENTS_RO(ext_list, node, ext)) {
 		if (ext->instance != preserve_instance) {
-			rn = route_node_lookup(EXTERNAL_INFO(ext), (struct prefix *)&p);
+			rn = route_node_lookup(EXTERNAL_INFO(ext),
+					       (struct prefix *)&p);
 			if (rn) {
 				ospf_external_info_free(rn->info);
 				rn->info = NULL;
@@ -249,7 +251,8 @@ struct external_info *ospf_external_info_default_lookup(struct ospf *ospf)
 			route_unlock_node(rn);
 			if (rn->info) {
 				ei = rn->info;
-				if (ei->type != ZEBRA_ROUTE_OSPF || ei->instance != ospf->instance)
+				if (ei->type != ZEBRA_ROUTE_OSPF ||
+				    ei->instance != ospf->instance)
 					return ei;
 			}
 		}
diff --git a/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h
index 8efdcc722..e41194dce 100644
--- a/ospfd/ospf_asbr.h
+++ b/ospfd/ospf_asbr.h
@@ -109,9 +109,10 @@ ospf_external_info_add(struct ospf *, uint8_t, unsigned short,
 		       route_tag_t, uint32_t metric);
 extern void ospf_external_info_delete(struct ospf *, uint8_t, unsigned short,
 				      struct prefix_ipv4);
-extern void ospf_external_info_delete_multi_instance(struct ospf *ospf, uint8_t type,
-						     struct prefix_ipv4 p,
-						     unsigned long preserve_instance);
+extern void
+ospf_external_info_delete_multi_instance(struct ospf *ospf, uint8_t type,
+					 struct prefix_ipv4 p,
+					 unsigned long preserve_instance);
 #define OSPF_DELETE_ANY_INSTANCE 0xffffffff
 extern struct external_info *ospf_external_info_lookup(struct ospf *, uint8_t,
 						       unsigned short,
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index bb584d8db..01122f43b 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -1305,8 +1305,8 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
 	 * originate)ZEBRA_ROUTE_MAX is used to delete the ex-info.
 	 * Resolved this inconsistency by maintaining same route type.
 	 */
-	if ((is_default_prefix(&pgen)) &&
-	    ((api.type != ZEBRA_ROUTE_OSPF) || (api.instance != ospf->instance)))
+	if ((is_default_prefix(&pgen)) && ((api.type != ZEBRA_ROUTE_OSPF) ||
+					   (api.instance != ospf->instance)))
 		rt_type = DEFAULT_ROUTE;
 
 	if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
@@ -1317,9 +1317,12 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
 			zebra_route_string(api.type), vrf_id, &api.prefix,
 			api.metric);
 =======
-		zlog_debug("%s: cmd %s from client %s-%d: vrf %s(%u), p %pFX, metric %d", __func__,
-			   zserv_command_string(cmd), zebra_route_string(api.type), api.instance,
-			   ospf_vrf_id_to_name(vrf_id), vrf_id, &api.prefix, api.metric);
+		zlog_debug(
+			"%s: cmd %s from client %s-%d: vrf %s(%u), p %pFX, metric %d",
+			__func__, zserv_command_string(cmd),
+			zebra_route_string(api.type), api.instance,
+			ospf_vrf_id_to_name(vrf_id), vrf_id, &api.prefix,
+			api.metric);
 >>>>>>> 6afd56da96 (ospfd: OSPF multi-instance default origination fixes)
 
 	if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) {
@@ -1335,16 +1338,19 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS)
 			api.tag = ospf->dtag[rt_type];
 
 		/*
-		 * Given zebra sends an update for a prefix via an ADD message, it
-		 * will be considered as an impilict DELETE for that prefix for other
-		 * types and instances other than the type and instance associated with
-		 * the prefix.
+		 * Given zebra sends an update for a prefix via an ADD message,
+		 * it will be considered as an impilict DELETE for that prefix
+		 * for other types and instances other than the type and
+		 * instance associated with the prefix.
 		 */
 		for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) {
 			unsigned long preserve_instance;
 
-			preserve_instance = (i == rt_type) ? api.instance : OSPF_DELETE_ANY_INSTANCE;
-			ospf_external_info_delete_multi_instance(ospf, i, p, preserve_instance);
+			preserve_instance = (i == rt_type)
+						    ? api.instance
+						    : OSPF_DELETE_ANY_INSTANCE;
+			ospf_external_info_delete_multi_instance(
+				ospf, i, p, preserve_instance);
 		}
 
 		ei = ospf_external_info_add(ospf, rt_type, api.instance, p,
diff --git a/ospfd/ospf_zebra.h b/ospfd/ospf_zebra.h
index b83524303..53b9fc43c 100644
--- a/ospfd/ospf_zebra.h
+++ b/ospfd/ospf_zebra.h
@@ -48,7 +48,8 @@ extern uint8_t ospf_distance_apply(struct ospf *ospf, struct prefix_ipv4 *,
 extern struct ospf_external *ospf_external_lookup(struct ospf *, uint8_t,
 						  unsigned short);
 
-extern struct external_info *ospf_external_info_default_lookup(struct ospf *ospf);
+extern struct external_info *
+ospf_external_info_default_lookup(struct ospf *ospf);
 
 extern struct ospf_external *ospf_external_add(struct ospf *, uint8_t,
 					       unsigned short);

To apply the style suggestions:

curl https://gist.githubusercontent.com/polychaeta/f36fbb34501721ed1b249268645442ec/raw/7e9d304a2d22179c1d462cf32a2c952b30c5e9ad/style.diff | git apply -

If you are a new contributor to FRR, please see our contributing guidelines.

After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.