Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T5722: Failover route add option onlink (backport #3313) #3319

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 16, 2024

Change Summary

onlink pretend that the nexthop is directly attached to this link, even if it does not match any interface prefix.

Useful when the gateway is not in the same interface network

vyos@r4# sudo ip route add 192.0.2.111/32 via 10.20.30.0 dev eth0.10 metric 1 proto failover
Error: Nexthop has invalid gateway.
[edit]
vyos@r4#
[edit]
vyos@r4# sudo ip route add 192.0.2.111/32 via 10.20.30.0 dev eth0.10 onlink metric 1 proto failover
[edit]
vyos@r4#

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe): New option some kind of bugfix

Related Task(s)

Related PR(s)

Component(s) name

routing, failover route

Proposed changes

How to test

set interfaces ethernet eth0 vif 10 address '10.20.30.1/32'
set protocols static route 10.20.30.0/32 interface eth0.10

set protocols failover route 192.0.2.11/32 next-hop 10.20.30.0 check target '10.20.30.0'
set protocols failover route 192.0.2.11/32 next-hop 10.20.30.0 check timeout '5'
set protocols failover route 192.0.2.11/32 next-hop 10.20.30.0 check type 'icmp'
set protocols failover route 192.0.2.11/32 next-hop 10.20.30.0 interface 'eth0.10'
set protocols failover route 192.0.2.11/32 next-hop 10.20.30.0 metric '1'
commit

Before, this route cannot be added due to gateway and interface not in the same network

Route 192.0.2.11/32 for protocol failover was not found
    [NEW_ROUTE_DETECTED] route: [192.0.2.11/32]
    [ CHECK-TARGET ]: [/usr/bin/ping -q 10.20.30.0 -I eth0.10 -n -c 2 -W 1] -- return-code [RC: 0]
    [ ADD ] -- ip route add 192.0.2.11/32 via 10.20.30.0 dev eth0.10 metric 1 proto failover
Error: Nexthop has invalid gateway. -- return-code [RC: 2] 10.20.30.0 dev eth0.10


vyos@r4# sudo ip route add 192.0.2.11/32 via 10.20.30.0 dev eth0.10 metric 1 proto failover
Error: Nexthop has invalid gateway.
[edit]
vyos@r4# 

The iproute2 option onlink fixes these cases


set protocols failover route 192.0.2.11/32 next-hop 10.20.30.0 onlink
commit

vyos@r4# run show ip route kernel 
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

K>* 192.0.2.11/32 [0/1] via 10.20.30.0, eth0.10 onlink, 00:00:03
[edit]
vyos@r4# 

Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

This is an automatic backport of pull request #3313 done by [Mergify](https://mergify.com).

onlink pretend that the nexthop is directly attached to this link,
even if it does not match any interface prefix.

Useful when gateway not in the same interface network

set interfaces ethernet eth0 vif 10 address '10.20.30.1/32'
set protocols static route 10.20.30.0/32 interface eth0.10
set protocols failover route 192.0.2.11/32 next-hop 10.20.30.0 onlink

```
vyos@r4# sudo ip route add 192.0.2.111/32 via 10.20.30.0 dev eth0.10 metric 1 proto failover
Error: Nexthop has invalid gateway.
[edit]
vyos@r4#
[edit]
vyos@r4# sudo ip route add 192.0.2.111/32 via 10.20.30.0 dev eth0.10 onlink metric 1 proto failover
[edit]
vyos@r4#
```

(cherry picked from commit bb832ac)
@mergify mergify bot mentioned this pull request Apr 16, 2024
12 tasks
@github-actions github-actions bot added the sagitta VyOS 1.4 LTS label Apr 16, 2024
@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, jestabro, sever-sever and c-po and removed request for a team April 16, 2024 15:10
@c-po c-po merged commit 5a48181 into sagitta Apr 16, 2024
5 checks passed
@mergify mergify bot deleted the mergify/bp/sagitta/pr-3313 branch April 16, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sagitta VyOS 1.4 LTS
Development

Successfully merging this pull request may close these issues.

2 participants