Mercurial > dropbear
changeset 1577:399d8eb961b5
get rid of unused packet_type in encrypted write queue
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 04 Mar 2018 14:57:18 +0800 |
parents | 0c8c2552b2f2 |
children | fdadac70ee67 |
files | common-session.c netio.c packet.c packet.h |
diffstat | 4 files changed, 10 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/common-session.c Sat Mar 03 11:11:04 2018 +0800 +++ b/common-session.c Sun Mar 04 14:57:18 2018 +0800 @@ -346,7 +346,7 @@ 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() {
--- a/netio.c Sat Mar 03 11:11:04 2018 +0800 +++ b/netio.c Sun Mar 04 14:57:18 2018 +0800 @@ -306,10 +306,10 @@ 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 @@ 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);
--- a/packet.c Sat Mar 03 11:11:04 2018 +0800 +++ b/packet.c Sun Mar 04 14:57:18 2018 +0800 @@ -65,7 +65,6 @@ #else int len; buffer* writebuf; - int packet_type; #endif TRACE2(("enter write_packet")) @@ -113,10 +112,7 @@ /* 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 @@ /* Update counts */ ses.kexstate.datatrans += writebuf->len; - writebuf_enqueue(writebuf, packet_type); + writebuf_enqueue(writebuf); /* Update counts */ ses.transseq++; @@ -624,14 +620,11 @@ 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; }
--- a/packet.h Sat Mar 03 11:11:04 2018 +0800 +++ b/packet.h Sun Mar 04 14:57:18 2018 +0800 @@ -35,7 +35,7 @@ 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);