From owner-freebsd-net@freebsd.org Sat May 28 18:55:30 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7198EB4EFDF for ; Sat, 28 May 2016 18:55:30 +0000 (UTC) (envelope-from kpaasial@gmail.com) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 5504312BD for ; Sat, 28 May 2016 18:55:30 +0000 (UTC) (envelope-from kpaasial@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 543B9B4EFDE; Sat, 28 May 2016 18:55:30 +0000 (UTC) Delivered-To: net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53E66B4EFDC for ; Sat, 28 May 2016 18:55:30 +0000 (UTC) (envelope-from kpaasial@gmail.com) Received: from mail-oi0-x22a.google.com (mail-oi0-x22a.google.com [IPv6:2607:f8b0:4003:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D41712BC for ; Sat, 28 May 2016 18:55:30 +0000 (UTC) (envelope-from kpaasial@gmail.com) Received: by mail-oi0-x22a.google.com with SMTP id w184so212591654oiw.2 for ; Sat, 28 May 2016 11:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=0ZCfshdlvCRLKJQwrAS8DkyyH+HArCk2ke6g0co0c2U=; b=NXBlq05XsNOsTX8LNAP+l2kd1mad2y+0Ctxfzg8CmE2CPk1PSTTL60TjItEbIAubKs y2B9L2TMzHdSue8zAk3BZNP3uVGZCwIU0J7VzO4ulICnXOiCuMgYaaTSEhWdumrZnN0Z 4snt5V2RJvhI9iCMVIf6H7yUGIaXV5p+W/limzmDQ9X163+fUxay/dXbuQ8HF7LC3Rml lP1THTYPYt5XdB3XvRbyxZe0WC4QycSEKrQMjgStXu0mfEXzCY+KIp5N19AyGVLagRVo k3jccsaGooCxaGS5gP/rUvNV2o4b7ygK20zYRFsY58xZkdg0HVKqEtDPBhwEgWGzwv5e bjUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=0ZCfshdlvCRLKJQwrAS8DkyyH+HArCk2ke6g0co0c2U=; b=mhFopB9QlAtko7k5eSYyHjvgJm0Cfm8ML6o5D1Q4bjlMIheRpDmK31hQnuDzXDJZAx a8CHorbBXGP7Riwvz65UKrygVeQ2Pq8PHY8tg68sNXh1blyb+hZFHdRcVSaTSVOhvihD 1OSz9c4q9qMaEFGibqcJPSSmzEEfOAjeQ33MfFDgtlJ/NK7nKtkOawb4Iz0Qv1r9w60A IljgXyVfSO1aKgqtTbZnMKepuyypXIgQPoSHfqwNjfIO1/Xb70XMQt2SOt/KNkbkNsYx xHNTtx5/a+ekozLaCxPBWG5O/VHC7LOrG2VEtwTlkERrPK2JVbMcqRbwknMCsVAoVTZU oBdw== X-Gm-Message-State: ALyK8tLn2q51VJHEz0cJfMr2WnbylU0K6JREmJKvT6PSVZpzRLa+EnzkLKQNzivr9PyYrqxjcdvQqIlP3JaMCg== MIME-Version: 1.0 X-Received: by 10.202.77.216 with SMTP id a207mr1724728oib.46.1464461729272; Sat, 28 May 2016 11:55:29 -0700 (PDT) Received: by 10.157.45.234 with HTTP; Sat, 28 May 2016 11:55:29 -0700 (PDT) In-Reply-To: <20160528154122.C1843@besplex.bde.org> References: <20160528154122.C1843@besplex.bde.org> Date: Sat, 28 May 2016 21:55:29 +0300 Message-ID: Subject: Re: ifconfig creates a bogus(?) route From: Kimmo Paasiala To: Bruce Evans Cc: "net@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.22 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, 28 May 2016 18:55:30 -0000 On Sat, May 28, 2016 at 10:19 AM, Bruce Evans wrote: > Sometime between r191220 and r201220, ifconfig started creating a bogus(?) > static route. The following is under r248255 with > "ifconfig em0 inet 192.168.2.8" (where 192.168.2.8 is for the local host > and I don't bother typing the netmsk) done before bringing up lo0: > > Routing tables > > Internet: > Destination Gateway Flags Refs Use Netif Expire > 192.168.2.0/24 link#1 U 0 0 em0 > 192.168.2.8 link#1 UHS 0 0 lo0 > > The bogus(?) route points to itself (route get shows this more clearly), > and doesn't work. I know little about routiing, but can fix things like > this manually. Simply "route delete" on the bogus(?) route works in this > case. An alias for lo0 also works. > > Netif is lo0 although lo0 is not up yet. Normally lo0 is brought up before > em0. This makes no obvious difference, but then bringing up lo0 again > removes the bogus(?) route. The order em0, lo0, lo0 doesn't remove the > bogus(?) route. > > After the bogus(?) route is removed, netstat -r[n] stops showing any route > except in old versions of FreeBSD it does show it as something like > "192.168.2.8 UHLW 0 em0 " after using it. > (I use many different kernel versions and only a 1 userland version > except for utilities like netstat whose ABI keeps breaking, and > haven't found newer version of netstat and/or flags on it to show > all the details.) Similary for other local machines. > > After the bogus(?) route is removed, route get 192.168.2.8 shows a working > route even before it is used. The main differences are that the > destination changes from 192.168.2.8 (self) to 192.168.2.0 (link) and > the interface changes from em0 to if0. That actually seems more bogus -- > it will have to be translated back to the "bogus(?) route to work. > > How is this supposed to work? freefall seems to have the bogus(?) route, > but it works. Routing utilities seem to be broken on ref11-i386 > (route can't even find localhost). > > Bruce As far as I know there's nothing wrong with those two routes. They are both needed to allow local connections to the address bound on the interface to be sourced from the localhost 127.0.0.1 address and traffic leaving the system via the interface to be sourced from the address bound on the interface. Someone correct me if I'm off with the details. -Kimmo