From f7288d77e4e705cbbc12c2ad55ed50f9de9a87e2 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 21 Jun 2009 18:12:20 +1000 Subject: - andreas@cvs.openbsd.org 2009/05/27 06:31:25 [canohost.h canohost.c] Add clear_cached_addr(), needed for upcoming changes allowing the peer address to change. ok markus@ --- packet.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'packet.h') diff --git a/packet.h b/packet.h index 03bb87c9b..9a9c97719 100644 --- a/packet.h +++ b/packet.h @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.h,v 1.49 2008/07/10 18:08:11 markus Exp $ */ +/* $OpenBSD: packet.h,v 1.50 2009/05/25 06:48:01 andreas Exp $ */ /* * Author: Tatu Ylonen @@ -72,6 +72,7 @@ void packet_get_state(int, u_int32_t *, u_int64_t *, u_int32_t *, u_int64_t *); void packet_set_state(int, u_int32_t, u_int64_t, u_int32_t, u_int64_t); int packet_get_ssh1_cipher(void); void packet_set_iv(int, u_char *); +void *packet_get_newkeys(int); void packet_write_poll(void); void packet_write_wait(void); @@ -87,10 +88,10 @@ void packet_add_padding(u_char); void tty_make_modes(int, struct termios *); void tty_parse_modes(int, int *); -extern u_int max_packet_size; -extern int keep_alive_timeouts; +void packet_set_alive_timeouts(int); +int packet_inc_alive_timeouts(void); int packet_set_maxsize(u_int); -#define packet_get_maxsize() max_packet_size +u_int packet_get_maxsize(void); /* don't allow remaining bytes after the end of the message */ #define packet_check_eom() \ @@ -106,4 +107,7 @@ do { \ int packet_need_rekeying(void); void packet_set_rekey_limit(u_int32_t); +void *packet_get_input(void); +void *packet_get_output(void); + #endif /* PACKET_H */ -- cgit v1.2.3 From 761c38918aecbbe2df97d13aea29c6bbf9212617 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 21 Jun 2009 18:16:26 +1000 Subject: - andreas@cvs.openbsd.org 2009/05/27 06:38:16 [sshconnect.h sshconnect.c] Un-static ssh_exchange_identification(), part of a larger change from Martin Forssen and needed for upcoming changes. ok markus@ --- ChangeLog | 6 ++++++ packet.c | 16 +++++++++++++++- packet.h | 4 +++- 3 files changed, 24 insertions(+), 2 deletions(-) (limited to 'packet.h') diff --git a/ChangeLog b/ChangeLog index d10b327a0..c5f2ce6f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -75,6 +75,12 @@ [packet.h packet.c] Add packet_put_int64() and packet_get_int64(), part of a larger change from Martin Forssen. + ok markus@ + - andreas@cvs.openbsd.org 2009/05/27 06:38:16 + [sshconnect.h sshconnect.c] + Un-static ssh_exchange_identification(), part of a larger change from + Martin Forssen and needed for upcoming changes. + ok markus@ 20090616 - (dtucker) [configure.ac defines.h] Bug #1607: handle the case where fsid_t diff --git a/packet.c b/packet.c index fdc648888..cecab82e9 100644 --- a/packet.c +++ b/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.161 2009/05/25 06:48:01 andreas Exp $ */ +/* $OpenBSD: packet.c,v 1.162 2009/05/27 06:36:07 andreas Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -595,6 +595,12 @@ packet_put_int(u_int value) buffer_put_int(&active_state->outgoing_packet, value); } +void +packet_put_int64(u_int64_t value) +{ + buffer_put_int64(&active_state->outgoing_packet, value); +} + void packet_put_string(const void *buf, u_int len) { @@ -1467,6 +1473,14 @@ packet_get_int(void) return buffer_get_int(&active_state->incoming_packet); } +/* Returns an 64 bit integer from the packet data. */ + +u_int64_t +packet_get_int64(void) +{ + return buffer_get_int64(&active_state->incoming_packet); +} + /* * Returns an arbitrary precision integer from the packet data. The integer * must have been initialized before this call. diff --git a/packet.h b/packet.h index 9a9c97719..265fcf236 100644 --- a/packet.h +++ b/packet.h @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.h,v 1.50 2009/05/25 06:48:01 andreas Exp $ */ +/* $OpenBSD: packet.h,v 1.51 2009/05/27 06:36:07 andreas Exp $ */ /* * Author: Tatu Ylonen @@ -39,6 +39,7 @@ void packet_set_authenticated(void); void packet_start(u_char); void packet_put_char(int ch); void packet_put_int(u_int value); +void packet_put_int64(u_int64_t value); void packet_put_bignum(BIGNUM * value); void packet_put_bignum2(BIGNUM * value); void packet_put_string(const void *buf, u_int len); @@ -55,6 +56,7 @@ int packet_read_poll_seqnr(u_int32_t *seqnr_p); u_int packet_get_char(void); u_int packet_get_int(void); +u_int64_t packet_get_int64(void); void packet_get_bignum(BIGNUM * value); void packet_get_bignum2(BIGNUM * value); void *packet_get_raw(u_int *length_ptr); -- cgit v1.2.3 From e841eb065426d9c9c9e107e76d816107d68554a7 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Mon, 6 Jul 2009 07:11:13 +1000 Subject: - andreas@cvs.openbsd.org 2009/06/27 09:29:06 [packet.h packet.c] packet_bacup_state() and packet_restore_state() will be used to temporarily save the current state ren resuming a suspended connection. ok markus@ --- ChangeLog | 7 +++++++ packet.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- packet.h | 5 ++++- 3 files changed, 60 insertions(+), 3 deletions(-) (limited to 'packet.h') diff --git a/ChangeLog b/ChangeLog index 0f39fa215..93f6b8a20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ + - (dtucker) OpenBSD CVS Sync + - andreas@cvs.openbsd.org 2009/06/27 09:29:06 + [packet.h packet.c] + packet_bacup_state() and packet_restore_state() will be used to + temporarily save the current state ren resuming a suspended connection. + ok markus@ + 20090622 - (dtucker) OpenBSD CVS Sync - dtucker@cvs.openbsd.org 2009/06/22 05:39:28 diff --git a/packet.c b/packet.c index 0e9993b5a..600e015fb 100644 --- a/packet.c +++ b/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.165 2009/06/12 20:58:32 andreas Exp $ */ +/* $OpenBSD: packet.c,v 1.166 2009/06/27 09:29:06 andreas Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -194,7 +194,7 @@ struct session_state { TAILQ_HEAD(, packet) outgoing; }; -static struct session_state *active_state; +static struct session_state *active_state, *backup_state; static struct session_state * alloc_session_state(void) @@ -1887,3 +1887,50 @@ packet_get_newkeys(int mode) { return (void *)active_state->newkeys[mode]; } + +/* + * Save the state for the real connection, and use a separate state when + * resuming a suspended connection. + */ +void +packet_backup_state(void) +{ + struct session_state *tmp; + + close(active_state->connection_in); + active_state->connection_in = -1; + close(active_state->connection_out); + active_state->connection_out = -1; + if (backup_state) + tmp = backup_state; + else + tmp = alloc_session_state(); + backup_state = active_state; + active_state = tmp; +} + +/* + * Swap in the old state when resuming a connecion. + */ +void +packet_restore_state(void) +{ + struct session_state *tmp; + void *buf; + u_int len; + + tmp = backup_state; + backup_state = active_state; + active_state = tmp; + active_state->connection_in = backup_state->connection_in; + backup_state->connection_in = -1; + active_state->connection_out = backup_state->connection_out; + backup_state->connection_out = -1; + len = buffer_len(&backup_state->input); + if (len > 0) { + buf = buffer_ptr(&backup_state->input); + buffer_append(&active_state->input, buf, len); + buffer_clear(&backup_state->input); + add_recv_bytes(len); + } +} diff --git a/packet.h b/packet.h index 265fcf236..33523d750 100644 --- a/packet.h +++ b/packet.h @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.h,v 1.51 2009/05/27 06:36:07 andreas Exp $ */ +/* $OpenBSD: packet.h,v 1.52 2009/06/27 09:29:06 andreas Exp $ */ /* * Author: Tatu Ylonen @@ -109,6 +109,9 @@ do { \ int packet_need_rekeying(void); void packet_set_rekey_limit(u_int32_t); +void packet_backup_state(void); +void packet_restore_state(void); + void *packet_get_input(void); void *packet_get_output(void); -- cgit v1.2.3