From owner-svn-src-user@FreeBSD.ORG Sun Mar 7 12:41:42 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97E721065670; Sun, 7 Mar 2010 12:41:42 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D5928FC1E; Sun, 7 Mar 2010 12:41:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o27Cfge8049849; Sun, 7 Mar 2010 12:41:42 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o27CfgLP049847; Sun, 7 Mar 2010 12:41:42 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201003071241.o27CfgLP049847@svn.freebsd.org> From: Hiroki Sato Date: Sun, 7 Mar 2010 12:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204828 - user/hrs/ipv6/usr.sbin/route6d X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Mar 2010 12:41:42 -0000 Author: hrs Date: Sun Mar 7 12:41:42 2010 New Revision: 204828 URL: http://svn.freebsd.org/changeset/base/204828 Log: - Use RTF_PROTO2 for routes handled by RIPng and ignore the other routes. The route6d depends on RTF_WASCLONED to prevent connected network routes (normally configured automatically when ifconfig assigns an address with a prefix) from being removed. However, that flag is no longer used on 8.0 and later due to lltable rework. The route6d now sees routes with RTF_PROTO2 only. The flag can be changed by the -Q flag. The default is 2. - -Q and -P now allow the value "0". It clears the flag itself. Modified: user/hrs/ipv6/usr.sbin/route6d/route6d.c Modified: user/hrs/ipv6/usr.sbin/route6d/route6d.c ============================================================================== --- user/hrs/ipv6/usr.sbin/route6d/route6d.c Sun Mar 7 12:29:50 2010 (r204827) +++ user/hrs/ipv6/usr.sbin/route6d/route6d.c Sun Mar 7 12:41:42 2010 (r204828) @@ -184,7 +184,7 @@ int aflag = 0; /* age out even the stati int hflag = 0; /* don't split horizon */ int lflag = 0; /* exchange site local routes */ int Pflag = 0; /* don't age out routes with RTF_PROTO[123] */ -int Qflag = 0; /* set RTF_PROTO[123] flag to routes by RIPng */ +int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */ int sflag = 0; /* announce static routes w/ split horizon */ int Sflag = 0; /* announce static routes to every interface */ unsigned long routetag = 0; /* route tag attached on originating case */ @@ -337,10 +337,12 @@ main(argc, argv) case 'P': ep = NULL; proto = strtoul(optarg, &ep, 0); - if (!ep || *ep != '\0' || (proto < 1) || (3 < proto)) { + if (!ep || *ep != '\0' || 3 < proto) { fatal("invalid P flag"); /*NOTREACHED*/ } + if (proto == 0) + Pflag = 0; if (proto == 1) Pflag |= RTF_PROTO1; if (proto == 2) @@ -351,10 +353,12 @@ main(argc, argv) case 'Q': ep = NULL; proto = strtoul(optarg, &ep, 0); - if (!ep || *ep != '\0' || (proto < 1) || (3 < proto)) { + if (!ep || *ep != '\0' || 3 < proto) { fatal("invalid Q flag"); /*NOTREACHED*/ } + if (proto == 0) + Qflag = 0; if (proto == 1) Qflag |= RTF_PROTO1; if (proto == 2) @@ -2747,6 +2751,14 @@ rt_entry(rtm, again) if (rtm->rtm_flags & RTF_CLONED) return; #endif + /* Ignore RTF_PROTO mismached routes */ + /* + * XXX: can we know if it is a connected network route or not? + * RTF_WASCLONED was the flag for that, but we no longer + * use it. Rely on Qflag instead here. + */ + if (Qflag && !(rtm->rtm_flags & Qflag)) + return; /* * do not look at dynamic routes. * netbsd/openbsd cloned routes have UGHD.