diff --git a/client/internal/routemanager/iptables_linux.go b/client/internal/routemanager/iptables_linux.go index 3e3c16919..c3128d0cd 100644 --- a/client/internal/routemanager/iptables_linux.go +++ b/client/internal/routemanager/iptables_linux.go @@ -395,6 +395,10 @@ func (i *iptablesManager) insertRoutingRule(keyFormat, table, chain, jump string ipVersion = ipv6 } + if iptablesClient == nil { + return fmt.Errorf("unable to insert iptables routing rules. Iptables client is not initialized") + } + ruleKey := genKey(keyFormat, pair.ID) rule := genRuleSpec(jump, ruleKey, pair.source, pair.destination) existingRule, found := i.rules[ipVersion][ruleKey] @@ -459,6 +463,10 @@ func (i *iptablesManager) removeRoutingRule(keyFormat, table, chain string, pair ipVersion = ipv6 } + if iptablesClient == nil { + return fmt.Errorf("unable to remove iptables routing rules. Iptables client is not initialized") + } + ruleKey := genKey(keyFormat, pair.ID) existingRule, found := i.rules[ipVersion][ruleKey] if found {