diff options
-rw-r--r-- | common-session.c | 2 | ||||
-rw-r--r-- | netio.c | 8 | ||||
-rw-r--r-- | packet.c | 15 | ||||
-rw-r--r-- | packet.h | 2 |
4 files changed, 10 insertions, 17 deletions
diff --git a/common-session.c b/common-session.c index 037a78d..41bf5b3 100644 --- a/common-session.c +++ b/common-session.c @@ -346,7 +346,7 @@ void session_cleanup() { void send_session_identification() { buffer *writebuf = buf_new(strlen(LOCAL_IDENT "\r\n") + 1); buf_putbytes(writebuf, (const unsigned char *) LOCAL_IDENT "\r\n", strlen(LOCAL_IDENT "\r\n")); - writebuf_enqueue(writebuf, 0); + writebuf_enqueue(writebuf); } static void read_session_identification() { @@ -306,10 +306,10 @@ void packet_queue_to_iovec(const struct Queue *queue, struct iovec *iov, unsigne for (l = queue->head, i = 0; i < *iov_count; l = l->link, i++) { writebuf = (buffer*)l->item; - len = writebuf->len - 1 - writebuf->pos; + len = writebuf->len - writebuf->pos; dropbear_assert(len > 0); - TRACE2(("write_packet writev #%d type %d len %d/%d", i, writebuf->data[writebuf->len-1], - len, writebuf->len-1)) + TRACE2(("write_packet writev #%d len %d/%d", i, + len, writebuf->len)) iov[i].iov_base = buf_getptr(writebuf, len); iov[i].iov_len = len; } @@ -320,7 +320,7 @@ void packet_queue_consume(struct Queue *queue, ssize_t written) { int len; while (written > 0) { writebuf = (buffer*)examine(queue); - len = writebuf->len - 1 - writebuf->pos; + len = writebuf->len - writebuf->pos; if (len > written) { /* partial buffer write */ buf_incrpos(writebuf, written); @@ -65,7 +65,6 @@ void write_packet() { #else int len; buffer* writebuf; - int packet_type; #endif TRACE2(("enter write_packet")) @@ -113,10 +112,7 @@ void write_packet() { /* The last byte of the buffer is not to be transmitted, but is * a cleartext packet_type indicator */ - packet_type = writebuf->data[writebuf->len-1]; - len = writebuf->len - 1 - writebuf->pos; - TRACE2(("write_packet type %d len %d/%d", packet_type, - len, writebuf->len-1)) + len = writebuf->len - writebuf->pos; dropbear_assert(len > 0); /* Try to write as much as possible */ written = write(ses.sock_out, buf_getptr(writebuf, len), len); @@ -604,7 +600,7 @@ void encrypt_packet() { /* Update counts */ ses.kexstate.datatrans += writebuf->len; - writebuf_enqueue(writebuf, packet_type); + writebuf_enqueue(writebuf); /* Update counts */ ses.transseq++; @@ -624,14 +620,11 @@ void encrypt_packet() { TRACE2(("leave encrypt_packet()")) } -void writebuf_enqueue(buffer * writebuf, unsigned char packet_type) { - /* The last byte of the buffer stores the cleartext packet_type. It is not - * transmitted but is used for transmit timeout purposes */ - buf_putbyte(writebuf, packet_type); +void writebuf_enqueue(buffer * writebuf) { /* enqueue the packet for sending. It will get freed after transmission. */ buf_setpos(writebuf, 0); enqueue(&ses.writequeue, (void*)writebuf); - ses.writequeue_len += writebuf->len-1; + ses.writequeue_len += writebuf->len; } @@ -35,7 +35,7 @@ void read_packet(void); void decrypt_packet(void); void encrypt_packet(void); -void writebuf_enqueue(buffer * writebuf, unsigned char packet_type); +void writebuf_enqueue(buffer * writebuf); void process_packet(void); |