slackhq/nebula · error
unknown address type %v
Error message
unknown address type %v
What it means
addIp dispatches on the address family of the provided CIDR: Is4 path uses SIOCAIFADDR, Is6 path uses SIOCAIFADDR_IN6. If the address is neither recognized IPv4 nor IPv6 (or the CIDR type is unexpected), the library returns 'unknown address type %v'.
Source
Thrown at overlay/tun_netbsd.go:300
}
req.Lifetime = addrLifetime{
Vltime: 0xffffffff,
Pltime: 0xffffffff,
}
s, err := unix.Socket(unix.AF_INET6, unix.SOCK_DGRAM, unix.IPPROTO_IP)
if err != nil {
return err
}
defer syscall.Close(s)
if err := ioctl(uintptr(s), SIOCAIFADDR_IN6, uintptr(unsafe.Pointer(&req))); err != nil {
return fmt.Errorf("failed to set tun address %s: %s", cidr.Addr().String(), err)
}
return nil
}
return fmt.Errorf("unknown address type %v", cidr)
}
func (t *tun) Activate() error {
mode := int32(unix.IFF_BROADCAST)
err := ioctl(uintptr(t.fd), TUNSIFMODE, uintptr(unsafe.Pointer(&mode)))
if err != nil {
return fmt.Errorf("failed to set tun device mode: %w", err)
}
v := 1
err = ioctl(uintptr(t.fd), TUNSIFHEAD, uintptr(unsafe.Pointer(&v)))
if err != nil {
return fmt.Errorf("failed to set tun device head: %w", err)
}
err = t.doIoctlByName(unix.SIOCSIFMTU, uint32(t.MTU))
if err != nil {
return fmt.Errorf("failed to set tun mtu: %w", err)View on GitHub (pinned to dd8f660c0a)
Solutions
- Check the configured tun address parses to a valid IPv4 or IPv6 CIDR
- Log/inspect the %v value in the error to see what address was actually supplied
- Fix config so the address is explicitly 4 or 6 (e.g. 10.0.0.1/24 or fd00::1/64)
Example fix
// before
"tun": { "dev": "tun0", "addr": "" }
// after
"tun": { "dev": "tun0", "addr": "10.0.0.1/24" } Defensive patterns
Strategy: validation
Validate before calling
if !(cidr.Addr().Is4() || cidr.Addr().Is6()) {
return fmt.Errorf("unsupported tun address family: %v", cidr)
} Prevention
- Parse and validate the configured address at startup
- Reject empty/zero addresses before reaching addIp
- Log the offending value included in the error message
When it happens
Trigger: addIp is called with a CIDR value that is neither 4- nor 6-family per the library's address type (e.g. a zero/unset address, or a mixed/uninitialized value).
Common situations: Config yielding an empty or malformed address that parses as an unknown family; passing a custom/foreign address type into the API.
Related errors
- a device name in the format of /dev/tunN must be specified
- failed to set tun address %s: %s
- newTunFromFd not supported in NetBSD
- error closing tun file: %w
- failed to get syscall conn for tun: %w
AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03).
Data as JSON: /api/errors/17c43f72ea35fbde.
Report an issue: GitHub.