From 3592cdfe091a6541fe5f500b03d14037a8b8b068 Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Sat, 7 Feb 2004 01:28:14 +0000 Subject: the sockaddr holding the netmask and advertised by rtm_addrs might mave sa_len == 0 to indicate a mask of /0 --- usr.sbin/bgpd/kroute.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'usr.sbin/bgpd') diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c index ddc66d9e273..7c352c6a616 100644 --- a/usr.sbin/bgpd/kroute.c +++ b/usr.sbin/bgpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.83 2004/02/07 00:16:14 henning Exp $ */ +/* $OpenBSD: kroute.c,v 1.84 2004/02/07 01:28:13 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -1155,10 +1155,11 @@ dispatch_rtmsg(void) ((struct sockaddr_in *)sa)->sin_addr.s_addr; sa_in = (struct sockaddr_in *) rti_info[RTAX_NETMASK]; - if (sa_in != NULL) - prefixlen = mask2prefixlen( - sa_in->sin_addr.s_addr); - else if (rtm->rtm_flags & RTF_HOST) + if (sa_in != NULL) { + if (sa_in->sin_len != 0) + prefixlen = mask2prefixlen( + sa_in->sin_addr.s_addr); + } else if (rtm->rtm_flags & RTF_HOST) prefixlen = 32; else prefixlen = -- cgit v1.2.3