From owner-freebsd-current@FreeBSD.ORG Thu Jul 14 06:51:28 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8CE8216A41C for ; Thu, 14 Jul 2005 06:51:28 +0000 (GMT) (envelope-from gnn@neville-neil.com) Received: from mrout2.yahoo.com (mrout2.yahoo.com [216.145.54.172]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4DEB643D49 for ; Thu, 14 Jul 2005 06:51:28 +0000 (GMT) (envelope-from gnn@neville-neil.com) Received: from minion.local.neville-neil.com (proxy8.corp.yahoo.com [216.145.48.13]) by mrout2.yahoo.com (8.13.4/8.13.4/y.out) with ESMTP id j6E6nlj7010793 for ; Wed, 13 Jul 2005 23:49:47 -0700 (PDT) Date: Thu, 14 Jul 2005 15:49:46 +0900 Message-ID: From: gnn@freebsd.org To: freebsd-current@freebsd.org References: User-Agent: Wanderlust/2.12.2 (99 Luftballons) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/21.3.50 (powerpc-apple-darwin8.1.0) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Subject: Patch for routing socket bug, please review and test... X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2005 06:51:28 -0000 Hi Folks, This is a proposed fix for: http://www.freebsd.org/cgi/query-pr.cgi?pr=%0D%0A82974 Please review, test and let me know about this patch. I would like to commit it soon. Courtesy of OpenBSD, I have taken their changes and modified them to fit our kernel. 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 @@ -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: _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"