Bugzilla – Attachment 3570 Details for
Bug 3386
[FEATURE REQUEST]Option to set client source port.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add optional port to BindAddress and -b
ssh-bind-port.patch (text/plain), 1.64 KB, created by
Darren Tucker
on 2022-02-04 14:59:40 AEDT
(
hide
)
Description:
Add optional port to BindAddress and -b
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2022-02-04 14:59:40 AEDT
Size:
1.64 KB
patch
obsolete
>Index: sshconnect.c >=================================================================== >RCS file: /export/cvs/src/usr.bin/ssh/sshconnect.c,v >retrieving revision 1.356 >diff -u -p -r1.356 sshconnect.c >--- sshconnect.c 19 Dec 2021 22:10:24 -0000 1.356 >+++ sshconnect.c 4 Feb 2022 03:52:50 -0000 >@@ -342,6 +342,7 @@ ssh_create_socket(struct addrinfo *ai) > struct addrinfo hints, *res = NULL; > struct ifaddrs *ifaddrs = NULL; > char ntop[NI_MAXHOST]; >+ char *cp = NULL, *addrport = NULL, *addr = NULL, *port = NULL; > > sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); > if (sock == -1) { >@@ -359,14 +360,24 @@ ssh_create_socket(struct addrinfo *ai) > return sock; > > if (options.bind_address != NULL) { >+ cp = addrport = xstrdup(options.bind_address); >+ addr = hpdelim(&addrport); >+ if (*addr == '\0') /* no address, port only */ >+ addr = NULL; >+ if (addrport != NULL) /* optional port */ >+ port = hpdelim(&addrport); >+ if (addrport != NULL) { >+ error("Invalid BindAddress specification '%s'", >+ options.bind_address); >+ goto fail; >+ } > memset(&hints, 0, sizeof(hints)); > hints.ai_family = ai->ai_family; > hints.ai_socktype = ai->ai_socktype; > hints.ai_protocol = ai->ai_protocol; > hints.ai_flags = AI_PASSIVE; >- if ((r = getaddrinfo(options.bind_address, NULL, >- &hints, &res)) != 0) { >- error("getaddrinfo: %s: %s", options.bind_address, >+ if ((r = getaddrinfo(addr, port, &hints, &res)) != 0) { >+ error("getaddrinfo: %s port %s: %s", addr, port, > ssh_gai_strerror(r)); > goto fail; > } >@@ -410,6 +421,7 @@ fail: > freeaddrinfo(res); > if (ifaddrs != NULL) > freeifaddrs(ifaddrs); >+ free(cp); > return sock; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 3386
: 3570