From owner-freebsd-net@freebsd.org Sat Feb 24 15:15:37 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0A94F2710F for ; Sat, 24 Feb 2018 15:15:37 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A9D8685F4 for ; Sat, 24 Feb 2018 15:15:36 +0000 (UTC) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w1OFFRnb001283; Sat, 24 Feb 2018 07:15:27 -0800 (PST) (envelope-from freebsd-rwg@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd-rwg@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w1OFFRKw001282; Sat, 24 Feb 2018 07:15:27 -0800 (PST) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201802241515.w1OFFRKw001282@pdx.rh.CN85.dnsmgr.net> Subject: Re: loopback routes pinned by commit r326012 for FreeBSD 10 cannot be deleted In-Reply-To: <5A9162C9.5050206@grosbein.net> To: Eugene Grosbein Date: Sat, 24 Feb 2018 07:15:27 -0800 (PST) CC: Andreas Longwitz , freebsd-net@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 15:15:38 -0000 > 24.02.2018 19:37, Andreas Longwitz wrote: > > >> Please test the follwoind patch for the kernel: > >> > >> --- sys/net/if.c.orig 2018-02-24 08:00:34.578670000 +0700 > >> +++ sys/net/if.c 2018-02-24 11:07:57.014318000 +0700 > >> @@ -1699,7 +1699,7 @@ ifa_del_loopback_route(struct ifaddr *if > >> null_sdl.sdl_type = ifa->ifa_ifp->if_type; > >> null_sdl.sdl_index = ifa->ifa_ifp->if_index; > >> bzero(&info, sizeof(info)); > >> - info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC; > >> + info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC | RTF_PINNED; > >> info.rti_info[RTAX_DST] = ia; > >> info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; > >> error = rtrequest1_fib(RTM_DELETE, &info, NULL, ifa->ifa_ifp->if_fib); > >> > > > > This patch patch solves the problem for "ifconfig fxp0 delete": now the > > kernel removes the loopback route, tested on FreeBSD 10 r328260. > > Glad to know that. > > > But deleting the loopback route manually does not work anymore, is this > > intended behaviour ? > > > > I would like to control the routing table as much as possible. > > This is side effect of loopback routes being intentionally protected with RTF_PINNED flag > in recent FreeBSD versions so that link routes can override ones installed by routing daemons. > > Perhaps, ifconfig(8) utility should be extended to use RTF_PINNED to be able to modify such routes. Perhaps it is a rather serious and undesired side effect to have such routes without simple user ability to control them. I am going to write a patch that wraps whis whole loopback_route management in a kernel compile time option, which well leaves things as they are now, but allow a user to remove this non-sensical route policy code from there kernel. It shall also have a sysctl that can turn these routes off so that a GENERIC kernel can be used without this non-sense kernel routing policy. The default of this sysctl shall leave things as they are now. -- Rod Grimes rgrimes@freebsd.org