From b6b9a3a2ab920ee43452b75a05f17e10ee190b97 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Wed, 9 Sep 2026 22:29:00 +0800 Subject: [PATCH] fix: classic net distribute default route for default nic (#25618) Co-authored-by: Qiu Jian --- pkg/hostman/hostinfo/hostdhcp/dhcpserver.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/hostman/hostinfo/hostdhcp/dhcpserver.go b/pkg/hostman/hostinfo/hostdhcp/dhcpserver.go index 262c685f68..2778caa02b 100644 --- a/pkg/hostman/hostinfo/hostdhcp/dhcpserver.go +++ b/pkg/hostman/hostinfo/hostdhcp/dhcpserver.go @@ -197,7 +197,7 @@ func getGuestConfig( conf.SubnetMask = net.ParseIP(netutils2.Netlen2Mask(int(masklen))) conf.BroadcastAddr = v4Ip.BroadcastAddr(int8(masklen)).ToBytes() - if nicdesc.Gateway != "" { + if nicdesc.Gateway != "" && nicdesc.IsDefault { conf.Gateway = net.ParseIP(nicdesc.Gateway) } } @@ -214,7 +214,7 @@ func getGuestConfig( // ipv6 conf.ClientIP6 = net.ParseIP(nicdesc.Ip6) conf.PrefixLen6 = uint8(nicdesc.Masklen6) - if nicdesc.Gateway6 != "" { + if nicdesc.Gateway6 != "" && nicdesc.IsDefault { conf.Gateway6 = net.ParseIP(nicdesc.Gateway6) } }