Hi, Thank you for the report.
On Mon, Dec 5, 2016 at 11:47 PM, Frank Kardel <kar...@netbsd.org> wrote: > Hi ! > > when trying out a -current from 20161127 (7.99.42) I see issues with routed. > > On configuration of an interface address A.B.C.D/m the local network address > A.B.C.D is correctly entered with a loopback host route for the local > address > in the routing table. > Also the network route via the interface is correctly entered in the table. > > As soon as routed detects the new interface it seems to miss the loopback > host route for the local address and consequently decides to remove the > loopback host route from the kernel routing table, > > route monitor output: > got message of size 160 on Mon Dec 5 15:10:49 2016 > RTM_CHANGE: Change Metrics, Flags or Gateway: len 160, pid 25290, seq 1, > errno 0, flags: <GATEWAY,DONE> > locks: none inits: <hopcount> > sockaddrs: <DST,GATEWAY,NETMASK> > default 10.200.1.1 0.0.0.0 > got message of size 96 on Mon Dec 5 15:10:52 2016 > RTM_ONEWADDR: address being added to iface: len 96, pid 2, seq 0, errno 528, > flags: <CONNECTED> > locks: <sendpipe,mtu> inits: none > got message of size 104 on Mon Dec 5 15:10:52 2016 > RTM_NEWADDR: address being added to iface: len 104, metric 0, flags: > <CONNECTED> > sockaddrs: <NETMASK,IFP,IFA,BRD> > 255.255.255.248 00:1b:21:aa:9b:7c A.B.C.38 default > ### new address (tentative) > got message of size 160 on Mon Dec 5 15:10:52 2016 > RTM_ADD: Add Route: len 160, pid 4878, seq 0, errno 0, flags: > <UP,HOST,LLINFO,LOCAL> > locks: none inits: none > sockaddrs: <DST,GATEWAY> > A.B.C.38 link#2 > ### local address loopback link > got message of size 208 on Mon Dec 5 15:10:52 2016 > RTM_ADD: Add Route: len 208, pid 4878, seq 0, errno 0, flags: > <UP,DONE,CONNECTED> > locks: none inits: none > sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA> > A.B.C.32 link#2 255.255.255.248 00:1b:21:aa:9b:7c A.B.C.38 > ### net route via interface > got message of size 160 on Mon Dec 5 15:10:52 2016 > RTM_DELETE: Delete Route: len 160, pid 25290, seq 2, errno 0, flags: > <HOST,DONE,LLINFO,LOCAL> > locks: none inits: none > sockaddrs: <DST,GATEWAY> > A.B.C.38 link#2 > ### routed deletes local address loopback link > got message of size 88 on Mon Dec 5 15:10:57 2016 > RTM_ONEWADDR: address being added to iface: len 88, pid 2, seq 0, errno 520, > flags: <UP,CONNECTED> > locks: <pksent,rtt,ssthresh,sendpipe,expire,hopcount,mtu> inits: > <sendpipe,mtu> > got message of size 96 on Mon Dec 5 15:10:57 2016 > RTM_NEWADDR: address being added to iface: len 96, metric 0, flags: > <UP,CONNECTED> > sockaddrs: <NETMASK,IFP,IFA,BRD> > 255.255.255.248 00:1b:21:aa:9b:7c A.B.C.38 A.B.C.39 > ### address finally valid > > [BTW: routed/table.c contains an out of date RTM_* number to string table - > fixed in output below] > > Trace from routed: > Tracing actions started > Tracing packets started > Tracing packet contents started > Tracing kernel changes started > Add interface lo0 127.0.0.1 -->127.0.0.1/32 <LOOPBACK> <PASSIVE> > RCVBUF=61440 > Add interface wm1 10.200.1.2 -->10.200.1.0/24 <RIPV2> > turn on RIP > Add 10.200.1.0/24 -->10.200.1.2 metric=0 wm1 <IF> > Add 127.0.0.1/32 -->127.0.0.1 metric=0 lo0 <IF> > ### initial interface state > Send mcast RIPv2 REQUEST to 224.0.0.9.520 via wm1 > QUERY > -- 15:10:46 -- > Recv RIPv2 REQUEST from 10.200.1.2.520 via wm1 > QUERY > discard our own RIP request > -- 15:10:46 -- > Recv RIPv2 RESPONSE from 10.200.1.1.520 via wm1 > 0.0.0.0 metric=9 > 10.0.0.0 metric=1 > 10.0.0.128/32 metric=2 > ... > Add 0.0.0.0 -->10.200.1.1 metric=9 wm1 15:10:46 > Add 10.0.0.0 -->10.200.1.1 metric=1 wm1 15:10:46 > Add 10.0.0.128/32 -->10.200.1.1 metric=2 wm1 15:10:46 > ... > ### received routing information > > -- 15:10:47 -- > Send multicast Router Solic. from 10.200.1.2 to 224.0.0.2 via wm1 value=0 > -- 15:10:48 -- > write kernel RTM_CHANGE 0.0.0.0 -->10.200.1.1 metric=9 > flags=0x2 > -- 15:10:50 -- > Send multicast Router Solic. from 10.200.1.2 to 224.0.0.2 via wm1 value=0 > -- 15:10:50 -- > ignore RTM_ONEWADDR without dst > ### old routing messages are not properly skipped? > > Add interface wm0 A.B.C.38 -->A.B.C.32/29 <PASSIVE> > Add A.B.C.32/29 -->A.B.C.38 metric=0 wm0 <IF> > ### new interface due to ifconfig wm0 A.B.C.D/29 > > note RTM_NEWADDR with flags 0x100 for unknown interface index #180 > ### RTM_NEWADDR not properly handled/skipped > > RTM_ADD from pid 4878: A.B.C.38/32 --> A.B.C.38 > RTM_ADD from pid 4878: A.B.C.32/29 --> A.B.C.38 > -- 15:10:51 -- > write kernel RTM_DELETE A.B.C.38/32 -->A.B.C.38 metric=0 flags=0 > ### routed does not seem to consider the A.B.C.38/32 -->A.B.C.38 (if=lo0, > gw=link#2) as being valid > > -- 15:10:53 -- > Send multicast Router Solic. from 10.200.1.2 to 224.0.0.2 via wm1 value=0 > -- 15:10:53 -- > ignore RTM_ONEWADDR without dst > note RTM_NEWADDR with flags 0x101 for unknown interface index #180 > > netstat -nrf inet shows directly after setting the local address: > Routing tables > > Internet: > Destination Gateway Flags Refs Use Mtu > Interface > default 10.200.1.1 UG - - - wm1 > 10.200.1/24 link#3 UC - - - wm1 > A.B.C.32/29 link#2 UC - - - wm0 > A.B.C.38 link#2 UHl - - - lo0 > 127/8 127.0.0.1 UGRS - - 33624 lo0 > 127.0.0.1 lo0 UHl - - 33624 lo0 > > ##### > > Seems that routed currently misinterprets the kernel routing state and needs > some care. > Any ideas? One solution is to teach routed to ignore local routes as well as static routes. That should be ok, but I'm exploring if there is a solution by fixing the kernel, which should be better in terms of backward compatibility. ozaki-r