summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2004-03-01 02:25:32 +0000
committerColin Watson <cjwatson@debian.org>2004-03-01 02:25:32 +0000
commitea8116a11e3de70036dbc665ccb0d486cf89cac9 (patch)
treed73ccdff78d8608e156465af42e6a1b3527fb2d6 /packet.c
parente39b311381a5609cc05acf298c42fba196dc524b (diff)
parentf5bda272678ec6dccaa5f29379cf60cb855018e8 (diff)
Merge 3.8p1 to the trunk. This builds and runs, but I haven't tested it
extensively yet. ProtocolKeepAlives is now just a compatibility alias for ServerAliveInterval.
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/packet.c b/packet.c
index fd436d56f..f557cd75d 100644
--- a/packet.c
+++ b/packet.c
@@ -37,7 +37,7 @@
37 */ 37 */
38 38
39#include "includes.h" 39#include "includes.h"
40RCSID("$OpenBSD: packet.c,v 1.110 2003/09/19 09:02:02 markus Exp $"); 40RCSID("$OpenBSD: packet.c,v 1.112 2003/09/23 20:17:11 markus Exp $");
41 41
42#include "openbsd-compat/sys-queue.h" 42#include "openbsd-compat/sys-queue.h"
43 43
@@ -168,8 +168,6 @@ packet_set_connection(int fd_in, int fd_out, int new_setup_timeout)
168 buffer_init(&incoming_packet); 168 buffer_init(&incoming_packet);
169 TAILQ_INIT(&outgoing); 169 TAILQ_INIT(&outgoing);
170 } 170 }
171 /* Kludge: arrange the close function to be called from fatal(). */
172 fatal_add_cleanup((void (*) (void *)) packet_close, NULL);
173} 171}
174 172
175/* Returns 1 if remote host is connected via socket, 0 if not. */ 173/* Returns 1 if remote host is connected via socket, 0 if not. */
@@ -309,7 +307,7 @@ packet_connection_is_ipv4(void)
309 if (to.ss_family == AF_INET) 307 if (to.ss_family == AF_INET)
310 return 1; 308 return 1;
311#ifdef IPV4_IN_IPV6 309#ifdef IPV4_IN_IPV6
312 if (to.ss_family == AF_INET6 && 310 if (to.ss_family == AF_INET6 &&
313 IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&to)->sin6_addr)) 311 IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&to)->sin6_addr))
314 return 1; 312 return 1;
315#endif 313#endif
@@ -884,7 +882,7 @@ packet_read_seqnr(u_int32_t *seqnr_p)
884 len = read(connection_in, buf, sizeof(buf)); 882 len = read(connection_in, buf, sizeof(buf));
885 if (len == 0) { 883 if (len == 0) {
886 logit("Connection closed by %.200s", get_remote_ipaddr()); 884 logit("Connection closed by %.200s", get_remote_ipaddr());
887 fatal_cleanup(); 885 cleanup_exit(255);
888 } 886 }
889 if (len < 0) 887 if (len < 0)
890 fatal("Read from socket failed: %.100s", strerror(errno)); 888 fatal("Read from socket failed: %.100s", strerror(errno));
@@ -1150,7 +1148,7 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p)
1150 logit("Received disconnect from %s: %u: %.400s", 1148 logit("Received disconnect from %s: %u: %.400s",
1151 get_remote_ipaddr(), reason, msg); 1149 get_remote_ipaddr(), reason, msg);
1152 xfree(msg); 1150 xfree(msg);
1153 fatal_cleanup(); 1151 cleanup_exit(255);
1154 break; 1152 break;
1155 case SSH2_MSG_UNIMPLEMENTED: 1153 case SSH2_MSG_UNIMPLEMENTED:
1156 seqnr = packet_get_int(); 1154 seqnr = packet_get_int();
@@ -1175,7 +1173,7 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p)
1175 msg = packet_get_string(NULL); 1173 msg = packet_get_string(NULL);
1176 logit("Received disconnect from %s: %.400s", 1174 logit("Received disconnect from %s: %.400s",
1177 get_remote_ipaddr(), msg); 1175 get_remote_ipaddr(), msg);
1178 fatal_cleanup(); 1176 cleanup_exit(255);
1179 xfree(msg); 1177 xfree(msg);
1180 break; 1178 break;
1181 default: 1179 default:
@@ -1352,8 +1350,7 @@ packet_disconnect(const char *fmt,...)
1352 1350
1353 /* Close the connection. */ 1351 /* Close the connection. */
1354 packet_close(); 1352 packet_close();
1355 1353 cleanup_exit(255);
1356 fatal_cleanup();
1357} 1354}
1358 1355
1359/* Checks if there is any buffered output, and tries to write some of the output. */ 1356/* Checks if there is any buffered output, and tries to write some of the output. */
@@ -1420,10 +1417,10 @@ packet_not_very_much_data_to_write(void)
1420} 1417}
1421 1418
1422 1419
1423#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
1424static void 1420static void
1425packet_set_tos(int interactive) 1421packet_set_tos(int interactive)
1426{ 1422{
1423#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
1427 int tos = interactive ? IPTOS_LOWDELAY : IPTOS_THROUGHPUT; 1424 int tos = interactive ? IPTOS_LOWDELAY : IPTOS_THROUGHPUT;
1428 1425
1429 if (!packet_connection_is_on_socket() || 1426 if (!packet_connection_is_on_socket() ||
@@ -1433,8 +1430,8 @@ packet_set_tos(int interactive)
1433 sizeof(tos)) < 0) 1430 sizeof(tos)) < 0)
1434 error("setsockopt IP_TOS %d: %.100s:", 1431 error("setsockopt IP_TOS %d: %.100s:",
1435 tos, strerror(errno)); 1432 tos, strerror(errno));
1436}
1437#endif 1433#endif
1434}
1438 1435
1439/* Informs that the current session is interactive. Sets IP flags for that. */ 1436/* Informs that the current session is interactive. Sets IP flags for that. */
1440 1437
@@ -1455,10 +1452,7 @@ packet_set_interactive(int interactive)
1455 return; 1452 return;
1456 if (interactive) 1453 if (interactive)
1457 set_nodelay(connection_in); 1454 set_nodelay(connection_in);
1458#if defined(IP_TOS) && !defined(IP_TOS_IS_BROKEN)
1459 packet_set_tos(interactive); 1455 packet_set_tos(interactive);
1460#endif
1461
1462} 1456}
1463 1457
1464/* Returns true if the current connection is interactive. */ 1458/* Returns true if the current connection is interactive. */