Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: strange observations on network configuration (ifconfig&routing)



Hi !

Reverting that change (1.24->1.25) and using RTF_LLDATA instead of RTF_LLINFO seems to solve the problem.
Is this correct or am I overlooking something?

Frank

On 12/11/16 11:38, Frank Kardel wrote:
Hi,

thanks for your reply.

As for backward compatibility: An old userland routed works ok with a new kernel.

The log for an added interface for routed for 7.99.16 on a 7.99.42 kernel is:
-- 10:38:43 --
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
...
-- 10:38:45 --
Add interface wm0  A.B.C.38   -->A.B.C.38/29 <PASSIVE>
Chg    A.B.C.32/29 -->A.B.C.38     metric=16 wm0 10:35:43 <>
                                           metric=0  10:38:45 <IF>
note RTM_NEWADDR with flags 0x100 for unknown interface index #0
ignore RTM type 0x16 without dst
### the new version of RTM_NEWADDR (RTM_ONEWADDR now)
ignore ARP RTM_ADD from pid 19889: A.B.C.38/32
### here the old routed still detects and ignores the loopback route
RTM_ADD from pid 19889: A.B.C.32/29 --> A.B.C.38
### correct network route
-- 10:38:56 --
send all routes and inhibit dynamic updates for 2.637 sec

As the 'old' routed still manages the routed for the new kernel should probably follow the previous behavior.

Looking at the routed diffs related to "ignore ARP RTM_ADD from pid 19889: A.B.C.38/32"
I find following commit:
Index: table.c
===================================================================
RCS file: /cvsroot/src/sbin/routed/table.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- table.c     26 Oct 2009 02:53:15 -0000      1.24
+++ table.c     4 Apr 2016 07:37:07 -0000       1.25
@@ -1,4 +1,4 @@
-/* $NetBSD: table.c,v 1.24 2009/10/26 02:53:15 christos Exp $ */ +/* $NetBSD: table.c,v 1.25 2016/04/04 07:37:07 ozaki-r Exp $ */

 /*
  * Copyright (c) 1983, 1988, 1993
@@ -36,7 +36,7 @@
 #include "defs.h"

 #ifdef __NetBSD__
-__RCSID("$NetBSD: table.c,v 1.24 2009/10/26 02:53:15 christos Exp $");
+__RCSID("$NetBSD: table.c,v 1.25 2016/04/04 07:37:07 ozaki-r Exp $");
 #elif defined(__FreeBSD__)
 __RCSID("$FreeBSD$");
 #else
@@ -1106,12 +1106,6 @@
                    || INFO_DST(&info)->sa_family != AF_INET)
                        continue;

- /* ignore ARP table entries on systems with a merged route
-                * and ARP table.
-                */
-               if (rtm->rtm_flags & RTF_LLINFO)
-                       continue;
-
                /* ignore cloned routes
                 */
 #if defined(RTF_CLONED) && defined(__bsdi__)
@@ -1273,11 +1267,6 @@
                        continue;
                }

-               if (m.r.rtm.rtm_flags & RTF_LLINFO) {
-                       trace_act("ignore ARP %s", str);
-                       continue;
-               }
-
 #if defined(RTF_CLONED) && defined(__bsdi__)
                if (m.r.rtm.rtm_flags & RTF_CLONED) {
                        trace_act("ignore cloned %s", str);

Could that be related to the observed behavior (especially the if (rtm->rtm_flags & RTF_LLINFO) continue;)?
The RTF_LLINFO is set when looking at the route monitor trace.

Best regards,
  Frank


On 12/11/16 09:04, Ryota Ozaki wrote:
Hi,

Thank you for the report.

On Mon, Dec 5, 2016 at 11:47 PM, Frank Kardel <kardel%netbsd.org@localhost> 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



Home | Main Index | Thread Index | Old Index