summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2021-07-27 16:13:08 +0200
committerAdriano Marto Reis <adrianomarto@gmail.com>2023-10-10 08:09:42 +1000
commitdfe3af42d2c8f558432c8bc5cde7041b31821dbf (patch)
tree8deff4398110b8a6ab500f8589130e1320adfb51
parent5c0eed0c85e7dba08df24bd7f0ebc17d9a96a030 (diff)
ospf6d: connected prefix toggle for PtP/PtMP
To announce connected prefixes, or not to announce connected prefixes, that is the question... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--ospf6d/ospf6_interface.c62
-rw-r--r--ospf6d/ospf6_interface.h5
-rw-r--r--ospf6d/subdir.am1
3 files changed, 68 insertions, 0 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index f86e970b1b..865f58d28c 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -470,6 +470,13 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
ospf6_route_add(la_route, oi->route_connected);
}
+ if (oi->state == OSPF6_INTERFACE_POINTTOMULTIPOINT
+ && !oi->p2xp_connected_pfx_include)
+ continue;
+ if (oi->state == OSPF6_INTERFACE_POINTTOPOINT
+ && oi->p2xp_connected_pfx_exclude)
+ continue;
+
struct ospf6_route *route;
route = ospf6_route_create(oi->area->ospf6);
@@ -2716,6 +2723,52 @@ DEFPY (ipv6_ospf6_p2xp_no_multicast_hello,
return CMD_SUCCESS;
}
+DEFPY (ipv6_ospf6_p2xp_connected_pfx,
+ ipv6_ospf6_p2xp_connected_pfx_cmd,
+ "[no] ipv6 ospf6 p2p-p2mp connected-prefixes <include$incl|exclude$excl>",
+ NO_STR
+ IP6_STR
+ OSPF6_STR
+ "Point-to-point and Point-to-Multipoint parameters\n"
+ "Adjust handling of directly connected prefixes\n"
+ "Advertise prefixes and own /128 (default for PtP)\n"
+ "Ignore, only advertise own /128 (default for PtMP)\n")
+{
+ VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct ospf6_interface *oi = ifp->info;
+ bool old_incl, old_excl;
+
+ if (no && !oi)
+ return CMD_SUCCESS;
+
+ if (!oi)
+ oi = ospf6_interface_create(ifp);
+
+ old_incl = oi->p2xp_connected_pfx_include;
+ old_excl = oi->p2xp_connected_pfx_exclude;
+ oi->p2xp_connected_pfx_include = false;
+ oi->p2xp_connected_pfx_exclude = false;
+
+ if (incl && !no)
+ oi->p2xp_connected_pfx_include = true;
+ if (excl && !no)
+ oi->p2xp_connected_pfx_exclude = true;
+
+ if (oi->p2xp_connected_pfx_include != old_incl
+ || oi->p2xp_connected_pfx_exclude != old_excl)
+ ospf6_interface_connected_route_update(ifp);
+ return CMD_SUCCESS;
+}
+
+ALIAS (ipv6_ospf6_p2xp_connected_pfx,
+ no_ipv6_ospf6_p2xp_connected_pfx_cmd,
+ "no ipv6 ospf6 p2p-p2mp connected-prefixes",
+ NO_STR
+ IP6_STR
+ OSPF6_STR
+ "Point-to-point and Point-to-Multipoint parameters\n"
+ "Adjust handling of directly connected prefixes\n")
+
static int config_write_ospf6_interface(struct vty *vty, struct vrf *vrf)
{
@@ -2796,6 +2849,13 @@ static int config_write_ospf6_interface(struct vty *vty, struct vrf *vrf)
vty_out(vty,
" ipv6 ospf6 p2p-p2mp disable-multicast-hello\n");
+ if (oi->p2xp_connected_pfx_include)
+ vty_out(vty,
+ " ipv6 ospf6 p2p-p2mp connected-prefixes include\n");
+ else if (oi->p2xp_connected_pfx_exclude)
+ vty_out(vty,
+ " ipv6 ospf6 p2p-p2mp connected-prefixes exclude\n");
+
config_write_ospf6_p2xp_neighbor(vty, oi);
ospf6_bfd_write_config(vty, oi);
@@ -2924,6 +2984,8 @@ void ospf6_interface_init(void)
install_element(INTERFACE_NODE, &ipv6_ospf6_p2xp_only_cfg_neigh_cmd);
install_element(INTERFACE_NODE,
&ipv6_ospf6_p2xp_no_multicast_hello_cmd);
+ install_element(INTERFACE_NODE, &ipv6_ospf6_p2xp_connected_pfx_cmd);
+ install_element(INTERFACE_NODE, &no_ipv6_ospf6_p2xp_connected_pfx_cmd);
/* reference bandwidth commands */
install_element(OSPF6_NODE, &auto_cost_reference_bandwidth_cmd);
diff --git a/ospf6d/ospf6_interface.h b/ospf6d/ospf6_interface.h
index 6bd54470eb..593659f360 100644
--- a/ospf6d/ospf6_interface.h
+++ b/ospf6d/ospf6_interface.h
@@ -74,6 +74,11 @@ struct ospf6_interface {
bool p2xp_no_multicast_hello;
/* only allow explicitly configured neighbors? */
bool p2xp_only_cfg_neigh;
+ /* override mode default for advertising connected prefixes.
+ * both false by default (= do include for PtP, exclude for PtMP)
+ */
+ bool p2xp_connected_pfx_include;
+ bool p2xp_connected_pfx_exclude;
struct ospf6_if_p2xp_neighcfgs_head p2xp_neighs;
diff --git a/ospf6d/subdir.am b/ospf6d/subdir.am
index 24def6c5b1..5f89af9508 100644
--- a/ospf6d/subdir.am
+++ b/ospf6d/subdir.am
@@ -83,6 +83,7 @@ clippy_scan += \
ospf6d/ospf6_lsa.c \
ospf6d/ospf6_gr_helper.c \
ospf6d/ospf6_gr.c \
+ ospf6d/ospf6_interface.c \
ospf6d/ospf6_nssa.c \
ospf6d/ospf6_route.c \
ospf6d/ospf6_neighbor.c \