=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/packet.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- src/usr.bin/ssh/packet.c 2001/12/19 17:16:13 1.76 +++ src/usr.bin/ssh/packet.c 2001/12/20 22:50:24 1.77 @@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.76 2001/12/19 17:16:13 stevesk Exp $"); +RCSID("$OpenBSD: packet.c,v 1.77 2001/12/20 22:50:24 djm Exp $"); #include "xmalloc.h" #include "buffer.h" @@ -610,7 +610,7 @@ */ int -packet_read(int *payload_len_ptr) +packet_read_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p) { int type, len; fd_set *setp; @@ -626,7 +626,7 @@ /* Stay in the loop until we have received a complete packet. */ for (;;) { /* Try to read a packet from the buffer. */ - type = packet_read_poll(payload_len_ptr); + type = packet_read_poll_seqnr(payload_len_ptr, seqnr_p); if (!compat20 && ( type == SSH_SMSG_SUCCESS || type == SSH_SMSG_FAILURE @@ -665,6 +665,12 @@ /* NOTREACHED */ } +int +packet_read(int *payload_len_ptr) +{ + return packet_read_seqnr(payload_len_ptr, NULL); +} + /* * Waits until a packet has been received, verifies that its type matches * that given, and gives a fatal error and exits if there is a mismatch. @@ -753,7 +759,7 @@ /* Test check bytes. */ if (len != buffer_len(&incoming_packet)) - packet_disconnect("packet_read_poll: len %d != buffer_len %d.", + packet_disconnect("packet_read_poll1: len %d != buffer_len %d.", len, buffer_len(&incoming_packet)); ucp = (u_char *) buffer_ptr(&incoming_packet) + len - 4; @@ -775,7 +781,7 @@ } static int -packet_read_poll2(int *payload_len_ptr) +packet_read_poll2(int *payload_len_ptr, u_int32_t *seqnr_p) { static u_int32_t seqnr = 0; static u_int packet_length = 0; @@ -848,6 +854,8 @@ DBG(debug("MAC #%d ok", seqnr)); buffer_consume(&input, mac->mac_len); } + if (seqnr_p != NULL) + *seqnr_p = seqnr; if (++seqnr == 0) log("incoming seqnr wraps around"); @@ -890,7 +898,7 @@ } int -packet_read_poll(int *payload_len_ptr) +packet_read_poll_seqnr(int *payload_len_ptr, u_int32_t *seqnr_p) { int reason; u_char type; @@ -898,7 +906,7 @@ for (;;) { if (compat20) { - type = packet_read_poll2(payload_len_ptr); + type = packet_read_poll2(payload_len_ptr, seqnr_p); if (type) DBG(debug("received packet type %d", type)); switch (type) { @@ -949,6 +957,12 @@ } } } +} + +int +packet_read_poll(int *payload_len_ptr) +{ + return packet_read_poll_seqnr(payload_len_ptr, NULL); } /*