AdguardTeam/AdGuardHome · error

creating packet: %w

Error message

creating packet: %w

What it means

Returned by the router-advertisement Init when createICMPv6RAPacket fails while DHCPv6 RA is being initialized (via initRA). It wraps the packet-construction error — most commonly the source link-layer address conversion failure (error 137) — before any socket is opened.

Source

Thrown at internal/dhcpd/routeradv.go:251

	}

	log.Debug("dhcpv6 ra: source IP address: %s  DNS IP address: %s", ra.ipAddr, ra.dnsIPAddr)

	params := icmpv6RA{
		managedAddressConfiguration: !ra.raSLAACOnly,
		otherConfiguration:          !ra.raSLAACOnly,
		mtu:                         uint32(ra.iface.MTU),
		prefixLen:                   64,
		recursiveDNSServer:          ra.dnsIPAddr,
		sourceLinkLayerAddress:      ra.iface.HardwareAddr,
	}
	params.prefix = make([]byte, 16)
	copy(params.prefix, ra.prefixIPAddr[:8]) // /64

	var data []byte
	data, err = createICMPv6RAPacket(params)
	if err != nil {
		return fmt.Errorf("creating packet: %w", err)
	}

	ipAndScope := ra.ipAddr.String() + "%" + ra.ifaceName
	ra.conn, err = icmp.ListenPacket("ip6:ipv6-icmp", ipAndScope)
	if err != nil {
		return fmt.Errorf("dhcpv6 ra: icmp.ListenPacket: %w", err)
	}

	defer func() {
		if err != nil {
			err = errors.WithDeferred(err, ra.Close())
		}
	}()

	con6 := ra.conn.IPv6PacketConn()

	if err = con6.SetHopLimit(255); err != nil {
		return fmt.Errorf("dhcpv6 ra: SetHopLimit: %w", err)

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Check the wrapped message; if it names the link-layer address, verify the interface's MAC (ip link show)
  2. Switch the DHCPv6/RA configuration to a physical Ethernet/WLAN interface
  3. Disable RA (advertise=false / RA settings off) if the environment can't produce RAs, and let a real router do RA
Defensive patterns

Strategy: validation

Validate before calling

iface, err := net.InterfaceByName(ra.ifaceName)
if err != nil || !(len(iface.HardwareAddr) == 6 || len(iface.HardwareAddr) == 8) {
    return fmt.Errorf("cannot build RA for %s: no valid link-layer address", ra.ifaceName)
}

Try / catch

if err := ra.Init(...); err != nil {
    if strings.Contains(err.Error(), "creating packet") {
        // packet assembly (likely MAC) failed: pick a real interface or disable RA
    }
}

Prevention

When it happens

Trigger: Starting DHCPv6 with RA enabled where the selected interface's MAC cannot be encoded into the RA packet, or the assembled NDPIOptions exceed expected sizes.

Common situations: Enabling 'router advertisement' on cloud VMs whose NIC reports unusual link-layer data; containers with veth interfaces; enabling RA on interfaces without proper hardware addresses.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/11aebd44802ecb73. Report an issue: GitHub.