Bug 252883 - [net][route][loopback] lo1 IP is not added to routing table of cloned interface via rc.d at startup
Summary: [net][route][loopback] lo1 IP is not added to routing table of cloned interfa...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-net (Nobody)
URL: https://reviews.freebsd.org/D28246
Depends on:
Reported: 2021-01-21 13:06 UTC by Dave Cottlehuber
Modified: 2021-01-22 10:02 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Dave Cottlehuber freebsd_committer 2021-01-21 13:06:19 UTC
IP routes for loopback cloned interfaces shouldn't need
to have a static route manually added. Regression is
probably present for several weeks, I think.

# ping
PING ( 56 data bytes

# netstat -4rn

Routing tables

Destination        Gateway            Flags     Netif Expire
default           UGS        igb0          link#3             UHS         lo0      link#1             U          igb0         link#1             UHS         lo0

### the following is missing, then the above now works

# route add

uname 13.0-ALPHA1 main-c256063-g098c902b5202 (~ 2021-01-18)

To reproduce:

default install, add these to /etc/rc.conf, reboot or /etc/netstart. 
Issue is also present with a more typical RFC1918 range, I tested with as well.

# /etc/rc.conf
cloned_interfaces="${cloned_interfaces} lo1"

# ifconfig lo1
lo1: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	inet6 fe80::1%lo1 prefixlen 64 scopeid 0x4
	inet  netmask 0xfffffff0
	inet  netmask 0xffffffff
	inet netmask 0xffffffff
	groups: lo

# route -nv get
RTA_DST: inet; RTA_IFP: link ; RTM_GET: Report Metrics: len 224, pid: 0, seq 1, errno 0, flags:<UP,GATEWAY,HOST,STATIC>
locks:  inits: 
sockaddrs: <DST,IFP> link#0
   route to:
        fib: 0
  interface: igb0
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0 

locks:  inits: 
sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA> igb0:ac.1f.6b.67.e1.38
Comment 1 Herbert J. Skuhra 2021-01-21 13:10:20 UTC
https://reviews.freebsd.org/D28246  ???
Comment 2 Dave Cottlehuber freebsd_committer 2021-01-21 15:39:22 UTC
thanks Herbert, this patch does indeed fix this!
Comment 3 commit-hook freebsd_committer 2021-01-21 21:49:39 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=130aebbab0d38da85f7d32b6d4227f95a2cd9ec7

commit 130aebbab0d38da85f7d32b6d4227f95a2cd9ec7
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2021-01-19 23:50:34 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2021-01-21 21:48:49 +0000

    Further refactor IPv4 interface route creation.

    * Fix bug with /32 aliases introduced in 81728a538d24.
    * Explicitly document business logic for IPv4 ifa routes.
    * Remove remnants of rtinit()
    * Deduplicate ifa->route prefix code by moving it into ia_getrtprefix()
    * Deduplicate conditional check for ifa_maintain_loopback_route()  by
     moving into ia_need_loopback_route()
    * Remove now-unused flags argument from in_addprefix().

    Reviewed by:            donner
    PR:                     252883
    Differential Revision:  https://reviews.freebsd.org/D28246

 sys/netinet/in.c      | 239 +++++++++++++++++++++++++++-----------------------
 sys/netinet/in_var.h  |   2 +-
 sys/netinet/ip_carp.c |   2 +-
 3 files changed, 130 insertions(+), 113 deletions(-)