Project

General

Profile

Actions

Bug #10397

closed

Changing default or static route gateway on 2.5.0 does not remove old route

Added by Jim Pingle over 1 year ago. Updated 12 months ago.

Status:
Resolved
Priority:
High
Category:
Gateways
Target version:
Start date:
03/31/2020
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.5.0
Affected Architecture:

Description

2.5.0 has multi-path (RADIX_MPATH) enabled in its kernel (#9544) which allows multiple routes to the same destination to exist in the routing table.

This leads to a problem when changing the default gateway on system_gateways.php. When the user selects a different default gateway, then saves and applies changes, the old default is not removed:

WAN gateway selected as default:

: netstat -rn4 | grep default
default            198.51.100.1       UGS         em0

Default changed to WAN2 gateway, then save/apply:

: netstat -rn4 | grep default
default            198.51.100.1       UGS         em0
default            203.0.113.1        UGS         em2

The second route must be removed by hand (e.g. route delete default 198.51.100.1), or a reboot would also clear it.

Actions #1

Updated by Jim Pingle over 1 year ago

  • Subject changed from Changing default gateway on 2.5.0 does not remove old default to Changing default or static route gateway on 2.5.0 does not remove old route

This also affects static routes. Changing a route gateway does not remove the old route.

Actions #2

Updated by Viktor Gurov over 1 year ago

Jim Pingle wrote:

This also affects static routes. Changing a route gateway does not remove the old route.

It is possible to add parser to route_add_or_change() to delete existing route on change,
but it is better to fix it in FreeBSD

simple example from route(8) is not working:

EXAMPLES
     ...

     Add a static route    to the 172.16.10.0/24 network via the 172.16.1.1 gate-
     way:

       route add -net 172.16.10.0/24 172.16.1.1

     Change the    gateway    of an already established static route in the routing
     table:

       route change    -net 172.16.10.0/24 172.16.1.2

Test:

# route add -net 172.16.10.0/24 172.16.1.1
add net 172.16.10.0: gateway 172.16.1.1
# route change -net 172.16.10.0/24 172.16.1.2
route: route has not been found
change net 172.16.10.0: gateway 172.16.1.2 fib 0: not in table

Actions #3

Updated by Luiz Souza about 1 year ago

This is correct and working as intended.

With the multi-path routes, the gateway cannot be changed, but all other options can be changed and for that, you must specify the correct entry which, in a multi-path scenario, includes the specific gateway.

pfSense must be updated/changed to accommodate the necessary steps to remove the old gateway before adding a new route.

Actions #4

Updated by Renato Botelho about 1 year ago

  • Assignee set to Renato Botelho

I'll work on it

Actions #5

Updated by Renato Botelho about 1 year ago

  • Status changed from Confirmed to Feedback

It should be fixed on recent 2.5.0 snapshots

Actions #6

Updated by Alhusein Zawi 12 months ago

when changing the default route , old route is removed .

[2.5.0-DEVELOPMENT][]/root: netstat -rn4 | grep default
default 10.0.2.2 UGS em0
[2.5.0-DEVELOPMENT][]/root: netstat -rn4 | grep default
default 192.168.20.100 UGS em2
[2.5.0-DEVELOPMENT][]/root: netstat -rn4 | grep default
default 10.0.2.2 UGS em0

fixed.

Actions #7

Updated by Alhusein Zawi 12 months ago

  • Status changed from Feedback to Resolved
Actions #8

Updated by → luckman212 12 months ago

Were there any commits to pfSense to fiz this or were all the changes from upstream FreeBSD?

Actions #9

Updated by Renato Botelho 12 months ago

→ luckman212 wrote:

Were there any commits to pfSense to fiz this or were all the changes from upstream FreeBSD?

It was fixed reworking functions related to route table on pfSense. Main commit is this c428cdf436cc9e407e64fd550be96bb0ecad3fb3

Actions #10

Updated by → luckman212 12 months ago

Wow that's a monster commit. Thank you rbgarga!

Actions

Also available in: Atom PDF