mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
fix: Allow address 0.0.0.0/0 or ::/0 for 'from'/'to' in routing rule validation
`from 0.0.0.0/0` means from all IPv4 addresses, `from ::/0` means from all IPv6 addresses. In NM, if `from` property is not specified in a routing rule, NM still appends `from 0.0.0.0/0` or `from ::/0` to the rule. NM also allows to specify `to 0.0.0.0/0` or `to ::/0` in a routing rule, but the connection profiles will only show the `from` setting for the rule. Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
parent
815b5b0cc5
commit
c7a31e7079
4 changed files with 41 additions and 5 deletions
|
|
@ -1243,7 +1243,9 @@ class NMUtil:
|
|||
routing_rule["dport"][0],
|
||||
routing_rule["dport"][1],
|
||||
)
|
||||
if routing_rule["from"]:
|
||||
# In NM, when user specifies `from 0.0.0.0/0`` or `from ::/0` in a
|
||||
# routing rule, NM treats it as if the `from` setting is not specified.
|
||||
if routing_rule["from"] and routing_rule["from"]["prefix"]:
|
||||
NM.IPRoutingRule.set_from(
|
||||
nm_routing_rule,
|
||||
routing_rule["from"]["address"],
|
||||
|
|
@ -1274,7 +1276,9 @@ class NMUtil:
|
|||
)
|
||||
if routing_rule["table"]:
|
||||
NM.IPRoutingRule.set_table(nm_routing_rule, routing_rule["table"])
|
||||
if routing_rule["to"]:
|
||||
# In NM, when user specifies `to 0.0.0.0/0`` or `to ::/0` in a
|
||||
# routing rule, NM treats it as if the `to` setting is not specified.
|
||||
if routing_rule["to"] and routing_rule["to"]["prefix"]:
|
||||
NM.IPRoutingRule.set_to(
|
||||
nm_routing_rule,
|
||||
routing_rule["to"]["address"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue