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


Index: usr.sbin/ospfd/kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/kroute.c,v
retrieving revision 1.93
diff -u -p -r1.93 kroute.c
--- usr.sbin/ospfd/kroute.c     30 Oct 2013 17:24:35 -0000      1.93
+++ usr.sbin/ospfd/kroute.c     2 Mar 2014 23:18:47 -0000
@@ -987,8 +987,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