From d93828f4651464775c002d9a102badbb6cd9e695 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 23 Nov 2021 17:11:15 +0300 Subject: [PATCH] [#356] netmap: Fix post-loop handling of zero subnet in IterateSubnets Return any error other than `ErrRemoveSubnet` from `IterateSubnets` during post-loop processing of zero subnet. Signed-off-by: Leonard Lyubich --- netmap/attributes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netmap/attributes.go b/netmap/attributes.go index 8408c25..7bfc002 100644 --- a/netmap/attributes.go +++ b/netmap/attributes.go @@ -202,7 +202,11 @@ func IterateSubnets(node *NodeInfo, f func(refs.SubnetID) error) error { refs.MakeZeroSubnet(&id) err = f(id) - if errors.Is(err, ErrRemoveSubnet) { + if err != nil { + if !errors.Is(err, ErrRemoveSubnet) { + return err + } + // zero subnet should be clearly removed with False value var attr Attribute