Skip to content

Windows: initialize Winsock before proxy host validation (fix localhost config parse/init failure)#145

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-bsd-issue-proxybridge-windivert
Draft

Windows: initialize Winsock before proxy host validation (fix localhost config parse/init failure)#145
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-bsd-issue-proxybridge-windivert

Conversation

Copy link
Copy Markdown

Copilot AI commented May 28, 2026

The reported BSOD path points to WinDivert/kernel behavior, but this repository had a separate reproducible startup issue where hostname-based proxy config (notably localhost) could fail resolution and surface as invalid proxy state (e.g., :0). This PR narrows scope to that ProxyBridge-side initialization bug.

  • Root cause

    • ProxyBridge_SetProxyConfig() validated proxy_ip via resolve_hostname() before guaranteeing Winsock was initialized.
    • Hostnames (vs raw IPv4 literals) therefore had a failure path during early config setup.
  • Change

    • Initialize Winsock inside ProxyBridge_SetProxyConfig() before hostname validation.
    • Keep validation behavior unchanged; only make it deterministic for hostname inputs.
    • Clean up Winsock on both success and failure paths in this function.
  • Resulting behavior

    • Proxy values like socks5://localhost:1080 and http://localhost:8080 now validate consistently during config setup, matching existing IP-literal behavior (127.0.0.1).
PROXYBRIDGE_API BOOL ProxyBridge_SetProxyConfig(...) {
    WSADATA wsa_data;
    if (WSAStartup(MAKEWORD(2, 2), &wsa_data) != 0) return FALSE;

    if (resolve_hostname(proxy_ip) == 0) {
        WSACleanup();
        return FALSE;
    }

    // existing config assignment logic...
    WSACleanup();
    return TRUE;
}

Copilot AI changed the title [WIP] Fix possible BSOD caused by ProxyBridge bundled WinDivert64.sys Windows: initialize Winsock before proxy host validation (fix localhost config parse/init failure) May 28, 2026
Copilot AI requested a review from Anof-cyber May 28, 2026 12:30
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Possible BSOD caused by ProxyBridge bundled WinDivert64.sys during network packet handling

2 participants