proxy: guard if_indextoname bind block for Windows (_WIN32)
This commit is contained in:
1 parent
7a40a1b0a8
commit
0a102a7f43
1 file changed
+3
@@ -387,10 +387,13 @@ int tcp_proxy_server_handle_connect(struct UTUN_INSTANCE* inst, struct ll_entry*
|
||||
setsockopt(sock, SOL_SOCKET, SO_SETFIB, &g->tcp_proxy_server_fib, sizeof(g->tcp_proxy_server_fib));
|
||||
}
|
||||
#endif
|
||||
// Bind to interface if specified (Linux only)
|
||||
#ifndef _WIN32
|
||||
if (g->tcp_proxy_server_netif_index > 0) {
|
||||
char ifname[IF_NAMESIZE];
|
||||
if (if_indextoname(g->tcp_proxy_server_netif_index, ifname)) socket_bind_to_device(sock, ifname);
|
||||
}
|
||||
#endif
|
||||
|
||||
rc->tc = tcp_conn_create(inst->ua, sock, 1500, 8192, 4, 0, inst->config->global.tcp_recv_buf, on_fin_cb, on_error_cb, rc);
|
||||
if (!rc->tc) { DEBUG_ERROR(DEBUG_CATEGORY_PROXY, "TCP proxy server: tcp_conn_create failed"); socket_close_wrapper(sock); ctx->conn_count--; u_free(rc); queue_dgram_free(entry); queue_entry_free(entry); return -1; }
|
||||
|
||||
Reference in new issue
Block a user