diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2021-07-27 16:10:23 +0200 | 
|---|---|---|
| committer | Adriano Marto Reis <adrianomarto@gmail.com> | 2023-10-10 07:58:21 +1000 | 
| commit | f5917bae53cee2367d97ae5712a0e18065981252 (patch) | |
| tree | ff68b15b0312560f56c7b48a374d5263585bc585 /ospf6d/ospf6_interface.c | |
| parent | 65e955890c56e0652c702f9f1d7871adbd7f5ebf (diff) | |
ospf6d: option to restrict PtP neighbor list
This adds a knob to refuse forming adjacencies with neighbors not listed
in the config.  Only works on PtP/PtMP of course, otherwise the DR/BDR
machinery gets broken.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_interface.c')
| -rw-r--r-- | ospf6d/ospf6_interface.c | 33 | 
1 files changed, 33 insertions, 0 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index c3b9055724..0fef0c95d4 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -2646,6 +2646,34 @@ DEFUN (no_ipv6_ospf6_network,  	return CMD_SUCCESS;  } +DEFPY (ipv6_ospf6_p2xp_only_cfg_neigh, +       ipv6_ospf6_p2xp_only_cfg_neigh_cmd, +       "[no] ipv6 ospf6 p2p-p2mp config-neighbors-only", +       NO_STR +       IP6_STR +       OSPF6_STR +       "Point-to-point and Point-to-Multipoint parameters\n" +       "Only form adjacencies with explicitly configured neighbors\n") +{ +	VTY_DECLVAR_CONTEXT(interface, ifp); +	struct ospf6_interface *oi = ifp->info; + +	if (no) { +		if (!oi) +			return CMD_SUCCESS; + +		oi->p2xp_only_cfg_neigh = false; +		return CMD_SUCCESS; +	} + +	if (!oi) +		oi = ospf6_interface_create(ifp); + +	oi->p2xp_only_cfg_neigh = true; +	return CMD_SUCCESS; +} + +  static int config_write_ospf6_interface(struct vty *vty, struct vrf *vrf)  {  	struct ospf6_interface *oi; @@ -2714,6 +2742,9 @@ static int config_write_ospf6_interface(struct vty *vty, struct vrf *vrf)  			vty_out(vty,  				" ipv6 ospf6 graceful-restart hello-delay %u\n",  				oi->gr.hello_delay.interval); +		if (oi->p2xp_only_cfg_neigh) +			vty_out(vty, +				" ipv6 ospf6 p2p-p2mp config-neighbors-only\n");  		ospf6_bfd_write_config(vty, oi); @@ -2839,6 +2870,8 @@ void ospf6_interface_init(void)  	install_element(INTERFACE_NODE, &ipv6_ospf6_network_cmd);  	install_element(INTERFACE_NODE, &no_ipv6_ospf6_network_cmd); +	install_element(INTERFACE_NODE, &ipv6_ospf6_p2xp_only_cfg_neigh_cmd); +  	/* reference bandwidth commands */  	install_element(OSPF6_NODE, &auto_cost_reference_bandwidth_cmd);  	install_element(OSPF6_NODE, &no_auto_cost_reference_bandwidth_cmd);  | 
