{"record":{"id":"11aebd44802ecb73","repo":"AdguardTeam/AdGuardHome","slug":"creating-packet-w","errorCode":null,"errorMessage":"creating packet: %w","messagePattern":"creating packet: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/dhcpd/routeradv.go","lineNumber":251,"sourceCode":"\t}\n\n\tlog.Debug(\"dhcpv6 ra: source IP address: %s  DNS IP address: %s\", ra.ipAddr, ra.dnsIPAddr)\n\n\tparams := icmpv6RA{\n\t\tmanagedAddressConfiguration: !ra.raSLAACOnly,\n\t\totherConfiguration:          !ra.raSLAACOnly,\n\t\tmtu:                         uint32(ra.iface.MTU),\n\t\tprefixLen:                   64,\n\t\trecursiveDNSServer:          ra.dnsIPAddr,\n\t\tsourceLinkLayerAddress:      ra.iface.HardwareAddr,\n\t}\n\tparams.prefix = make([]byte, 16)\n\tcopy(params.prefix, ra.prefixIPAddr[:8]) // /64\n\n\tvar data []byte\n\tdata, err = createICMPv6RAPacket(params)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating packet: %w\", err)\n\t}\n\n\tipAndScope := ra.ipAddr.String() + \"%\" + ra.ifaceName\n\tra.conn, err = icmp.ListenPacket(\"ip6:ipv6-icmp\", ipAndScope)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dhcpv6 ra: icmp.ListenPacket: %w\", err)\n\t}\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = errors.WithDeferred(err, ra.Close())\n\t\t}\n\t}()\n\n\tcon6 := ra.conn.IPv6PacketConn()\n\n\tif err = con6.SetHopLimit(255); err != nil {\n\t\treturn fmt.Errorf(\"dhcpv6 ra: SetHopLimit: %w\", err)","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/dhcpd/routeradv.go#L233-L269","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the wrapped message; if it names the link-layer address, verify the interface's MAC (ip link show)","Switch the DHCPv6/RA configuration to a physical Ethernet/WLAN interface","Disable RA (advertise=false / RA settings off) if the environment can't produce RAs, and let a real router do RA"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"iface, err := net.InterfaceByName(ra.ifaceName)\nif err != nil || !(len(iface.HardwareAddr) == 6 || len(iface.HardwareAddr) == 8) {\n    return fmt.Errorf(\"cannot build RA for %s: no valid link-layer address\", ra.ifaceName)\n}","typeGuard":null,"tryCatchPattern":"if err := ra.Init(...); err != nil {\n    if strings.Contains(err.Error(), \"creating packet\") {\n        // packet assembly (likely MAC) failed: pick a real interface or disable RA\n    }\n}","preventionTips":["Prefer physical interfaces for RA","Skip RA when the environment can't produce it (let a real router advertise)","Unit-test RA init against the same interface list you deploy on"],"tags":["dhcp","ipv6","router-advertisement","configuration","startup"],"backgroundTag":"packet-construction-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}