From owner-freebsd-net Tue Jul 3 8:11:48 2001 Delivered-To: freebsd-net@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 92A8637B401 for ; Tue, 3 Jul 2001 08:11:19 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.2/8.11.2) id f63FAWW67715; Tue, 3 Jul 2001 18:10:32 +0300 (EEST) (envelope-from ru) Date: Tue, 3 Jul 2001 18:10:32 +0300 From: Ruslan Ermilov To: Iasen Kostoff Cc: freebsd-net@FreeBSD.ORG Subject: Re: adding a route to host via interface Message-ID: <20010703181032.A65571@sunbay.com> Mail-Followup-To: Iasen Kostoff , freebsd-net@FreeBSD.ORG References: <20010703162556.E39090@sunbay.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Q68bSM7Ycu6FN28Q" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from tbyte@tbyte.org on Tue, Jul 03, 2001 at 04:54:29PM +0300 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 03, 2001 at 04:54:29PM +0300, Iasen Kostoff wrote: > [...] > > You can't change host route to network route, or vise versa; destination > > is the Patricia's tree key, and it can't be changed. The only possible > > way is like I suggested: ``route add foo/32 -iface bar -cloning''. > > Yes I know, but ``route add foo -iface bar -cloning`` is meanless, I > think, because host route could not be cloned and I kernel should auto set > foo to foo/32 because of meanlessness of -host foo. > Could you please try the attached patch? It disallows cloning for host entries. > And is route add -host > foo -iface bar (without -cloning) could be used for something ? > Yes, it is currently used for proxy ARP type 1 entries: # arp -s 192.168.4.200 1:2:3:4:5:6 pub # netstat -rn | grep 192.168.4.200 192.168.4.200/32 1:2:3:4:5:6 ULS2c 0 0 rl0 The purpose of /32 here is to allow the call to rtalloc1() in arplookup() to match this route even if the SIN_PROXY flag (proxy ARP type 2; aka published (proxy only)) is set in the sin_other member of the sockaddr_inarp structure. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: route.c =================================================================== RCS file: /home/ncvs/src/sys/net/route.c,v retrieving revision 1.59.2.2 diff -u -p -r1.59.2.2 route.c --- route.c 2001/05/14 08:23:48 1.59.2.2 +++ route.c 2001/07/03 15:08:41 @@ -476,10 +476,12 @@ rtrequest(req, dst, gateway, netmask, fl senderr(ESRCH); /* * If we are adding a host route then we don't want to put - * a netmask in the tree + * a netmask in the tree, not do we want to clone it. */ - if (flags & RTF_HOST) + if (flags & RTF_HOST) { netmask = 0; + flags &= ~(RTF_CLONING | RTF_PRCLONING); + } switch (req) { case RTM_DELETE: /* --Q68bSM7Ycu6FN28Q-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message