cilium/cilium · error

invalid IP address: %v

Error message

invalid IP address: %v

What it means

updateIPToEndpointState (standalone-dns-proxy/pkg/client/client.go) converts endpoint IPs received as raw byte slices from the gRPC/proto EndpointInfo into netip.Addr via netip.AddrFromSlice. When the bytes are not a valid 4- or 16-byte IP (empty, wrong length, or corrupted), the insert into the IP-to-endpoint table is aborted with this error.

Source

Thrown at standalone-dns-proxy/pkg/client/client.go:527

	return nil
}

// updateIPToEndpoint updates the IP to endpoint table with the received identity to endpoint mappings.
func (c *GRPCClient) updateIPToEndpoint(mappings []*pb.IdentityToEndpointMapping) error {
	wtxn := c.db.WriteTxn(c.ipToEndpointTable)
	defer wtxn.Abort()

	// Clear existing entries as we are replacing the entire mapping with the given snapshot.
	c.ipToEndpointTable.DeleteAll(wtxn)

	for _, mapping := range mappings {
		for _, epInfo := range mapping.GetEndpointInfo() {
			ips := make([]netip.Addr, 0, len(epInfo.GetIp()))
			for _, ip := range epInfo.GetIp() {
				addr, ok := netip.AddrFromSlice(ip)
				if !ok {
					return fmt.Errorf("invalid IP address: %v", ip)
				}
				ips = append(ips, addr)
			}
			_, _, err := c.ipToEndpointTable.Insert(wtxn, IPtoEndpointInfo{
				IP:       ips,
				ID:       epInfo.GetId(),
				Identity: identity.NumericIdentity(mapping.GetIdentity()),
			})
			if err != nil {
				return err
			}
		}
	}
	wtxn.Commit()

	return nil
}

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Log and skip the malformed mapping instead of aborting the whole update loop for other endpoints
  2. Validate ip length (4 or 16 bytes) at the proto producer side before emitting EndpointInfo
  3. Check the peer component version for proto schema skew and upgrade accordingly
  4. Inspect the registry data source for entries with empty/invalid IP lists

Example fix

// before
addr, ok := netip.AddrFromSlice(ip)
if !ok {
	return fmt.Errorf("invalid IP address: %v", ip)
}
// after
addr, ok := netip.AddrFromSlice(ip)
if !ok {
	log.Warnf("skipping endpoint %d with invalid IP %v", epInfo.GetId(), ip)
	continue
}
Defensive patterns

Strategy: validation

Validate before calling

// validate IP bytes before trusting the mapping
func validIPBytes(b []byte) bool { return len(b) == 4 || len(b) == 16 }

Try / catch

err := c.updateIPToEndpoint(ctx, mappings)
if err != nil && strings.Contains(err.Error(), "invalid IP address") {
	// skip bad payload and resync rather than crash the update loop
	log.Warnf("malformed endpoint IP payload, resyncing: %v", err)
	return c.resync(ctx)
}

Prevention

When it happens

Trigger: A peer/registry sends epInfo.GetIp() bytes that fail netip.AddrFromSlice — e.g. an empty slice for an endpoint with no IPs, a 0-length or odd-length byte string, or a wire-encoding bug producing non-IP bytes.

Common situations: Endpoint synchronization events carrying endpoints without addresses; version skew between the sender and the standalone DNS proxy producing malformed proto payloads; corrupted registry entries.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/b2e938a752ab09a9. Report an issue: GitHub.