summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2022-01-18 15:08:38 +0100
committerGitHub <noreply@github.com>2022-01-18 15:08:38 +0100
commit05786ac7744a6077a7f5aff9d2bfe1c92e54e17c (patch)
tree7b25f5cda483135e144e490d3e8ac970b5781d7f /ospf6d
parentMerge pull request #10276 from patrasar/mld_northbound (diff)
parenttests: check if OSPF opaque attributes are installed in the RIB (diff)
downloadfrr-05786ac7744a6077a7f5aff9d2bfe1c92e54e17c.tar.xz
frr-05786ac7744a6077a7f5aff9d2bfe1c92e54e17c.zip
Merge pull request #9644 from opensourcerouting/ospf-opaque-attrs
OSPF opaque route attributes
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_area.h1
-rw-r--r--ospf6d/ospf6_route.h3
-rw-r--r--ospf6d/ospf6_top.c39
-rw-r--r--ospf6d/ospf6_top.h6
-rw-r--r--ospf6d/ospf6_zebra.c37
5 files changed, 80 insertions, 6 deletions
diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h
index 905fbac94..1c8c5dfd3 100644
--- a/ospf6d/ospf6_area.h
+++ b/ospf6d/ospf6_area.h
@@ -124,7 +124,6 @@ struct ospf6_area {
#define OSPF6_NSSA_TRANSLATE_ENABLED 1
};
-#define OSPF6_AREA_DEFAULT 0x00
#define OSPF6_AREA_ENABLE 0x01
#define OSPF6_AREA_ACTIVE 0x02
#define OSPF6_AREA_TRANSIT 0x04 /* TransitCapability */
diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h
index 633b8d77c..bb5827a17 100644
--- a/ospf6d/ospf6_route.h
+++ b/ospf6d/ospf6_route.h
@@ -148,8 +148,7 @@ struct ospf6_path {
#define OSPF6_PATH_TYPE_INTER 2
#define OSPF6_PATH_TYPE_EXTERNAL1 3
#define OSPF6_PATH_TYPE_EXTERNAL2 4
-#define OSPF6_PATH_TYPE_REDISTRIBUTE 5
-#define OSPF6_PATH_TYPE_MAX 6
+#define OSPF6_PATH_TYPE_MAX 5
#define OSPF6_PATH_SUBTYPE_DEFAULT_RT 1
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 54f6c85ce..e2db77d44 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -436,6 +436,7 @@ static struct ospf6 *ospf6_create(const char *name)
o->fd = -1;
o->max_multipath = MULTIPATH_NUM;
+ SET_FLAG(o->config_flags, OSPF6_SEND_EXTRA_DATA_TO_ZEBRA);
o->oi_write_q = list_new();
@@ -885,6 +886,39 @@ DEFUN (no_ospf6_log_adjacency_changes_detail,
return CMD_SUCCESS;
}
+static void ospf6_reinstall_routes(struct ospf6 *ospf6)
+{
+ struct ospf6_route *route;
+
+ for (route = ospf6_route_head(ospf6->route_table); route;
+ route = ospf6_route_next(route))
+ ospf6_zebra_route_update_add(route, ospf6);
+}
+
+DEFPY (ospf6_send_extra_data,
+ ospf6_send_extra_data_cmd,
+ "[no] ospf6 send-extra-data zebra",
+ NO_STR
+ OSPF6_STR
+ "Extra data to Zebra for display/use\n"
+ "To zebra\n")
+{
+ VTY_DECLVAR_CONTEXT(ospf6, ospf6);
+
+ if (no
+ && CHECK_FLAG(ospf6->config_flags,
+ OSPF6_SEND_EXTRA_DATA_TO_ZEBRA)) {
+ UNSET_FLAG(ospf6->config_flags, OSPF6_SEND_EXTRA_DATA_TO_ZEBRA);
+ ospf6_reinstall_routes(ospf6);
+ } else if (!CHECK_FLAG(ospf6->config_flags,
+ OSPF6_SEND_EXTRA_DATA_TO_ZEBRA)) {
+ SET_FLAG(ospf6->config_flags, OSPF6_SEND_EXTRA_DATA_TO_ZEBRA);
+ ospf6_reinstall_routes(ospf6);
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN (ospf6_timers_lsa,
ospf6_timers_lsa_cmd,
"timers lsa min-arrival (0-600000)",
@@ -2202,6 +2236,10 @@ static int config_write_ospf6(struct vty *vty)
vty_out(vty, " ospf6 router-id %pI4\n",
&ospf6->router_id_static);
+ if (!CHECK_FLAG(ospf6->config_flags,
+ OSPF6_SEND_EXTRA_DATA_TO_ZEBRA))
+ vty_out(vty, " no ospf6 send-extra-data zebra\n");
+
/* log-adjacency-changes flag print. */
if (CHECK_FLAG(ospf6->config_flags,
OSPF6_LOG_ADJACENCY_CHANGES)) {
@@ -2287,6 +2325,7 @@ void ospf6_top_init(void)
install_element(OSPF6_NODE, &ospf6_log_adjacency_changes_detail_cmd);
install_element(OSPF6_NODE, &no_ospf6_log_adjacency_changes_cmd);
install_element(OSPF6_NODE, &no_ospf6_log_adjacency_changes_detail_cmd);
+ install_element(OSPF6_NODE, &ospf6_send_extra_data_cmd);
/* LSA timers commands */
install_element(OSPF6_NODE, &ospf6_timers_lsa_cmd);
diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h
index 4cc0923e9..77156f961 100644
--- a/ospf6d/ospf6_top.h
+++ b/ospf6d/ospf6_top.h
@@ -32,9 +32,9 @@ struct ospf6_master {
};
/* ospf6->config_flags */
-enum {
- OSPF6_LOG_ADJACENCY_CHANGES = (1 << 0),
- OSPF6_LOG_ADJACENCY_DETAIL = (1 << 1),
+enum { OSPF6_LOG_ADJACENCY_CHANGES = (1 << 0),
+ OSPF6_LOG_ADJACENCY_DETAIL = (1 << 1),
+ OSPF6_SEND_EXTRA_DATA_TO_ZEBRA = (1 << 2),
};
/* For processing route-map change update in the callback */
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index 5e50a6cc5..b81863351 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -27,6 +27,7 @@
#include "stream.h"
#include "zclient.h"
#include "memory.h"
+#include "route_opaque.h"
#include "lib/bfd.h"
#include "lib_errors.h"
@@ -371,6 +372,38 @@ DEFUN(show_zebra,
return CMD_SUCCESS;
}
+static void ospf6_zebra_append_opaque_attr(struct ospf6_route *request,
+ struct zapi_route *api)
+{
+ struct ospf_zebra_opaque ospf_opaque = {};
+
+ /* OSPF path type */
+ snprintf(ospf_opaque.path_type, sizeof(ospf_opaque.path_type), "%s",
+ OSPF6_PATH_TYPE_NAME(request->path.type));
+
+ switch (request->path.type) {
+ case OSPF6_PATH_TYPE_INTRA:
+ case OSPF6_PATH_TYPE_INTER:
+ /* OSPF area ID */
+ (void)inet_ntop(AF_INET, &request->path.area_id,
+ ospf_opaque.area_id,
+ sizeof(ospf_opaque.area_id));
+ break;
+ case OSPF6_PATH_TYPE_EXTERNAL1:
+ case OSPF6_PATH_TYPE_EXTERNAL2:
+ /* OSPF route tag */
+ snprintf(ospf_opaque.tag, sizeof(ospf_opaque.tag), "%u",
+ request->path.tag);
+ break;
+ default:
+ break;
+ }
+
+ SET_FLAG(api->message, ZAPI_MESSAGE_OPAQUE);
+ api->opaque.length = sizeof(struct ospf_zebra_opaque);
+ memcpy(api->opaque.data, &ospf_opaque, api->opaque.length);
+}
+
#define ADD 0
#define REM 1
static void ospf6_zebra_route_update(int type, struct ospf6_route *request,
@@ -455,6 +488,10 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request,
api.distance = ospf6_distance_apply((struct prefix_ipv6 *)dest, request,
ospf6);
+ if (type == ADD
+ && CHECK_FLAG(ospf6->config_flags, OSPF6_SEND_EXTRA_DATA_TO_ZEBRA))
+ ospf6_zebra_append_opaque_attr(request, &api);
+
if (type == REM)
ret = zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
else