netbirdio/netbird · warning

this function has not been implemented in Netstack for Andro

Error message

this function has not been implemented in Netstack for Android

What it means

TunNetstackDevice.RenewTun is an intentional stub in the android build of netstack mode. In netstack mode traffic is stitched inside gVisor sockets and never traverses an Android VPNService tun fd, so there is nothing to renew and the method always returns this error, as the in-code comment states.

Source

Thrown at client/iface/device/device_netstack_android.go:13

//go:build android

package device

import "fmt"

func (t *TunNetstackDevice) Create(routes []string, dns string, searchDomains []string) (WGConfigurer, error) {
	return t.create()
}

func (t *TunNetstackDevice) RenewTun(fd int) error {
	// Doesn't make sense in Android for Netstack.
	return fmt.Errorf("this function has not been implemented in Netstack for Android")
}

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Gate RenewTun calls so they only run in kernel/userspace modes that own a real tun fd
  2. Treat this error as a benign no-op sentinel in shared code instead of failing the flow
  3. Switch to userspace mode when fd renewal is genuinely required

Example fix

// before
if err := dev.RenewTun(fd); err != nil {
    return err
}

// after
if err := dev.RenewTun(fd); err != nil {
    if runtime.GOOS != "android" {
        return err
    }
    log.Debug("RenewTun is a stub on android netstack; ignoring")
}
Defensive patterns

Strategy: type-guard

Validate before calling

// netstack on android has no tun fd to renew
if runtime.GOOS == "android" && usingNetstack {
    return nil // RenewTun is a documented stub there
}
return dev.RenewTun(fd)

Type guard

type tunFdRenewer interface {
    RenewTun(fd int) error
}

// only kernel/userspace devices implement a meaningful RenewTun;
// feature-detect or branch on mode before calling it

Try / catch

if err := dev.RenewTun(fd); err != nil {
    if runtime.GOOS == "android" {
        log.Debug("RenewTun not implemented on android netstack; skipping")
    } else {
        return err
    }
}

Prevention

When it happens

Trigger: Calling RenewTun(fd) on a TunNetstackDevice compiled with the android build tag (client/iface/device/device_netstack_android.go).

Common situations: Engine code shared across modes that handles VpnService fd re-establishment reaching the netstack branch for the first time; an Android integration upgrade where this path becomes live.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/62924a9529142b71. Report an issue: GitHub.