Hi Mitchell

On Sat, Mar 30, 2019 at 04:10:09PM +1000, Mitchell Krome wrote:
> I kept finding I had a lingering /30 route when I turned off one of my
> test boxes. I tracked it down to ospfd sending RTM_ADD for a stub
> network with the non-masked prefix. The RTM_ADD path applies the mask
> inside the kernel, so the route got added as expected, but the
> RTM_DELETE enforces an exact match, so it could never remove the route.
> 
> The advertised stub network was as follows:
> 
>         Link connected to: Stub Network
>       Link ID (Network ID): 10.10.20.2
>         Link Data (Network Mask): 255.255.255.252
>       Metric: 10

Please send the details of your setup so it is easy to reproduce the issue.
- OpenBSD version
- ospfd.conf
- interface configs
- routing table

> ospfd sends the interface address rather than network address as the
> link ID. The RFC says "set the Link ID of the Type 3 link to the
> subnet's IP address" which to me means we probably should also apply the
> mask before we add the stub to the LSA to avoid getting into this place
> to start with? 

This only applies to Type 3 LSAs. Below table is from RFC 2328
chapter 12.1.4:

            LS Type   Link State ID
            _______________________________________________
            1         The originating router's Router ID.
            2         The IP interface address of the
                      network's Designated Router.
            3         The destination network's IP address.
            4         The Router ID of the described AS
                      boundary router.
            5         The destination network's IP address.

> 
> The patch below just masks the stub network before it gets added to the
> route table, so that we can properly delete it. I can send a patch to
> mask it before sending the LSA too if the consensus is that is how it
> should be.

With your patch you change the case "LSA_TYPE_ROUTER" (LS Type 1) and not
LS type 3.

Remi

> 
> Mitchell
> 
> diff --git usr.sbin/ospfd/rde_spf.c usr.sbin/ospfd/rde_spf.c
> index 736f2e575..d842a2c20 100644
> --- usr.sbin/ospfd/rde_spf.c
> +++ usr.sbin/ospfd/rde_spf.c
> @@ -195,7 +195,7 @@ rt_calc(struct vertex *v, struct area *area, struct 
> ospfd_conf *conf)
>                       if (rtr_link->type != LINK_TYPE_STUB_NET)
>                               continue;
>  
> -                     addr.s_addr = rtr_link->id;
> +                     addr.s_addr = rtr_link->id & rtr_link->data;
>                       adv_rtr.s_addr = htonl(v->adv_rtr);
>  
>                       rt_update(addr, mask2prefixlen(rtr_link->data),
> 

Reply via email to