From bfbd02abfb1d84d14a73f1e247d62e728860d2f3 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 10 Apr 2024 19:56:09 +0400 Subject: [PATCH] fix: assign different priority to IPv6 default gateway on OpenStack Fixes #8558 Similar fix is done for other platforms, but not OpenStack. Signed-off-by: Andrey Smirnov --- .../pkg/runtime/v1alpha1/platform/openstack/openstack.go | 8 +++++++- .../v1alpha1/platform/openstack/testdata/expected.yaml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go b/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go index a9ff3370cd..d4b1d4111b 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/openstack.go @@ -275,6 +275,12 @@ func (o *Openstack) ParseMetadata( return nil, fmt.Errorf("failed to parse gateway ip: %w", err) } + priority := uint32(network.DefaultRouteMetric) + + if family == nethelpers.FamilyInet6 { + priority *= 2 + } + route := network.RouteSpecSpec{ ConfigLayer: network.ConfigPlatform, Gateway: gw, @@ -283,7 +289,7 @@ func (o *Openstack) ParseMetadata( Protocol: nethelpers.ProtocolStatic, Type: nethelpers.TypeUnicast, Family: family, - Priority: network.DefaultRouteMetric, + Priority: priority, } route.Normalize() diff --git a/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/testdata/expected.yaml b/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/testdata/expected.yaml index 0b6a4cb717..01a1adc71f 100644 --- a/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/testdata/expected.yaml +++ b/internal/app/machined/pkg/runtime/v1alpha1/platform/openstack/testdata/expected.yaml @@ -99,7 +99,7 @@ routes: gateway: 2000:0:100:2fff:ff:ff:ff:ff outLinkName: eth0 table: main - priority: 1024 + priority: 2048 scope: global type: unicast flags: ""