{"record":{"id":"7fe6eec526e46584","repo":"AdguardTeam/AdGuardHome","slug":"dhcpv6-ra-sethoplimit-w","errorCode":null,"errorMessage":"dhcpv6 ra: SetHopLimit: %w","messagePattern":"dhcpv6 ra: SetHopLimit: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/dhcpd/routeradv.go","lineNumber":269,"sourceCode":"\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)\n\t}\n\n\tif err = con6.SetMulticastHopLimit(255); err != nil {\n\t\treturn fmt.Errorf(\"dhcpv6 ra: SetMulticastHopLimit: %w\", err)\n\t}\n\n\tmsg := &ipv6.ControlMessage{\n\t\tHopLimit: 255,\n\t\tSrc:      ra.ipAddr,\n\t\tIfIndex:  ra.iface.Index,\n\t}\n\taddr := &net.UDPAddr{\n\t\tIP: net.ParseIP(\"ff02::1\"),\n\t}\n\n\tgo func() {\n\t\tlog.Debug(\"dhcpv6 ra: starting to send periodic RouterAdvertisement packets\")\n\t\tfor ra.stop.Load() == 0 {","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/dhcpd/routeradv.go#L251-L287","documentation":"The DHCPv6 router advertisement (RA) server failed to set the IPv6 hop limit to 255 on its raw packet connection. Routers must send RAs with hop limit 255 per RFC 4861, so the RA initiator aborts if the socket option cannot be applied. It typically indicates the IPv6PacketConn does not support setting hop limits on this platform or socket type.","triggerScenarios":"Calling the RA Init (via initRA) on a system where ipv6.PacketConn.SetHopLimit(255) returns an error — e.g. a non-raw socket, a platform without IPV6_UNICAST_HOPS support, or running in a container/sandbox that restricts socket options.","commonSituations":"Running the DHCPv6/RA service inside Docker or a restricted sandbox; running on a kernel or network stack with limited IPv6 socket option support; using a tunneled/virtual interface that doesn't accept hop-limit socket options.","solutions":["Run the service with CAP_NET_RAW / root privileges or on the host network so raw IPv6 socket options can be set","Verify the interface supports IPv6 (has a link-local address) before enabling router advertisements","Disable the RA/DHCPv6 feature if the environment cannot support raw IPv6 sockets","Check kernel support for IPV6_UNICAST_HOPS on the target platform"],"exampleFix":"// before\n{ ra_enabled: true } // inside unprivileged container\n\n// after\n// run container with: --cap-add=NET_RAW --net=host, or disable RA:\n{ ra_enabled: false }","handlingStrategy":"validation","validationCode":"// before enabling RA, check the interface supports IPv6 raw sockets\nc, err := net.ListenPacket(\"ip6:ipv6-icmp\", \"::\")\nif err != nil { /* skip RA feature */ }\np6 := ipv6.NewPacketConn(c)\nif err := p6.SetHopLimit(255); err != nil { /* RA unsupported here */ }","typeGuard":null,"tryCatchPattern":"// Go: treat RA init failure as non-fatal, degrade to DHCPv6-only\nif err := ra.Init(); err != nil {\n    log.Printf(\"RA disabled: %v\", err)\n}","preventionTips":["Run with CAP_NET_RAW or host networking","Verify the interface has an IPv6 link-local address before enabling RA","Feature-detect socket options at startup and degrade gracefully"],"tags":["dhcpv6","router-advertisement","ipv6","socket-options","network"],"backgroundTag":"ipv6-socket-option-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}