]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: connected prefix toggle for PtP/PtMP
authorDavid Lamparter <equinox@opensourcerouting.org>
Tue, 27 Jul 2021 14:13:08 +0000 (16:13 +0200)
committerAdriano Marto Reis <adrianomarto@gmail.com>
Mon, 9 Oct 2023 22:09:42 +0000 (08:09 +1000)
To announce connected prefixes, or not to announce connected prefixes,
that is the question...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf6d/ospf6_interface.c
ospf6d/ospf6_interface.h
ospf6d/subdir.am

index f86e970b1b881425c1f4287a59a205f87d699593..865f58d28ca8ebc9358efa9426cbc05ddd437cf7 100644 (file)
@@ -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);
index 6bd54470eb9158138540efe6a2333bab586d4822..593659f3601bbe2e72067629f61505eea2878fe8 100644 (file)
@@ -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;
 
index 24def6c5b1533189a666c1b9a6106dc12ee35c9d..5f89af950890801bac3bd5a6b25ef694894c3937 100644 (file)
@@ -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 \