From 3c5dddcf8c6b862b342678f23bb2f1503b28792f Mon Sep 17 00:00:00 2001 From: Ashraf Fouda Date: Thu, 26 Feb 2026 14:32:04 +0200 Subject: [PATCH] make sure ips r valid while asking for registration Signed-off-by: Ashraf Fouda --- pkg/registrar/register.go | 7 ++++++- pkg/registrar_light/register.go | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/registrar/register.go b/pkg/registrar/register.go index 5a76770f..b7abcf0c 100644 --- a/pkg/registrar/register.go +++ b/pkg/registrar/register.go @@ -123,7 +123,12 @@ func registerNode( var ips []string for _, ip := range zosIps { ipV := net.IP(ip) - ips = append(ips, ipV.String()) + s := ipV.String() + if net.ParseIP(s) == nil { + log.Warn().Str("ip", s).Msg("skipping invalid IP from zos bridge") + continue + } + ips = append(ips, s) } return ips }(), diff --git a/pkg/registrar_light/register.go b/pkg/registrar_light/register.go index fcc2e2a0..33491ca1 100644 --- a/pkg/registrar_light/register.go +++ b/pkg/registrar_light/register.go @@ -4,6 +4,7 @@ import ( "context" "crypto/ed25519" "fmt" + "net" "time" "github.com/centrifuge/go-substrate-rpc-client/v4/types" @@ -121,8 +122,12 @@ func registerNode( IPs: func() []string { ips := make([]string, 0) for _, ip := range infs.Interfaces["zos"].IPs { - - ips = append(ips, ip.IP.String()) + s := ip.IP.String() + if net.ParseIP(s) == nil { + log.Warn().Str("ip", s).Msg("skipping invalid IP from zos bridge") + continue + } + ips = append(ips, s) } return ips }(),