{"record":{"id":"6eefb15c257d5ba8","repo":"cloudflare/cloudflared","slug":"cannot-send-icmpv4-using-icmpv6-proxy","errorCode":null,"errorMessage":"cannot send ICMPv4 using ICMPv6 proxy","messagePattern":"cannot send ICMPv4 using ICMPv6 proxy","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ingress/icmp_windows.go","lineNumber":344,"sourceCode":"\t\t},\n\t}\n\treturn responder.ReturnPacket(&pk)\n}\n\nfunc (ip *icmpProxy) icmpEchoRoundtrip(dst netip.Addr, echo *icmp.Echo) (echoResp, error) {\n\tif dst.Is6() {\n\t\tif ip.srcSocketAddr == nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot send ICMPv6 using ICMPv4 proxy\")\n\t\t}\n\t\tresp, err := ip.icmp6SendEcho(dst, echo)\n\t\tif err != nil {\n\n\t\t\treturn nil, errors.Wrap(err, \"failed to send/receive ICMPv6 echo\")\n\t\t}\n\t\treturn resp, nil\n\t}\n\tif ip.srcSocketAddr != nil {\n\t\treturn nil, fmt.Errorf(\"cannot send ICMPv4 using ICMPv6 proxy\")\n\t}\n\tresp, err := ip.icmpSendEcho(dst, echo)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to send/receive ICMPv4 echo\")\n\t}\n\treturn resp, nil\n}\n\n/*\nWrapper to call https://docs.microsoft.com/en-us/windows/win32/api/icmpapi/nf-icmpapi-icmpsendecho\nParameters:\n- IcmpHandle: Handle created by IcmpCreateFile\n- DestinationAddress: IPv4 in the form of https://docs.microsoft.com/en-us/windows/win32/api/inaddr/ns-inaddr-in_addr#syntax\n- RequestData: A pointer to echo data\n- RequestSize: Number of bytes in buffer pointed by echo data\n- RequestOptions: IP header options\n- ReplyBuffer: A pointer to the buffer for echoReply, options and data\n- ReplySize: Number of bytes allocated for ReplyBuffer","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/ingress/icmp_windows.go#L326-L362","documentation":"The Windows ICMP proxy counterpart to error 268: when the proxy was created with an ICMPv6 source socket (srcSocketAddr != nil) it cannot handle ICMPv4 echo requests, and icmpEchoRoundtrip returns this error. The socket family and destination family must match.","triggerScenarios":"icmpProxy.Request -> icmpEchoRoundtrip with dst being an IPv4 address while ip.srcSocketAddr is non-nil (proxy bound for ICMPv6).","commonSituations":"IPv4 origin behind a proxy instance set up for IPv6; dual-stack tunnel where traffic family mismatches the bound ICMP socket on Windows.","solutions":["Route IPv4 destinations to an ICMPv4-initialized proxy instance (restart cloudflared so both families are set up correctly).","Use an IPv6 destination (AAAA record) if the proxy is intentionally ICMPv6-only.","Check cloudflared startup logs to confirm which ICMP socket family was bound and adjust the ingress/routing rules accordingly.","If both families are needed, run in an environment where cloudflared establishes both v4 and v6 ICMP sockets (network with both stacks enabled)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if !pkt.Dst.Is6() && proxy.SrcSocketAddr != nil {\n    // IPv4 destination on an IPv6-bound proxy: reroute to a v4 proxy instance\n}","typeGuard":"func proxySupportsIPv4(p *icmpProxy) bool { return p.srcSocketAddr == nil }\n// call only when dst.Is4() && proxySupportsIPv4(ip)","tryCatchPattern":"resp, err := proxy.Request(ctx, pkt, responder)\nif err != nil && strings.Contains(err.Error(), \"cannot send ICMPv4 using ICMPv6 proxy\") {\n    return nil, errors.New(\"destination is IPv4 but ICMP proxy is IPv6-only; use an IPv6 target or re-init proxy\")\n}","preventionTips":["Check the proxy's socket family (srcSocketAddr) before dispatching IPv4 packets.","Enable both IPv4 and IPv6 stacks on Windows hosts so cloudflared binds the needed sockets.","Route v6-only proxies only to IPv6 destinations (AAAA records).","Verify startup logs confirm the expected ICMP socket family was bound."],"tags":["icmp","windows","ipv4","address-family","cloudflared"],"backgroundTag":"invalid-argument-value","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}