Skip to content

feat: add support for address priority#256

Merged
jsimonetti merged 1 commit intojsimonetti:masterfrom
smira:feat/address-priority
Apr 15, 2025
Merged

feat: add support for address priority#256
jsimonetti merged 1 commit intojsimonetti:masterfrom
smira:feat/address-priority

Conversation

@smira
Copy link
Copy Markdown
Contributor

@smira smira commented Apr 14, 2025

This allows to set route priority/metric for prefix routes created automatically when an address is assigned.

E.g. 10.0.0.0/8 with metric 32 would generate a route:

10.0.0.0/8 via <if> metric 32

The default metric is zero. A custom metric allows to prefer one interface over another when the prefixes overlap.

See siderolabs/talos#10696

This allows to set route priority/metric for prefix routes created
automatically when an address is assigned.

E.g. `10.0.0.0/8` with metric `32` would generate a route:

```
10.0.0.0/8 via <if> metric 32
```

The default metric is zero. A custom metric allows to prefer
one interface over another when the prefixes overlap.

See siderolabs/talos#10696

Signed-off-by: Andrey Smirnov <[email protected]>
@smira
Copy link
Copy Markdown
Contributor Author

smira commented Apr 14, 2025

The failures don't seem to be related to my changes:

  1. go.mod should be updated to go 1.23, as it pulls in x/sys which requires 1.23 (I omitted this change from my PR)
  2. golangci-lint seems to be a workflow configuration issue?

@jsimonetti
Copy link
Copy Markdown
Owner

Thank you for this.
The CI issues are indeed not because of this change. They can be ignored.

@jsimonetti jsimonetti merged commit cff2178 into jsimonetti:master Apr 15, 2025
5 of 8 checks passed
smira added a commit to smira/talos that referenced this pull request Apr 15, 2025
See jsimonetti/rtnetlink#256

See siderolabs#10696

Support setting address priority, this is important to ensure that the
prefix route has appropriate priority.

For now, we don't have it exposed in the machine config except for the
DHCP4 operator, so now both routes created explicitly by DHCP and routes
created implicitly have same metric/priority:

```
172.20.0.2   network     RouteStatus   inet4//172.20.0.0/24/1024                                1         172.20.0.0/24                                enp0s2      1024
172.20.0.2   network     RouteStatus   inet4/172.20.0.1//1024                                   1                                         172.20.0.1   enp0s2      1024
```

Before this change, the first route would have a metric zero.

Signed-off-by: Andrey Smirnov <[email protected]>
smira added a commit to smira/talos that referenced this pull request Apr 16, 2025
See jsimonetti/rtnetlink#256

See siderolabs#10696

Support setting address priority, this is important to ensure that the
prefix route has appropriate priority.

For now, we don't have it exposed in the machine config except for the
DHCP4 operator, so now both routes created explicitly by DHCP and routes
created implicitly have same metric/priority:

```
172.20.0.2   network     RouteStatus   inet4//172.20.0.0/24/1024                                1         172.20.0.0/24                                enp0s2      1024
172.20.0.2   network     RouteStatus   inet4/172.20.0.1//1024                                   1                                         172.20.0.1   enp0s2      1024
```

Before this change, the first route would have a metric zero.

Signed-off-by: Andrey Smirnov <[email protected]>
smira added a commit to smira/talos that referenced this pull request Apr 22, 2025
See jsimonetti/rtnetlink#256

See siderolabs#10696

Support setting address priority, this is important to ensure that the
prefix route has appropriate priority.

For now, we don't have it exposed in the machine config except for the
DHCP4 operator, so now both routes created explicitly by DHCP and routes
created implicitly have same metric/priority:

```
172.20.0.2   network     RouteStatus   inet4//172.20.0.0/24/1024                                1         172.20.0.0/24                                enp0s2      1024
172.20.0.2   network     RouteStatus   inet4/172.20.0.1//1024                                   1                                         172.20.0.1   enp0s2      1024
```

Before this change, the first route would have a metric zero.

Signed-off-by: Andrey Smirnov <[email protected]>
(cherry picked from commit f0ea478)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants