Displaying 11 results from an estimated 11 matches for "serv_addr".
2009 Jun 01
2
[PATCH viewer] few minor bugfixes
...&& defined(HAVE_HTONS) && defined(HAVE_GETHOSTBYNAME)
+#if defined(HAVE_SOCKET) && defined(HAVE_CONNECT) && defined(HAVE_HTONS)
static int
viewer_open_vnc_socket(const char* vnchost, int vncport)
{
int socketfd;
- struct hostent *serv;
struct sockaddr_in serv_addr;
socketfd = socket(PF_INET, SOCK_STREAM, 0);
@@ -917,14 +918,9 @@ viewer_open_vnc_socket(const char* vnchost, int vncport)
return -1;
}
- serv = gethostbyname(vnchost);
- if(serv == NULL){
- return -1;
- }
-
serv_addr.sin_family = PF_INET;
serv_addr.sin_port = htons(v...
2009 Jun 08
2
[PATCH] few minor bugfixes
...&& defined(HAVE_HTONS) && defined(HAVE_GETHOSTBYNAME)
+#if defined(HAVE_SOCKET) && defined(HAVE_CONNECT) && defined(HAVE_HTONS)
static int
viewer_open_vnc_socket(const char* vnchost, int vncport)
{
- int socketfd;
- struct hostent *serv;
- struct sockaddr_in serv_addr;
+ int result, socketfd;
+ char port[10];
+ struct addrinfo* vnc_addr;
- socketfd = socket(PF_INET, SOCK_STREAM, 0);
- if(socketfd < 0){
- return -1;
- }
+ sprintf(port, "%d", vncport);
- serv = gethostbyname(vnchost);
- if(serv == NULL){
+ result = getaddrinfo(vncho...
2002 Apr 03
1
[PATCH] connect() timeout
...ective_uid != 0 || !options.use_privileged_port,
pw, options.proxy_command);
--- openssh-3.1p1/sshconnect.c.ORIG Tue Mar 5 19:59:46 2002
+++ openssh-3.1p1/sshconnect.c Wed Apr 3 23:33:48 2002
@@ -222,6 +222,64 @@
return sock;
}
+int
+timeout_connect(int sockfd, const struct sockaddr *serv_addr,
+ socklen_t addrlen, int timeout)
+{
+ int rc;
+ fd_set fds;
+
+ int optval = 0;
+ socklen_t optlen = sizeof(optval);
+ struct timeval tv;
+
+
+ if (timeout <= 0)
+ return(connect(sockfd, serv_addr, addrlen));
+
+ if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0)
+ {
+ return -1...
2002 May 22
0
[PATCH] connect() timeout
...ve_uid != 0 || !options.use_privileged_port,
pw, options.proxy_command);
--- openssh-3.2.2p1/sshconnect.c.ORIG Tue Mar 5 19:59:46 2002
+++ openssh-3.2.2p1/sshconnect.c Tue May 21 15:40:06 2002
@@ -222,6 +222,63 @@
return sock;
}
+int
+timeout_connect(int sockfd, const struct sockaddr *serv_addr,
+ socklen_t addrlen, int timeout)
+{
+ fd_set *fdset;
+ struct timeval tv;
+ socklen_t optlen;
+ int fdsetsz, optval, rc;
+
+ if (timeout <= 0)
+ return(connect(sockfd, serv_addr, addrlen));
+
+ if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0)
+ return -1;
+
+ rc = connect(sockfd, serv_addr,...
2002 Jan 26
5
[PATCH] Connect timeout
...ing = NULL;
+static jmp_buf jmpenv;
+
extern Options options;
extern char *__progname;
@@ -221,6 +223,43 @@
return sock;
}
+/* for alarm() */
+static void
+timeout_sigh(int dummy)
+{
+ errno = ETIMEDOUT;
+ longjmp(jmpenv, !0);
+}
+
+int
+timeout_connect(int sockfd, const struct sockaddr *serv_addr,
+ socklen_t addrlen, int timeout)
+{
+ void (*sigh)(int);
+ int rc;
+
+ if (timeout <= 0)
+ return(connect(sockfd, serv_addr, addrlen));
+
+ if (setjmp(jmpenv) == 0)
+ {
+ debug("ssh: setting connect() timeout to %d s.",
+ timeout);
+ sigh = signal(SIGALRM, timeout_sigh);
+ i...
2017 Jan 12
3
proposed change to ssh_connect_direct()
On Sat, Jan 7, 2017 at 2:30 PM, Peter Moody <mindrot at hda3.com> wrote:
> so I spent a bit of time looking at this and it seems like the only
> way to go, at least if I want to keep it in ssh_connect_direct(), is
> to use pthreads. further, it seems like getting that accepted is
> something of a long shot:
Sorry, pthreads is a non-starter.
I would have thought that using
2001 Nov 17
0
[PATCH] Connect timeout
...ing = NULL;
+static jmp_buf jmpenv;
+
extern Options options;
extern char *__progname;
@@ -221,6 +223,43 @@
return sock;
}
+/* for alarm() */
+static void
+timeout_sigh(int dummy)
+{
+ errno = ETIMEDOUT;
+ longjmp(jmpenv, !0);
+}
+
+int
+timeout_connect(int sockfd, const struct sockaddr *serv_addr,
+ socklen_t addrlen, int timeout)
+{
+ void (*sigh)(int);
+ int rc;
+
+ if (timeout <= 0)
+ return(connect(sockfd, serv_addr, addrlen));
+
+ if (setjmp(jmpenv) == 0)
+ {
+ debug("ssh: setting connect() timeout to %d s.",
+ timeout);
+ sigh = signal(SIGALRM, timeout_sigh);
+ i...
2003 Apr 15
0
Connect timeout patch
...on the local machine be forwarded
over the secure channel, and the application
--- openssh-3.6.1p1/sshconnect.c.ORIG Tue Apr 15 23:06:30 2003
+++ openssh-3.6.1p1/sshconnect.c Tue Apr 15 23:08:28 2003
@@ -212,6 +212,61 @@
return sock;
}
+int
+timeout_connect(int sockfd, const struct sockaddr *serv_addr,
+ socklen_t addrlen, int timeout)
+{
+ fd_set *fdset;
+ struct timeval tv;
+ socklen_t optlen;
+ int fdsetsz, optval, rc;
+
+ if (timeout <= 0)
+ return(connect(sockfd, serv_addr, addrlen));
+
+ if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0)
+ return -1;
+
+ rc = connect(sockfd, serv_addr, ad...
2002 Oct 17
0
[PATCH] connect() timeout for OpenSSH-3.5p1
...port on the local machine be forwarded
over the secure channel, and the application
--- openssh-3.5p1/sshconnect.c.ORIG Thu Sep 19 04:05:04 2002
+++ openssh-3.5p1/sshconnect.c Wed Oct 16 14:59:12 2002
@@ -212,6 +212,61 @@
return sock;
}
+int
+timeout_connect(int sockfd, const struct sockaddr *serv_addr,
+ socklen_t addrlen, int timeout)
+{
+ fd_set *fdset;
+ struct timeval tv;
+ socklen_t optlen;
+ int fdsetsz, optval, rc;
+
+ if (timeout <= 0)
+ return(connect(sockfd, serv_addr, addrlen));
+
+ if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0)
+ return -1;
+
+ rc = connect(sockfd, serv_addr, ad...
2018 Feb 23
6
RFC 8305 Happy Eyeballs in OpenSSH
...rrency
+ *
+ * implementation can have a fixed delay for how long to wait before
+ * starting the next connection attempt [...] recommended value for a
+ * default delay is 250 milliseconds.
+ */
+#define CONNECTION_ATTEMPT_DELAY 250
+
static int
-timeout_connect(int sockfd, const struct sockaddr *serv_addr,
- socklen_t addrlen, int *timeoutp)
+ssh_connect_timeout(struct timeval *tv, int timeout_ms)
{
- int optval = 0;
- socklen_t optlen = sizeof(optval);
+ if (timeout_ms <= 0)
+ return 0;
+ ms_subtract_diff(tv, &timeout_ms);
+ return timeout_ms <= 0;
+}
- /* No timeout: just do a blo...
2009 Jan 07
2
Question about documentation for ConnectTimeout
Hello OpenSSH folks,
This was a really minor knit, but I noted while I was developing a
pexpect module for ssh that setting ConnectTimeout to 0 in the options
to ssh sets the login timeout to infinite time.
I was wondering whether or not this was a documentation bug and/or
potential clarification that could to be made, or if this was a
software bug that needs to be fixed. I don't see