Fix route address set polluted by appended default element

This commit is contained in:
世界 2026-06-20 19:47:40 +08:00
parent 8caaa93f8d
commit b1c48c12e2
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -161,7 +161,7 @@ func nftablesCreateIPSet(
IntervalEnd: true, IntervalEnd: true,
}) })
} }
if len(prefixList) == 0 && appendDefault { if appendDefault && len(setElements) == 0 {
if family == nftables.TableFamilyIPv4 { if family == nftables.TableFamilyIPv4 {
setElements = append(setElements, nftables.SetElement{ setElements = append(setElements, nftables.SetElement{
Key: netip.IPv4Unspecified().AsSlice(), Key: netip.IPv4Unspecified().AsSlice(),