Bug 255227 - route(8) ignoring ifp parameter after upgrade from 12.2-RELEASE to 13.0-RELEASE
Summary: route(8) ignoring ifp parameter after upgrade from 12.2-RELEASE to 13.0-RELEASE
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Alexander V. Chernikov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-19 15:39 UTC by net
Modified: 2021-04-22 20:12 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description net 2021-04-19 15:39:32 UTC
Hi,

maybe first how to re-produce things. A 12.2-RELEASE system running Strongswan and using gif interfaces for route-based VPN's between several systems.
In rc.conf:

cloned_interfaces="gif0"
ifconfig_gif0="inet 10.0.1.1 10.0.1.2 netmask 255.255.255.255 inet6 tunnel 2a01:...  2a02:..."

Then using Strongswan or ipsec-tools to create (successfully) an ipsec tunnel from 2a01:... to 2a02:...

In 12.2-RELEASE and earlier, it was possible setting additional routes via:

route add -net 172.16.0.0/24 10.0.1.2 -ifp gif0

To reach hosts in 172.16.0.0/24 without any problem. netstat -rn reported:

172.16.0/24    10.0.1.2         UGS         gif0

Creating the same route in 13.0-RELEASE, the route command seems to ignore the ifp parameter and instead creates:

172.16.0/24    10.0.1.2         UGS         lo0

Which of course causes problems. Doing a

ping -S 10.0.1.1 172.16.0.1

works.
Comment 1 Alexander V. Chernikov freebsd_committer 2021-04-22 08:29:53 UTC
Hi!

Do I understand correctly that creating p2p gif0 interface & trying to use the remote end as a gateway should trigger the problem?

I'm trying the following with 13-S (don't have 13-R handy, will test later today):

8:25 [0] m@devel0 s ifconfig gif0
gif0: flags=8011<UP,POINTOPOINT,MULTICAST> metric 0 mtu 1280
	options=80000<LINKSTATE>
	inet 10.0.1.1 --> 10.0.1.2 netmask 0xffffffff
	groups: gif
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
8:25 [0] m@devel0 netstat -4rnW | grep 10.0.1
10.0.1.1           link#4             UHS       152  16384        lo0
10.0.1.2           link#4             UH        149   1280       gif0
8:25 [0] m@devel0 s route add -net 172.16.0.0/24 10.0.1.2
add net 172.16.0.0: gateway 10.0.1.2 fib 0
8:25 [0] m@devel0 netstat -4rnW | grep 172.16.0.0
172.16.0.0/24      10.0.1.2           UGS       153   1280       gif0
8:25 [0] m@devel0 s route delete 172.16.0.0/24
delete net 172.16.0.0 fib 0
8:25 [0] m@devel0 s route add -net 172.16.0.0/24 10.0.1.2 -ifp gif0
add net 172.16.0.0: gateway 10.0.1.2 fib 0
8:25 [0] m@devel0 netstat -4rnW | grep 172.16.0.0
172.16.0.0/24      10.0.1.2           UGS       153   1280       gif0


Meanwhile, could you consider sharing `netstat -4rnW` output (at least for 10.0 routes) after gif0 creation?

Also: could you please clarify the reason of adding `-ifp gif0`?
Comment 2 Alexander V. Chernikov freebsd_committer 2021-04-22 20:12:14 UTC
(In reply to Alexander V. Chernikov from comment #1)
Tried with 13.0-R, the behaviour looks the same as in 13-S.

Could you by any chance clarify your setup a bit more?
The `netstat -4rnW` output requested above, custom sysctls, any other relevant network-related customisations?