search for: addrlen

Displaying 20 results from an estimated 98 matches for "addrlen".

Did you mean: addr_len
2003 Jan 20
0
[patch] Recent IPv6 changes in rsync/access.c
...; > The suggested fix Daniel Hartmeier (an OpenBSD developer) had when > > I asked (for I'm not really a coder and I wanted to double check > > that this was a valid problem) was making the mask[w] assignment > > conditional like thus: > > > > if (w < addrlen) > > mask[w] = 0xff & (0xff<<(8-b)); > > Absolutely... Please apply the suggested fix. > Thanks for finding / fixing this serious bug. By the way, in the future I would appreciate it if you would post bugs to the rsync mailing list instead of to me because...
2019 Sep 18
1
[PATCH nbdkit] server: Remove useless thread local sockaddr.
...onst char *name) extern const char *threadlocal_get_name (void); extern void threadlocal_set_instance_num (size_t instance_num); extern size_t threadlocal_get_instance_num (void); -extern void threadlocal_set_sockaddr (const struct sockaddr *addr, - socklen_t addrlen) - __attribute__((__nonnull__ (1))); -/*extern void threadlocal_get_sockaddr ();*/ extern void threadlocal_set_error (int err); extern int threadlocal_get_error (void); extern void *threadlocal_buffer (size_t size); diff --git a/server/sockets.c b/server/sockets.c index dfaa3ea..3514c69 100644...
2003 Jun 25
1
socks5 support for -D
...UCCESS 0x00 + +static int +channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset) +{ + struct { + u_int8_t version; + u_int8_t command; + u_int8_t reserved; + u_int8_t atyp; + } s5_req, s5_rsp; + u_int16_t dest_port; + u_char *p, dest_addr[255+1]; + int i, have, found, nmethods, addrlen, af; + + debug2("channel %d: decode socks5", c->self); + p = buffer_ptr(&c->input); + if (p[0] != 0x05) + return -1; + have = buffer_len(&c->input); + if (!(c->flags & SSH_SOCKS5_AUTHDONE)) { + /* format: ver | nmethods | methods */ + if (have < 2) + retur...
2002 Nov 05
2
2.5.6 release
On Tue, Nov 05, 2002 at 08:37:00AM -0800, Martin Pool wrote: > On 10 Oct 2002, "Green, Paul" <Paul.Green@stratus.com> wrote: > > No new CVS messages have appeared on the rsync-cvs archives since August > > 30th. This seems rather odd-- perhaps a daemon stopped working? If there > > has truly been no activity since that date, I apologize for > >
2019 Sep 15
0
[PATCH nbdkit 3/4] server: Add nbdkit_peer_name() to return the client address.
...d the call returns C<NULL>. See also L<nbdkit-reflection-plugin(1)>. +=head1 PEER NAME + +It is possible to get the address of the client when you are running +in any connected callback. + +=head2 C<nbdkit_peer_name> + + int nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen); + +Return the peer (client) address, if available. The C<addr> and +C<addrlen> parameters behave like L<getpeername(2)>. In particular +you must initialize C<addrlen> with the size of the buffer pointed to +by C<addr>, and if C<addr> is not large enough then...
2017 Nov 17
0
[nbdkit PATCH 4/4] sockets: Fix lifetime of thread_data
...eturn NULL; } @@ -270,18 +271,25 @@ accept_connection (int listen_sock) int err; pthread_attr_t attrs; pthread_t thread; - struct thread_data thread_data; + struct thread_data *thread_data; static size_t instance_num = 1; - thread_data.instance_num = instance_num++; - thread_data.addrlen = sizeof thread_data.addr; + thread_data = malloc (sizeof *thread_data); + if (!thread_data) { + perror ("malloc"); + return; + } + + thread_data->instance_num = instance_num++; + thread_data->addrlen = sizeof thread_data->addr; again: - thread_data.sock = accept (l...
2002 Apr 03
1
[PATCH] connect() timeout
...s.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; + } + + rc = connect(s...
2020 Mar 26
0
[PATCH nbdkit 5/9 patch split 5/5] server: Indirect slow path, non-self-contained functions through the server.
...readlocal_set_conn (struct connection *conn); extern struct connection *threadlocal_get_conn (void); +/* public.c */ +extern int do_nbdkit_nanosleep (unsigned sec, unsigned nsec); +extern const char *do_nbdkit_export_name (void); +extern int do_nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen); + /* Macro which sets local variable struct connection *conn from * thread-local storage, asserting that it is non-NULL. If you want * to check if conn could be NULL (eg. outside a connection context) diff --git a/server/main.c b/server/main.c index 9fcb8e13..156d85bd 100644 --- a/server/ma...
2002 May 22
0
[PATCH] connect() timeout
...e_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, addrlen); + if (rc == 0...
2019 Sep 15
0
[PATCH nbdkit 4/4] reflection: Enhance plugin to support client address mode.
...= 0) { + mode = MODE_ADDRESS; + } else { nbdkit_error ("unknown mode: '%s'", value); return -1; @@ -137,6 +144,74 @@ decode_base64 (const char *data, size_t len, struct handle *ret) #endif } +static int +handle_address (struct sockaddr *sa, socklen_t addrlen, + struct handle *ret) +{ + struct sockaddr_in *addr = (struct sockaddr_in *) sa; + struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *) sa; + union { + char straddr[INET_ADDRSTRLEN]; + char straddr6[INET6_ADDRSTRLEN]; + } u; + int r; + char *str; + + switch (addr->si...
2002 Jan 26
5
[PATCH] Connect timeout
...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); + if (sigh == SIG_ERR) +...
2008 Jun 19
5
Portforwarding using the control master.
Hi all, currently I am considering writing a patch for OpenSSH that will allow portforwarding using the control_master unix domain socket. The idea is to introduce an extra SSHMUX command, SSHMUX_COMMAND_SOCKS, which will then pass control to the normal socks functions used for dynamic forwarding. The main reason for me to write this patch are: - some more control over who gets to connect to
2015 Dec 02
5
[PATCH] Receive multiple packets at a time
...} +#ifdef HAVE_RECVMMSG +#define MAX_MSG 256 +#else +#define MAX_MSG 1 +#endif + void handle_incoming_vpn_data(void *data, int flags) { listen_socket_t *ls = data; - vpn_packet_t pkt; + vpn_packet_t pkt[MAX_MSG]; char *hostname; node_id_t nullid = {}; - sockaddr_t addr = {}; - socklen_t addrlen = sizeof addr; + sockaddr_t addr[MAX_MSG] = {}; +#ifdef HAVE_RECVMMSG + struct mmsghdr msg[MAX_MSG]; + struct iovec iov[MAX_MSG]; +#else + socklen_t addrlen = sizeof addr[0]; +#endif node_t *from, *to; bool direct = false; + int num = 1, i; - pkt.offset = 0; - int len = recvfrom(ls->udp.fd...
2015 Dec 02
0
[PATCH] Receive multiple packets at a time
...; + > void handle_incoming_vpn_data(void *data, int flags) { > listen_socket_t *ls = data; > - vpn_packet_t pkt; > + vpn_packet_t pkt[MAX_MSG]; > char *hostname; > node_id_t nullid = {}; > - sockaddr_t addr = {}; > - socklen_t addrlen = sizeof addr; > + sockaddr_t addr[MAX_MSG] = {}; > +#ifdef HAVE_RECVMMSG > + struct mmsghdr msg[MAX_MSG]; > + struct iovec iov[MAX_MSG]; > +#else > + socklen_t addrlen = sizeof addr[0]; > +#endif > node_t *from, *to; > bool direct...
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
2017 Nov 17
7
[nbdkit PATCH 0/4] thread-safety issues prior to parallel handling
These patches should be ready to go in now; I will also post my work-in-progress for enabling full parallel handling that depends on these, but with that series, I was still getting crashes or hangs with test-socket-activation (I think I've nailed all the crashes I've seen, but the hang is rather insidious; see my other email
2000 Jun 27
1
openssh-2.1.1p1 on Irix6.2 report
...SKPASS_DEFAULT=\"/usr/local/libexec/ssh/ssh-askpass\" -DHAVE_CONFIG_H -c channels.c "channels.c", line 516: warning(1164): argument of type "socklen_t *" is incompatible with parameter of type "int *" newsock = accept(c->sock, &addr, &addrlen); ^ "channels.c", line 572: warning(1164): argument of type "socklen_t *" is incompatible with parameter of type "int *" newsock = accept(c->sock, &addr, &addrlen); ^ &...
2001 Nov 17
0
[PATCH] Connect timeout
...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); + if (sigh == SIG_ERR) +...
2012 Oct 22
1
[PATCH] Implement remote dynamic TCP forwarding
...sizeof(s4_rsp)); + buffer_append(output, &s4_rsp, sizeof(s4_rsp)); return 1; } @@ -1145,12 +1159,21 @@ channel_decode_socks5(Channel *c, fd_set *readset, fd_set *writeset) u_int16_t dest_port; u_char *p, dest_addr[255+1], ntop[INET6_ADDRSTRLEN]; u_int have, need, i, found, nmethods, addrlen, af; + Buffer *input, *output; + + if (c->type == SSH_CHANNEL_RDYNAMIC) { + input = &c->output; + output = &c->input; + } else { + input = &c->input; + output = &c->output; + } debug2("channel %d: decode socks5", c->self); - p = buffer_ptr(&c-...
2003 Apr 15
0
Connect timeout patch
...e 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, addrlen); + if (rc == 0...