On 03/03/14 00:33, Florian Riehm wrote:
> Hi all,
> 
> ospfd can't export the default gateway via route label because
> get_rtaddrs gets confused by a netmask (RTAX_NETMASK) of 0 because
> sa->sa_len in get_rtaddrs is 0 and ROUNDUP then returns 0 also.
> 
> The bug has been fixed in ospf6d in the same way a couple of years ago.
> Ospf6d uses the ROUNDUP macro from route/show.c now.
> I think ospfd should do the same.
> 
> Regards,
> 
> Florian

Diff is long-term production tested by many customers now.
ok?

Thanks & Regards

friehm


Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/kroute.c,v
retrieving revision 1.107
diff -u -p -r1.107 kroute.c
--- kroute.c    27 Dec 2016 09:15:16 -0000      1.107
+++ kroute.c    21 Jul 2017 13:37:42 -0000
@@ -983,8 +983,8 @@ prefixlen2mask(u_int8_t prefixlen)
        return (htonl(0xffffffff << (32 - prefixlen)));
 }
 
-#define        ROUNDUP(a)      \
-    (((a) & (sizeof(long) - 1)) ? (1 + ((a) | (sizeof(long) - 1))) : (a))
+#define ROUNDUP(a) \
+       ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
 
 void
 get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info) 

Reply via email to