{"record":{"id":"77a72c4b60d6ebb6","repo":"netbirdio/netbird","slug":"add-inbound-dnat-w-77a72c","errorCode":null,"errorMessage":"add inbound DNAT: %w","messagePattern":"add inbound DNAT: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/firewall/nftables/manager_linux.go","lineNumber":626,"sourceCode":"\t}\n\n\tif m.hasIPv6() && len(v6Prefixes) > 0 {\n\t\tif err := m.router6.UpdateSet(set, v6Prefixes); err != nil {\n\t\t\treturn fmt.Errorf(\"update v6 set: %w\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// AddInboundDNAT adds an inbound DNAT rule redirecting traffic from NetBird peers to local services.\nfunc (m *Manager) AddInboundDNAT(localAddr netip.Addr, protocol firewall.Protocol, originalPort, translatedPort uint16) error {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tif localAddr.Is6() {\n\t\tif !m.hasIPv6() {\n\t\t\treturn fmt.Errorf(\"add inbound DNAT: %w\", firewall.ErrIPv6NotInitialized)\n\t\t}\n\t\treturn m.router6.AddInboundDNAT(localAddr, protocol, originalPort, translatedPort)\n\t}\n\treturn m.router.AddInboundDNAT(localAddr, protocol, originalPort, translatedPort)\n}\n\n// RemoveInboundDNAT removes an inbound DNAT rule.\nfunc (m *Manager) RemoveInboundDNAT(localAddr netip.Addr, protocol firewall.Protocol, originalPort, translatedPort uint16) error {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tif localAddr.Is6() {\n\t\tif !m.hasIPv6() {\n\t\t\treturn fmt.Errorf(\"remove inbound DNAT: %w\", firewall.ErrIPv6NotInitialized)\n\t\t}\n\t\treturn m.router6.RemoveInboundDNAT(localAddr, protocol, originalPort, translatedPort)\n\t}\n\treturn m.router.RemoveInboundDNAT(localAddr, protocol, originalPort, translatedPort)","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/firewall/nftables/manager_linux.go#L608-L644","documentation":"A sentinel wrap of firewall.ErrIPv6NotInitialized: AddInboundDNAT was called with an IPv6 local address, but the manager has no IPv6 router initialized (the peer has no v6 capability or v6 init failed). The request is rejected rather than silently applied to the v4 path, so callers can distinguish a capability mismatch from a kernel error.","triggerScenarios":"Thrown at client/firewall/nftables/manager_linux.go:626 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enable IPv6 in the overlay before adding v6 inbound DNAT","Use an IPv4 local address for the redirect","Check manager initialization flags before issuing v6 rules"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","contentChangedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}