Page MenuHomeVyOS Platform

IPV6 local PBR Support
Closed, ResolvedPublicFEATURE REQUEST

Description

Similar to https://phabricator.vyos.net/T439, I'd like to have local PBR support for IPv6 as well.

I'm currently looking into it and might be able to create a PR soon.

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Feature (new functionality)

Related Objects

Mentioned In
1.3.4
Mentioned Here
T439: local PBR support

Event Timeline

hensur created this task.
hensur created this object in space S1 VyOS Public.
hensur added a project: VyOS 1.1.x.
hensur changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
hensur changed Issue type from Unspecified (please specify) to Feature (new functionality).
Viacheslav changed the subtype of this task from "Task" to "Feature Request".
Viacheslav added a subscriber: Viacheslav.

It requires option -6
For example:

sudo ip -6 rule add prio 10 from de:de::1 lookup 5

Show v6 rules:

vyos@r11-roll# sudo ip -6 rule show
0:	from all lookup local
10:	from de:de::1 lookup 5
32766:	from all lookup main
[edit]
vyos@r11-roll#
Viacheslav changed the task status from Open to Needs testing.Jan 20 2022, 2:24 PM

I'm looking into it. From the logs it seems like for src in (pbr[rule_rm][rule]['source'] or ['']) doesn't work if 'source' doesn't exist.

I didn't test the new adjustments locally again... I probably should have done that.

Incorrect behavior with multiple commits
Configuration:

set policy local-route rule 10 set table '101'
set policy local-route rule 10 source '192.0.2.1'
set policy local-route rule 10 source '192.0.2.2'
commit
set policy local-route rule 10 destination '203.0.113.25'
commit

Expected rules:

10:	from 192.0.2.1 to 203.0.113.25 lookup 101
10:	from 192.0.2.2 to 203.0.113.25 lookup 101

Getting rules:

10:	from 192.0.2.2 lookup 101
10:	from 192.0.2.1 to 203.0.113.25 lookup 101
10:	from 192.0.2.2 to 203.0.113.25 lookup 101

I'm looking into it. I'm going to add a test with multiple commits. Good catch, I didn't test this. :)

@Viacheslav Working on it, should be ready soon.

1.3 / equuleus backport reverted.

Smoketests failed big time as non existing CLI options got referenced.

06:37:05  DEBUG - Running Testcase: /usr/libexec/vyos/tests/smoke/cli/test_policy.py
06:37:17  DEBUG - test_access_list (__main__.TestPolicy) ... ok
06:37:24  DEBUG - test_access_list6 (__main__.TestPolicy) ... ok
06:37:32  DEBUG - test_as_path_list (__main__.TestPolicy) ... ok
06:37:37  DEBUG - test_community_list (__main__.TestPolicy) ... ok
06:37:38  DEBUG - test_delete_ipv4_ipv6_table_id (__main__.TestPolicy) ... ERROR
06:37:42  DEBUG - test_destination_ipv6_table_id (__main__.TestPolicy) ... ok
06:37:46  DEBUG - test_destination_table_id (__main__.TestPolicy) ... ok
06:37:54  DEBUG - test_extended_community_list (__main__.TestPolicy) ... ok
06:37:56  DEBUG - test_fwmark_ipv6_table_id (__main__.TestPolicy) ... ok
06:38:00  DEBUG - test_fwmark_sources_destination_ipv6_table_id (__main__.TestPolicy) ... ok
06:38:01  DEBUG - test_fwmark_sources_destination_table_id (__main__.TestPolicy) ... ERROR
06:38:05  DEBUG - test_fwmark_sources_ipv6_table_id (__main__.TestPolicy) ... ok
06:38:05  DEBUG - test_fwmark_sources_table_id (__main__.TestPolicy) ... ERROR
06:38:05  DEBUG - test_fwmark_table_id (__main__.TestPolicy) ... ERROR
06:38:10  DEBUG - test_iif_sources_ipv6_table_id (__main__.TestPolicy) ... ok
06:38:13  DEBUG - test_iif_sources_table_id (__main__.TestPolicy) ... ok
06:38:16  DEBUG - test_ipv6_table_id (__main__.TestPolicy) ... ok
06:38:23  DEBUG - test_large_community_list (__main__.TestPolicy) ... ok
06:38:28  DEBUG - test_multiple_commit_ipv4_table_id (__main__.TestPolicy) ... ok
06:38:35  DEBUG - test_prefix_list (__main__.TestPolicy) ... ok
06:38:41  DEBUG - test_prefix_list6 (__main__.TestPolicy) ... ok
06:38:46  DEBUG - test_table_id (__main__.TestPolicy) ... ok
06:38:46  DEBUG - 
06:38:46  DEBUG - ======================================================================
06:38:46  DEBUG - ERROR: test_delete_ipv4_ipv6_table_id (__main__.TestPolicy)
06:38:46  DEBUG - ----------------------------------------------------------------------
06:38:46  DEBUG - Traceback (most recent call last):
06:38:46  DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/test_policy.py", line 960, in test_delete_ipv4_ipv6_table_id
06:38:46  DEBUG -     self.cli_set(path + ['rule', rule, 'fwmark', fwmk])
06:38:46  DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/base_vyostest_shim.py", line 66, in cli_set
06:38:46  DEBUG -     self._session.set(config)
06:38:46  DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 147, in set
06:38:46  DEBUG -     self.__run_command([SET] + path + value)
06:38:46  DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 136, in __run_command
06:38:46  DEBUG -     raise ConfigSessionError(output)
06:38:46  DEBUG - vyos.configsession.ConfigSessionError: Configuration path: [policy local-route rule 103 fwmark 23] is not valid
06:38:46  DEBUG - 
06:38:46  DEBUG - Set failed
06:38:46  DEBUG - 
06:38:46  DEBUG - 
06:38:46  DEBUG - ======================================================================
06:38:46  DEBUG - ERROR: test_fwmark_sources_destination_table_id (__main__.TestPolicy)
06:38:46  DEBUG - ----------------------------------------------------------------------
06:38:46  DEBUG - Traceback (most recent call last):
06:38:46  DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/test_policy.py", line 792, in test_fwmark_sources_destination_table_id
06:38:46  DEBUG -     self.cli_set(path + ['rule', rule, 'fwmark', fwmk])
06:38:46  DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/base_vyostest_shim.py", line 66, in cli_set
06:38:46  DEBUG -     self._session.set(config)
06:38:46  DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 147, in set
06:38:46  DEBUG -     self.__run_command([SET] + path + value)
06:38:46  DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 136, in __run_command
06:38:46  DEBUG -     raise ConfigSessionError(output)
06:38:46  DEBUG - vyos.configsession.ConfigSessionError: Configuration path: [policy local-route rule 103 fwmark 23] is not valid
06:38:46  DEBUG - 
06:38:46  DEBUG - Set failed
06:38:46  DEBUG - 
06:38:46  DEBUG - 
06:38:46  DEBUG - ======================================================================
06:38:46  DEBUG - ERROR: test_fwmark_sources_table_id (__main__.TestPolicy)
06:38:46  DEBUG - ----------------------------------------------------------------------
06:38:46  DEBUG - Traceback (most recent call last):
06:38:46  DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/test_policy.py", line 740, in test_fwmark_sources_table_id
06:38:46  DEBUG -     self.cli_set(path + ['rule', rule, 'fwmark', fwmk])
06:38:46  DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/base_vyostest_shim.py", line 66, in cli_set
06:38:46  DEBUG -     self._session.set(config)
06:38:46  DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 147, in set
06:38:46  DEBUG -     self.__run_command([SET] + path + value)
06:38:46  DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 136, in __run_command
06:38:46  DEBUG -     raise ConfigSessionError(output)
06:38:46  DEBUG - vyos.configsession.ConfigSessionError: Configuration path: [policy local-route rule 100 fwmark 23] is not valid
06:38:46  DEBUG - 
06:38:46  DEBUG - Set failed
06:38:46  DEBUG - 
06:38:46  DEBUG - 
06:38:46  DEBUG - ======================================================================
06:38:46  DEBUG - ERROR: test_fwmark_table_id (__main__.TestPolicy)
06:38:46  DEBUG - ----------------------------------------------------------------------
06:38:46  DEBUG - Traceback (most recent call last):
06:38:46  DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/test_policy.py", line 698, in test_fwmark_table_id
06:38:46  DEBUG -     self.cli_set(path + ['rule', rule, 'fwmark', fwmk])
06:38:46  DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/base_vyostest_shim.py", line 66, in cli_set
06:38:46  DEBUG -     self._session.set(config)
06:38:46  DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 147, in set
06:38:46  DEBUG -     self.__run_command([SET] + path + value)
06:38:46  DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 136, in __run_command
06:38:46  DEBUG -     raise ConfigSessionError(output)
06:38:46  DEBUG - vyos.configsession.ConfigSessionError: Configuration path: [policy local-route rule 101 fwmark 24] is not valid
06:38:46  DEBUG - 
06:38:46  DEBUG - Set failed
06:38:46  DEBUG -

Implemented, checked in VyOS 1.3-stable-202308240442

vyos@r1# set policy local-route
Possible completions:
 > local-route  IPv4 policy route of local traffic
 > local-route6 IPv6 policy route of local traffic