From nobody Thu Jul 18 17:23:53 2024 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WQ05p0zBxz5RmdQ for ; Thu, 18 Jul 2024 17:23:58 +0000 (UTC) (envelope-from sm@codenetworks.net) Received: from relayout05-q01.dominioabsoluto.net (relayout05-q01.dominioabsoluto.net [217.116.26.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4WQ05n4YZvz4h5s; Thu, 18 Jul 2024 17:23:57 +0000 (UTC) (envelope-from sm@codenetworks.net) Authentication-Results: mx1.freebsd.org; none Received: from relayout05-redir.dominioabsoluto.net (relayout05-redir.dominioabsoluto.net [217.116.26.107]) by relayout05.dominioabsoluto.net (Postfix) with ESMTP id 4WQ05k6wCwzMp95; Thu, 18 Jul 2024 19:23:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codenetworks.net; s=domabs; t=1721323434; bh=bHQYRWZ+X94ecM8m0Ox9dpdDv8Sg7EF7F/N+kcPqx9Y=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Fdj6v4STZtOYrcjYKelVE0ClBc0W20Rilp26OWRzyWYqK114EzNTctQ45ANkslw9C gb9+1XCXbeHGdvl7BAFMdYe/Um1wPRpNddWSTUmlfS1vSDq9vxB4SSwyC+bWTTzbg2 bqEf02W7HPshnAnEM+OkmOVh/kkBVBIgd/Y0o53Y= Received: from [192.168.3.20] (unknown [188.241.98.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sm.codenetworks.net) by relayout05-dsp.dominioabsoluto.net (Postfix) with ESMTPSA id 4WQ05k4DFyzMp95; Thu, 18 Jul 2024 19:23:54 +0200 (CEST) Content-Type: multipart/alternative; boundary="------------0K0uDWZTW2U6ylXmGou9U7nS" Message-ID: <48536b16-e7f1-49d3-b0ac-37773ac686bf@codenetworks.net> Date: Thu, 18 Jul 2024 19:23:53 +0200 List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Multiple Fibs and INET6 To: Zhenlei Huang Cc: freebsd-net@freebsd.org References: <70305bf3-cfe4-4cdd-8cb8-c03c1a9c2b8f@codenetworks.net> Content-Language: en-US From: Santiago Martinez In-Reply-To: X-PostalOut-Country: IP: 188.241.98.123 | Country: ES X-PostalOut-Information: AntiSPAM and AntiVIRUS on relayout05 X-PostalOut-MsgID: 4WQ05k4DFyzMp95.A1892 X-PostalOut-SpamCheck: no es spam, clean X-PostalOut-From: sm@codenetworks.net X-PostalOut-Watermark: 1721928234.80647@8zpNz9P8Pe4pW4FHSMf1hQ X-Spam-Status: No X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16371, ipnet:217.116.24.0/21, country:ES] X-Rspamd-Queue-Id: 4WQ05n4YZvz4h5s This is a multi-part message in MIME format. --------------0K0uDWZTW2U6ylXmGou9U7nS Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Indeed, ping does work if I ping the "fe80::1%lo1" on FIB 1, which is correct. My script was getting the address from the routing table output (F1) which is returning "%lo0" instead of the correct loopback number (lo6 in my case) and as a result it was failing. The routing table should return the correct loop-back interface instead of lo0. Not sure how difficult or easy it, i will take a look ( ENOCLUE). Best regards. Santi On 7/18/24 18:15, Zhenlei Huang wrote: > > >> On Jul 19, 2024, at 12:11 AM, Santiago Martinez >> wrote: >> >> Interesting, I'm running 14.1p2. >> >> > > Yes, I'm running exactly the same version with you. >> >> how does your routing table looks for fib1 ? >> >> > > ``` > # netstat -6rnF 1 > Routing tables (fib: 1) > > Internet6: > Destination                       Gateway     Flags     Netif Expire > fe80::%lo1/64                     link#5      U           lo1 > fe80::1%lo0                       link#2      UHS         lo0 > ``` >> >> Santi >> >> >> On 7/18/24 18:09, Zhenlei Huang wrote: >>> >>> >>>> On Jul 13, 2024, at 1:06 AM, Santiago Martinez >>>> wrote: >>>> >>>> Hi Everyone. >>>> >>>> While adding -F ( fib as used in netstat ) to ping and ping6 I have >>>> found something that from my understanding is not correct. >>>> Please can you advise? >>>> >>>> I have the following setup : >>>> >>>> -- two fibs (0 and 1) >>>> -- two  loop-backs (lo0 and lo1). >>>> -- Lo1 has been assigned to fib1 >>>> --net.add_addr_allfibs = 0 >>>> >>>> My interface output looks like this: >>>> >>>> >>>> ifconfig lo0 | grep inet6 >>>>        inet6 ::1 prefixlen 128 >>>>        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 >>>> >>>> ifconfig lo1 | grep inet6 >>>>        inet6 fe80::1%lo1 prefixlen 64 scopeid 0x3 >>>> >>>> If I do a netstat -rn -6  -F0 I get the following which is was i >>>> expected. >>>> >>>> Internet6: >>>> Destination                       Gateway >>>>                       Flags     Netif Expire >>>> ::/96                             link#2                        URS >>>>         lo0 >>>> ::1                               link#2                        UHS >>>>         lo0 >>>> ::ffff:0.0.0.0/96                 link#2                        URS >>>>         lo0 >>>> fe80::%lo0/10                     link#2                        URS >>>>         lo0 >>>> fe80::%lo0/64                     link#2                        U >>>>           lo0 >>>> fe80::1%lo0                       link#2                        UHS >>>>         lo0 >>>> ff02::/16                         link#2                        URS >>>>         lo0 >>>> >>>> Now,  netstat -rn -6  -F1 shows  "fe80::1%lo0" which should not be >>>> there and "fe80::1%lo1" is missing which should be there. >>>> >>>> Internet6: >>>> Destination                       Gateway >>>>                       Flags     Netif Expire >>>> fe80::%lo1/64                     link#3                        U >>>>           lo1 >>>> *fe80::1%lo0                       link#2 >>>>                        UHS         lo0* >>>> >>> That seems wrong from my first glance. IIRC, there's HACK ( I'd >>> prefer this ) for loopback route. For example >>> ``` >>> # sysctl net.fibs=3 >>> net.fibs: 2 -> 3 >>> # ifconfig epair create >>> # epair0a >>> # ifconfig epair0a fib 2 >>> # ifconfig epair0a inet6 -ifdisabled up >>> # netstat -6rnF 2 >>> Routing tables (fib: 2) >>> >>> Internet6: >>> Destination                       Gateway     Flags     Netif Expire >>> fe80::%epair0a/64                 link#5                        U   >>>     epair0a >>> fe80::3b:b3ff:fe8f:9a0a%lo0       link#1                        UHS lo0 >>> ``` >>> >>> The loopback route always refer the first loop interface, aka lo0. >>>> >>>> >>>> What output I was expecting was: >>>> >>>> Internet6: >>>> Destination                       Gateway >>>>                       Flags     Netif Expire >>>> fe80::%lo1/64                     link#3                        U >>>>           lo1 >>>> *fe80::1%lo1                       link#3                        >>>> UHS         lo1* >>>> >>>> >>>> This makes the ping -6 -F0 fe80::1%lo0  to work but ping -6 -F1 >>>> fe80::1%l01 to fail which I wanted to use as test case. >>>> >>> That is interesting. I can ping without failure. >>> >>> ``` >>> # setfib 1 ping6 -c3 fe80::1%lo1 >>> PING(56=40+8+8 bytes) fe80::1%lo1 --> fe80::1%lo1 >>> 16 bytes from fe80::1%lo1, icmp_seq=0 hlim=64 time=0.050 ms >>> 16 bytes from fe80::1%lo1, icmp_seq=1 hlim=64 time=0.067 ms >>> 16 bytes from fe80::1%lo1, icmp_seq=2 hlim=64 time=0.096 ms >>> >>> --- fe80::1%lo1 ping statistics --- >>> 3 packets transmitted, 3 packets received, 0.0% packet loss >>> round-trip min/avg/max/stddev = 0.050/0.071/0.096/0.019 ms >>> ``` >>> >>> Best regards, >>> Zhenlei >>> >>>> >>>> Thanks in advance. >>>> >>>> Santiago >>>> >>>> >>> >>> >>> > > > --------------0K0uDWZTW2U6ylXmGou9U7nS Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Indeed, ping does work if I ping the "fe80::1%lo1" on FIB 1,  which is correct.

My script was getting the address from the routing table output  (F1) which is returning "%lo0" instead of the correct loopback number (lo6 in my case) and as a result it was failing. 

The routing table should return the correct loop-back interface instead of lo0. Not sure how difficult or easy it, i will take a look ( ENOCLUE).

Best regards.

Santi


On 7/18/24 18:15, Zhenlei Huang wrote:


On Jul 19, 2024, at 12:11 AM, Santiago Martinez <sm@codenetworks.net> wrote:

Interesting, I'm running 14.1p2.



Yes, I'm running exactly the same version with you.

how does your routing table looks for fib1 ?



```
# netstat -6rnF 1
Routing tables (fib: 1)

Internet6:
Destination                       Gateway                       Flags     Netif Expire
fe80::%lo1/64                     link#5                        U           lo1
fe80::1%lo0                       link#2                        UHS         lo0
```

Santi


On 7/18/24 18:09, Zhenlei Huang wrote:


On Jul 13, 2024, at 1:06 AM, Santiago Martinez <sm@codenetworks.net> wrote:

Hi Everyone.

While adding -F ( fib as used in netstat ) to ping and ping6 I have found something that from my understanding is not correct.
Please can you advise?

I have the following setup :

-- two fibs (0 and 1) 
-- two  loop-backs (lo0 and lo1).
-- Lo1 has been assigned to fib1
-- net.add_addr_allfibs = 0

My interface output looks like this:


ifconfig lo0 | grep inet6
       inet6 ::1 prefixlen 128
       inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2

ifconfig lo1 | grep inet6
       inet6 fe80::1%lo1 prefixlen 64 scopeid 0x3

If I do a netstat -rn -6  -F0 I get the following which is was i expected.

Internet6:
Destination                       Gateway                       Flags     Netif Expire
::/96                             link#2                        URS         lo0
::1                               link#2                        UHS         lo0
::ffff:0.0.0.0/96                 link#2                        URS         lo0
fe80::%lo0/10                     link#2                        URS         lo0
fe80::%lo0/64                     link#2                        U           lo0
fe80::1%lo0                       link#2                        UHS         lo0
ff02::/16                         link#2                        URS         lo0

Now,  netstat -rn -6  -F1 shows  "fe80::1%lo0" which should not be there and "fe80::1%lo1" is missing which should be there.

Internet6:
Destination                       Gateway                       Flags     Netif Expire
fe80::%lo1/64                     link#3                        U           lo1
fe80::1%lo0                       link#2                        UHS         lo0

That seems wrong from my first glance. IIRC, there's HACK ( I'd prefer this ) for loopback route. For example
```
# sysctl net.fibs=3
net.fibs: 2 -> 3
# ifconfig epair create
epair0a
# ifconfig epair0a fib 2
# ifconfig epair0a inet6 -ifdisabled up
# netstat -6rnF 2
Routing tables (fib: 2)

Internet6:
Destination                       Gateway                       Flags     Netif Expire
fe80::%epair0a/64                 link#5                        U       epair0a
fe80::3b:b3ff:fe8f:9a0a%lo0       link#1                        UHS         lo0
```

The loopback route always refer the first loop interface, aka lo0.  


What output I was expecting was:

Internet6:
Destination                       Gateway                       Flags     Netif Expire
fe80::%lo1/64                     link#3                        U           lo1
fe80::1%lo1                       link#3                        UHS         lo1


This makes the ping -6 -F0 fe80::1%lo0  to work but ping -6 -F1 fe80::1%l01 to fail which I wanted to use as test case.

That is interesting. I can ping without failure.

```
# setfib 1 ping6 -c3 fe80::1%lo1
PING(56=40+8+8 bytes) fe80::1%lo1 --> fe80::1%lo1
16 bytes from fe80::1%lo1, icmp_seq=0 hlim=64 time=0.050 ms
16 bytes from fe80::1%lo1, icmp_seq=1 hlim=64 time=0.067 ms
16 bytes from fe80::1%lo1, icmp_seq=2 hlim=64 time=0.096 ms

--- fe80::1%lo1 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.050/0.071/0.096/0.019 ms
```

Best regards,
Zhenlei


Thanks in advance.

Santiago








--------------0K0uDWZTW2U6ylXmGou9U7nS--