On Tue, Jul 10, 2018 at 01:56:37PM +0200, Florian Riehm wrote:
> Hi,
> 
> If intra area prefixes move from one router to another router, cloning routes
> may become gateway routes and contrary. The kernel does not allow to change 
> the
> flags RTF_GATEWAY / RTF_CLONING in RTM_CHANGE messages, but ospf6d tries this
> anyway. The result is a broken route.
> Instead of modifying such routes I remove the old route and insert a new one.
> 
> Thanks to Raimund Specht for reporting the problem and testing the fix.
> 
> ok?

Looks about right. OK claudio@
 
> friehm
> 
> Index: kroute.c
> ===================================================================
> RCS file: /home/friehm/repos/openbsd-cvs/cvs/src/usr.sbin/ospf6d/kroute.c,v
> retrieving revision 1.54
> diff -u -p -r1.54 kroute.c
> --- kroute.c  8 Feb 2018 21:37:36 -0000       1.54
> +++ kroute.c  9 Jul 2018 13:53:44 -0000
> @@ -241,9 +241,28 @@ kr_change(struct kroute *kroute, int krc
>       kroute->rtlabel = rtlabel_tag2id(kroute->ext_tag);
>  
>       kr = kroute_find(&kroute->prefix, kroute->prefixlen, RTP_OSPF);
> -     if (kr != NULL && kr->next == NULL && krcount == 1)
> -             /* single path OSPF route */
> -             action = RTM_CHANGE;
> +     if (kr != NULL && kr->next == NULL && krcount == 1) {
> +             /*
> +              * single path OSPF route.
> +              * The kernel does not allow to change a gateway route to a
> +              * cloning route or contrary. In this case remove and add the
> +              * route, otherwise change the existing one.
> +              */
> +             if ((IN6_IS_ADDR_UNSPECIFIED(&kroute->nexthop) &&
> +                 !IN6_IS_ADDR_UNSPECIFIED(&kr->r.nexthop)) ||
> +                 (!IN6_IS_ADDR_UNSPECIFIED(&kroute->nexthop) &&
> +                 IN6_IS_ADDR_UNSPECIFIED(&kr->r.nexthop))) {
> +                     if (kr_delete_fib(kr) == 0)
> +                             kr = NULL;
> +                     else {
> +                             log_warn("kr_change: failed to remove route: "
> +                                 "%s/%d", log_in6addr(&kr->r.prefix),
> +                                 kr->r.prefixlen);
> +                             return (-1);
> +                     }
> +             } else
> +                     action = RTM_CHANGE;
> +     }
>  
>       return (kr_change_fib(kr, kroute, krcount, action));
>  }
> 

-- 
:wq Claudio

Reply via email to