Date: Mon, 11 Jul 2005 22:40:21 +0900 From: gnn@freebsd.org To: freebsd-net@freebsd.org Subject: Patch for routing socket bug, please review and test... Message-ID: <m21x65a2be.wl%gnn@neville-neil.com>
next in thread | raw e-mail | index | archive | help
Hi Folks, Courtesy of OpenBSD, I have taken their changes and modified them to fit our kernel. Please test and let me know about this patch. Thanks, George Index: rtsock.c =================================================================== RCS file: /home/ncvs/src/sys/net/rtsock.c,v retrieving revision 1.123 diff -u -r1.123 rtsock.c --- rtsock.c 9 Jun 2005 12:20:50 -0000 1.123 +++ rtsock.c 11 Jul 2005 13:37:38 -0000 @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 - * $FreeBSD: src/sys/net/rtsock.c,v 1.123 2005/06/09 12:20:50 harti Exp $ + * $FreeBSD$ */ #include <sys/param.h> @@ -434,6 +434,25 @@ RT_LOCK(rt); RT_ADDREF(rt); + /* + * Fix for PR: 82974 + * + * RTM_CHANGE/LOCK need a perfect match, rn_lookup() + * returns a perfect match in case a netmask is + * specified. For host routes only a longest prefix + * match is returned so it is necessary to compare the + * existence of the netmaks. If both have a netmask + * rnh_lookup() did a perfect match and if non of them + * have a netmask both are host routes which is also a + * perfect match. + */ + + if (rtm->rtm_type != RTM_GET && + (!rt_mask(rt) != !info.rti_info[RTAX_NETMASK])) { + RT_UNLOCK(rt); + senderr(ESRCH); + } + switch(rtm->rtm_type) { case RTM_GET:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m21x65a2be.wl%gnn>