mirror of
https://github.com/siderolabs/talos.git
synced 2026-05-05 20:36:18 +02:00
fix: create correct blackhole routes for IPv4
For IPv4, they should be attached to no interfaces. Discovered while doing some manual testing for the documentation. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com> (cherry picked from commit 0bfdf7f7035fefe804ec4b568709cd6a09195293)
This commit is contained in:
parent
6f84628494
commit
db2c007ee7
@ -351,9 +351,11 @@ func (ctrl *RouteConfigController) processMachineConfig(linkConfigs []cfg.Networ
|
||||
}
|
||||
|
||||
family := nethelpers.FamilyInet4
|
||||
outLinkName := ""
|
||||
|
||||
if destination.Addr().Is6() {
|
||||
family = nethelpers.FamilyInet6
|
||||
outLinkName = "lo"
|
||||
}
|
||||
|
||||
route := network.RouteSpecSpec{
|
||||
@ -362,7 +364,7 @@ func (ctrl *RouteConfigController) processMachineConfig(linkConfigs []cfg.Networ
|
||||
Table: nethelpers.TableMain,
|
||||
Protocol: nethelpers.ProtocolStatic,
|
||||
Type: nethelpers.TypeBlackhole,
|
||||
OutLinkName: "lo",
|
||||
OutLinkName: outLinkName,
|
||||
ConfigLayer: network.ConfigMachineConfiguration,
|
||||
Priority: blackholeRouteConfig.Metric().ValueOr(network.DefaultRouteMetric),
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ func (suite *RouteConfigSuite) TestMachineConfiguration() {
|
||||
asrt.Equal(nethelpers.FamilyInet4, r.TypedSpec().Family)
|
||||
asrt.EqualValues(network.DefaultRouteMetric, r.TypedSpec().Priority)
|
||||
case "configuration/inet4//10.1.3.4/32/300":
|
||||
asrt.Equal("lo", r.TypedSpec().OutLinkName)
|
||||
asrt.Empty(r.TypedSpec().OutLinkName)
|
||||
asrt.Equal(nethelpers.FamilyInet4, r.TypedSpec().Family)
|
||||
asrt.EqualValues(300, r.TypedSpec().Priority)
|
||||
asrt.Equal(nethelpers.TypeBlackhole, r.TypedSpec().Type)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user