diff options
author | Darren Tucker <dtucker@zip.com.au> | 2009-06-21 18:59:36 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2009-06-21 18:59:36 +1000 |
commit | 7b935c79f4f31da21989cc441caee247af417b3b (patch) | |
tree | b50805c07d95bfeec0abdd8eac5f986ba8b1cf9b /packet.c | |
parent | b422afa41f75229da03a90a52b0f30206b5797a1 (diff) |
- andreas@cvs.openbsd.org 2009/06/12 20:58:32
[packet.c]
Move some more statics into session_state
ok markus@ djm@
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 30 |
1 files changed, 17 insertions, 13 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: packet.c,v 1.164 2009/06/12 20:43:22 andreas Exp $ */ | 1 | /* $OpenBSD: packet.c,v 1.165 2009/06/12 20:58:32 andreas Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -182,6 +182,15 @@ struct session_state { | |||
182 | /* Used in packet_read_poll2() */ | 182 | /* Used in packet_read_poll2() */ |
183 | u_int packlen; | 183 | u_int packlen; |
184 | 184 | ||
185 | /* Used in packet_send2 */ | ||
186 | int rekeying; | ||
187 | |||
188 | /* Used in packet_set_interactive */ | ||
189 | int set_interactive_called; | ||
190 | |||
191 | /* Used in packet_set_maxsize */ | ||
192 | int set_maxsize_called; | ||
193 | |||
185 | TAILQ_HEAD(, packet) outgoing; | 194 | TAILQ_HEAD(, packet) outgoing; |
186 | }; | 195 | }; |
187 | 196 | ||
@@ -950,7 +959,6 @@ packet_send2_wrapped(void) | |||
950 | static void | 959 | static void |
951 | packet_send2(void) | 960 | packet_send2(void) |
952 | { | 961 | { |
953 | static int rekeying = 0; | ||
954 | struct packet *p; | 962 | struct packet *p; |
955 | u_char type, *cp; | 963 | u_char type, *cp; |
956 | 964 | ||
@@ -958,7 +966,7 @@ packet_send2(void) | |||
958 | type = cp[5]; | 966 | type = cp[5]; |
959 | 967 | ||
960 | /* during rekeying we can only send key exchange messages */ | 968 | /* during rekeying we can only send key exchange messages */ |
961 | if (rekeying) { | 969 | if (active_state->rekeying) { |
962 | if (!((type >= SSH2_MSG_TRANSPORT_MIN) && | 970 | if (!((type >= SSH2_MSG_TRANSPORT_MIN) && |
963 | (type <= SSH2_MSG_TRANSPORT_MAX))) { | 971 | (type <= SSH2_MSG_TRANSPORT_MAX))) { |
964 | debug("enqueue packet: %u", type); | 972 | debug("enqueue packet: %u", type); |
@@ -974,13 +982,13 @@ packet_send2(void) | |||
974 | 982 | ||
975 | /* rekeying starts with sending KEXINIT */ | 983 | /* rekeying starts with sending KEXINIT */ |
976 | if (type == SSH2_MSG_KEXINIT) | 984 | if (type == SSH2_MSG_KEXINIT) |
977 | rekeying = 1; | 985 | active_state->rekeying = 1; |
978 | 986 | ||
979 | packet_send2_wrapped(); | 987 | packet_send2_wrapped(); |
980 | 988 | ||
981 | /* after a NEWKEYS message we can send the complete queue */ | 989 | /* after a NEWKEYS message we can send the complete queue */ |
982 | if (type == SSH2_MSG_NEWKEYS) { | 990 | if (type == SSH2_MSG_NEWKEYS) { |
983 | rekeying = 0; | 991 | active_state->rekeying = 0; |
984 | while ((p = TAILQ_FIRST(&active_state->outgoing))) { | 992 | while ((p = TAILQ_FIRST(&active_state->outgoing))) { |
985 | type = p->type; | 993 | type = p->type; |
986 | debug("dequeue packet: %u", type); | 994 | debug("dequeue packet: %u", type); |
@@ -1737,11 +1745,9 @@ packet_set_tos(int interactive) | |||
1737 | void | 1745 | void |
1738 | packet_set_interactive(int interactive) | 1746 | packet_set_interactive(int interactive) |
1739 | { | 1747 | { |
1740 | static int called = 0; | 1748 | if (active_state->set_interactive_called) |
1741 | |||
1742 | if (called) | ||
1743 | return; | 1749 | return; |
1744 | called = 1; | 1750 | active_state->set_interactive_called = 1; |
1745 | 1751 | ||
1746 | /* Record that we are in interactive mode. */ | 1752 | /* Record that we are in interactive mode. */ |
1747 | active_state->interactive_mode = interactive; | 1753 | active_state->interactive_mode = interactive; |
@@ -1764,9 +1770,7 @@ packet_is_interactive(void) | |||
1764 | int | 1770 | int |
1765 | packet_set_maxsize(u_int s) | 1771 | packet_set_maxsize(u_int s) |
1766 | { | 1772 | { |
1767 | static int called = 0; | 1773 | if (active_state->set_maxsize_called) { |
1768 | |||
1769 | if (called) { | ||
1770 | logit("packet_set_maxsize: called twice: old %d new %d", | 1774 | logit("packet_set_maxsize: called twice: old %d new %d", |
1771 | active_state->max_packet_size, s); | 1775 | active_state->max_packet_size, s); |
1772 | return -1; | 1776 | return -1; |
@@ -1775,7 +1779,7 @@ packet_set_maxsize(u_int s) | |||
1775 | logit("packet_set_maxsize: bad size %d", s); | 1779 | logit("packet_set_maxsize: bad size %d", s); |
1776 | return -1; | 1780 | return -1; |
1777 | } | 1781 | } |
1778 | called = 1; | 1782 | active_state->set_maxsize_called = 1; |
1779 | debug("packet_set_maxsize: setting to %d", s); | 1783 | debug("packet_set_maxsize: setting to %d", s); |
1780 | active_state->max_packet_size = s; | 1784 | active_state->max_packet_size = s; |
1781 | return s; | 1785 | return s; |