From e86fc2e7b51f7ce85939a5be060467d619c51de2 Mon Sep 17 00:00:00 2001 From: bol-van Date: Fri, 23 Aug 2024 16:42:56 +0300 Subject: [PATCH] tpws: connect-bind-addr support %iface for link locals --- tpws/tpws.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tpws/tpws.c b/tpws/tpws.c index cef5f59..2b1991f 100644 --- a/tpws/tpws.c +++ b/tpws/tpws.c @@ -136,9 +136,9 @@ static void exithelp(void) " --bind-wait-ip-linklocal=\t\t; (prefer) accept only LL first N seconds then any (unwanted) accept only globals first N seconds then LL\n" " --bind-wait-only\t\t\t; wait for bind conditions satisfaction then exit. return code 0 if success.\n" " * multiple binds are supported. each bind-addr, bind-iface* start new bind\n" + " --connect-bind-addr=| ; address for outbound connections. for v6 link locals append %%interface_name\n" " --port=\t\t\t\t; only one port number for all binds is supported\n" " --socks\t\t\t\t; implement socks4/5 proxy instead of transparent proxy\n" - " --connect-bind-addr=| ; address for outbound connections\n" " --no-resolve\t\t\t\t; disable socks5 remote dns ability\n" " --resolver-threads=\t\t; number of resolver worker threads\n" " --local-rcvbuf=\n" @@ -788,6 +788,8 @@ void parse_params(int argc, char *argv[]) break; case 54: /* connect-bind-addr */ { + char *p = strchr(optarg,'%'); + if (p) *p++=0; if (inet_pton(AF_INET, optarg, ¶ms.connect_bind4.sin_addr)) { params.connect_bind4.sin_family = AF_INET; @@ -795,6 +797,7 @@ void parse_params(int argc, char *argv[]) else if (inet_pton(AF_INET6, optarg, ¶ms.connect_bind6.sin6_addr)) { params.connect_bind6.sin6_family = AF_INET6; + if (p && *p) params.connect_bind6.sin6_scope_id=if_nametoindex(p); } else {