summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/packet.c b/packet.c
index 36e352b44..817da43b5 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.283 2019/03/01 03:29:32 djm Exp $ */ 1/* $OpenBSD: packet.c,v 1.286 2019/06/28 13:35:04 deraadt 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
@@ -77,7 +77,6 @@
77#include <zlib.h> 77#include <zlib.h>
78 78
79#include "xmalloc.h" 79#include "xmalloc.h"
80#include "crc32.h"
81#include "compat.h" 80#include "compat.h"
82#include "ssh2.h" 81#include "ssh2.h"
83#include "cipher.h" 82#include "cipher.h"
@@ -297,7 +296,7 @@ ssh_packet_set_connection(struct ssh *ssh, int fd_in, int fd_out)
297 if (ssh == NULL) 296 if (ssh == NULL)
298 ssh = ssh_alloc_session_state(); 297 ssh = ssh_alloc_session_state();
299 if (ssh == NULL) { 298 if (ssh == NULL) {
300 error("%s: cound not allocate state", __func__); 299 error("%s: could not allocate state", __func__);
301 return NULL; 300 return NULL;
302 } 301 }
303 state = ssh->state; 302 state = ssh->state;
@@ -441,12 +440,12 @@ ssh_packet_connection_is_on_socket(struct ssh *ssh)
441 fromlen = sizeof(from); 440 fromlen = sizeof(from);
442 memset(&from, 0, sizeof(from)); 441 memset(&from, 0, sizeof(from));
443 if (getpeername(state->connection_in, (struct sockaddr *)&from, 442 if (getpeername(state->connection_in, (struct sockaddr *)&from,
444 &fromlen) < 0) 443 &fromlen) == -1)
445 return 0; 444 return 0;
446 tolen = sizeof(to); 445 tolen = sizeof(to);
447 memset(&to, 0, sizeof(to)); 446 memset(&to, 0, sizeof(to));
448 if (getpeername(state->connection_out, (struct sockaddr *)&to, 447 if (getpeername(state->connection_out, (struct sockaddr *)&to,
449 &tolen) < 0) 448 &tolen) == -1)
450 return 0; 449 return 0;
451 if (fromlen != tolen || memcmp(&from, &to, fromlen) != 0) 450 if (fromlen != tolen || memcmp(&from, &to, fromlen) != 0)
452 return 0; 451 return 0;
@@ -472,7 +471,7 @@ ssh_packet_connection_af(struct ssh *ssh)
472 471
473 memset(&to, 0, sizeof(to)); 472 memset(&to, 0, sizeof(to));
474 if (getsockname(ssh->state->connection_out, (struct sockaddr *)&to, 473 if (getsockname(ssh->state->connection_out, (struct sockaddr *)&to,
475 &tolen) < 0) 474 &tolen) == -1)
476 return 0; 475 return 0;
477#ifdef IPV4_IN_IPV6 476#ifdef IPV4_IN_IPV6
478 if (to.ss_family == AF_INET6 && 477 if (to.ss_family == AF_INET6 &&
@@ -1360,7 +1359,7 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
1360 r = SSH_ERR_CONN_CLOSED; 1359 r = SSH_ERR_CONN_CLOSED;
1361 goto out; 1360 goto out;
1362 } 1361 }
1363 if (len < 0) { 1362 if (len == -1) {
1364 r = SSH_ERR_SYSTEM_ERROR; 1363 r = SSH_ERR_SYSTEM_ERROR;
1365 goto out; 1364 goto out;
1366 } 1365 }
@@ -2037,7 +2036,7 @@ ssh_packet_set_tos(struct ssh *ssh, int tos)
2037 case AF_INET: 2036 case AF_INET:
2038 debug3("%s: set IP_TOS 0x%02x", __func__, tos); 2037 debug3("%s: set IP_TOS 0x%02x", __func__, tos);
2039 if (setsockopt(ssh->state->connection_in, 2038 if (setsockopt(ssh->state->connection_in,
2040 IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) 2039 IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == -1)
2041 error("setsockopt IP_TOS %d: %.100s:", 2040 error("setsockopt IP_TOS %d: %.100s:",
2042 tos, strerror(errno)); 2041 tos, strerror(errno));
2043 break; 2042 break;
@@ -2046,7 +2045,7 @@ ssh_packet_set_tos(struct ssh *ssh, int tos)
2046 case AF_INET6: 2045 case AF_INET6:
2047 debug3("%s: set IPV6_TCLASS 0x%02x", __func__, tos); 2046 debug3("%s: set IPV6_TCLASS 0x%02x", __func__, tos);
2048 if (setsockopt(ssh->state->connection_in, 2047 if (setsockopt(ssh->state->connection_in,
2049 IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)) < 0) 2048 IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)) == -1)
2050 error("setsockopt IPV6_TCLASS %d: %.100s:", 2049 error("setsockopt IPV6_TCLASS %d: %.100s:",
2051 tos, strerror(errno)); 2050 tos, strerror(errno));
2052 break; 2051 break;