search for: sockfd

Displaying 20 results from an estimated 45 matches for "sockfd".

2004 Aug 06
0
Submission: Patch to libshout/sock.c for MacOSX
...CKLEN_T #define socklen_t int #endif #ifndef _WIN32 extern int h_errno, errno; #endif #include "sock.h" int sock_recoverable(int error) { if (error == EAGAIN || error == EINTR || error == EINPROGRESS || error == EWOULDBLOCK) { return 1; } return 0; } int sock_valid_socket(SOCKET sockfd) { return (sockfd >= 0); } #ifdef _WIN32 int inet_aton(const char *s, struct in_addr *a) { int lsb, b2, b3, msb; if (sscanf(s, "%d.%d.%d.%d", &lsb, &b2, &b3, &msb) < 4) { return 0; } #ifdef HAVE_INET_ADDR a->s_addr = inet_addr(s); if(a->s_addr == -1...
2002 May 22
0
[PATCH] connect() timeout
...timeout, original_effective_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; +...
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
2002 Apr 03
1
[PATCH] connect() timeout
...ion_timeout, original_effective_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_...
2017 Feb 03
5
[PATCH 0/5] Support socket activation in virt-p2v.
As the subject says, support socket activation in virt-p2v. I have added upstream support for socket activation to nbdkit already: https://github.com/libguestfs/nbdkit/commit/7ff39d028c6359f5c0925ed2cf4a2c4c751af2e4 I posted a patch for qemu-nbd, still waiting on more reviews for that one: https://www.mail-archive.com/qemu-devel@nongnu.org/msg427246.html I tested this against old and new qemu
2003 Apr 15
0
Connect timeout patch
...d Specifies that a TCP/IP port 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; + +...
2014 Dec 05
2
[PATCH] p2v: wait for qemu-nbd before starting conversion (RHBZ#1167774)
...+ #if DEBUG_STDERR fprintf (stderr, "%s: data connection for %s: SSH remote port %d, local port %d\n", @@ -371,6 +380,69 @@ start_qemu_nbd (int port, const char *device) return pid; } +static int +wait_qemu_nbd (int nbd_local_port, int timeout_seconds) +{ + int sockfd; + int result = 0; + struct sockaddr_in addr; + time_t start_t, now_t; + struct timeval timeout = { .tv_usec = 0 }; + char magic[8]; /* NBDMAGIC */ + size_t bytes_read = 0; + ssize_t recvd; + + time (&start_t); + + sockfd = socket (AF_INET, SOCK_STREAM, 0); + if (sockfd == -1) { +...
2002 Oct 17
0
[PATCH] connect() timeout for OpenSSH-3.5p1
...rward Specifies that a TCP/IP 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; + +...
2014 Feb 10
3
What magic did openssh do to handle programs like VIM?
...sn't seem to incorporate readline, so the magic is not on readline 2. If I run command like VIM, it doesn't run. And buttons like "<ESC>:q" won't work Can someone enlighten me about what SSH did, so it all works perfectly? Attached the prototype: int sockfd = socket(PF_INET, SOCK_STREAM, 0); struct sockaddr_in remaddr = { 0 }; remaddr.sin_family = AF_INET; remaddr.sin_port = htons(9999); remaddr.sin_addr.s_addr = inet_addr("192.168.56.1"); if (connect(sockfd, (struct sockaddr *)&remaddr, sizeof(struct sockaddr)))...
2014 Dec 15
0
[PATCH] p2v: avoid connecting to ourself while probing qemu-nbd (RHBZ#1167774)
...+++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/p2v/conversion.c b/p2v/conversion.c index 4ff7ecc..14e7b3b 100644 --- a/p2v/conversion.c +++ b/p2v/conversion.c @@ -398,7 +398,8 @@ wait_qemu_nbd (int nbd_local_port, int timeout_seconds) { int sockfd; int result = -1; - struct sockaddr_in addr; + int reuseaddr = 1; + struct sockaddr_in src_addr, dst_addr; time_t start_t, now_t; struct timeval timeout = { .tv_usec = 0 }; char magic[8]; /* NBDMAGIC */ @@ -413,10 +414,40 @@ wait_qemu_nbd (int nbd_local_port, int timeout_seconds)...
2002 Jan 26
5
[PATCH] Connect timeout
...NULL; char *server_version_string = 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 = s...
2014 Dec 15
2
[PATCH v2 0/1] p2v: avoid connecting to ourself while probing qemu-nbd
Changes since v1: - Set probing source port to be nbd_local_port+1 instead of always using 50124 to deal with multi-disk scenario. - Set SO_REUSEADDR on client socket to avoid issues with old connections in TIME_WAIT. I've been running this for a few hours now using the updated multi-disk test and haven't seen any problems.
2014 Dec 12
2
[PATCH] p2v: avoid connecting to ourself while probing qemu-nbd (RHBZ#1167774)
...illa.redhat.com/show_bug.cgi?id=1167774#c9 + */ +static int nbd_probe_port = 50124; + /* Data per NBD connection / physical disk. */ struct data_conn { mexp_h *h; /* miniexpect handle to ssh */ @@ -398,7 +408,7 @@ wait_qemu_nbd (int nbd_local_port, int timeout_seconds) { int sockfd; int result = -1; - struct sockaddr_in addr; + struct sockaddr_in src_addr, dst_addr; time_t start_t, now_t; struct timeval timeout = { .tv_usec = 0 }; char magic[8]; /* NBDMAGIC */ @@ -413,10 +423,20 @@ wait_qemu_nbd (int nbd_local_port, int timeout_seconds) return -1; } -...
2017 Mar 06
7
[PATCH 0/6] Various Coverity fixes #2
Hi, this patch series fixes few more issues discovered by Coverity. Thanks, Pino Toscano (6): tail: check the return value pf guestfs_set_pgroup daemon: btrfs: check end_stringsbuf return values everywhere java: use cleanup handlers for structs (lists) as return values lib: qemu: improve handling of FILE* p2v: check more return values p2v: fix possible close(-1) issue cat/tail.c
2017 Mar 06
0
[PATCH 6/6] p2v: fix possible close(-1) issue
Make sure the error handler (i.e. the code after the 'cleanup' label) does not attempt to call close(-1), in case 'sockfd' is not initialized yet. --- p2v/nbd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/p2v/nbd.c b/p2v/nbd.c index ee21005..29ca40d 100644 --- a/p2v/nbd.c +++ b/p2v/nbd.c @@ -722,7 +722,8 @@ wait_for_nbd_server_to_start (const char *ipaddr, int port) result = 0; cl...
2018 Feb 23
6
RFC 8305 Happy Eyeballs in OpenSSH
...Better Connectivity Using Concurrency + * + * 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; +...
2012 Apr 12
8
Background jobs with #fork
Hi I''ve migrated from Passenger to Unicorn about a week ago. It''s great. Great transparency and management, thanks for this great software! A few of my Rails applications start background jobs using Kernel#fork. Of course, the ActiveRecord connections are closed and reopened again in the parent and child processes. The child process also does its job. Unfortunately, it seems
2016 Dec 20
0
[Bug 1104] New: Use close on exec flags instead of fcntl
...samsung.com Now in lateswt versions of glibc, close on exec flags are available for file/socket open functions which are better than using fcntl. Below is current usage of fcntl in iptables: ./libxtables/xtables.c: if (fcntl(procfile, F_SETFD, FD_CLOEXEC) == -1) { ./libxtables/xtables.c: if (fcntl(sockfd, F_SETFD, FD_CLOEXEC) == -1) { ./libiptc/libiptc.c: if (fcntl(sockfd, F_SETFD, FD_CLOEXEC) == -1) { ./extensions/libxt_set.h: if (fcntl(sockfd, F_SETFD, FD_CLOEXEC) == -1) It can use O_CLOEXEC flag with open() system call & SOCK_CLOEXEC with socket() call instead of using fcntl. Pleas...
2004 May 12
8
How do fix a good solution against spam..
Heya folks First of all, sorry if this isn't the correct list, but yet, I think spam is a kind of network attack and should be treated as a security issue.. I run a working mail server using Postfix, MySQL, Courier-IMAP, SpamAssassin and ClamAV (amavisd-new) .. I've checked the configuration file for SpamAssassin, but yet I havn't find any good solution for spam.. Sure, spam will
2017 Jan 26
3
[PATCH 0/3] p2v: Allow nbdkit as an alternative NBD server.
qemu-nbd is a fine NBD server. However it's not easy to compile a reliably working version on RHEL 5. This patch series allows nbdkit to be used as an alternative (qemu-nbd is still the default). Rich.