summaryrefslogtreecommitdiff
path: root/programs/test/udp_proxy.c
diff options
context:
space:
mode:
authorJames Cowgill <jcowgill@debian.org>2019-07-15 23:18:37 +0100
committerJames Cowgill <jcowgill@debian.org>2019-07-15 23:18:37 +0100
commit2c7d90ebef0679ed3c93b0d005f89757b1930612 (patch)
tree8f24957b4087d46d1bbdbfbf12aa052334b9bcd6 /programs/test/udp_proxy.c
parentae586eb8daaff60d7a0214d6d3e9a3dce480c872 (diff)
parentd81c11b8ab61fd5b2da8133aa73c5fe33a0633eb (diff)
Update to upstream 2.16.2
[git-debrebase anchor: new upstream 2.16.2, merge]
Diffstat (limited to 'programs/test/udp_proxy.c')
-rw-r--r--programs/test/udp_proxy.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/programs/test/udp_proxy.c b/programs/test/udp_proxy.c
index 41739d05..e96e91bf 100644
--- a/programs/test/udp_proxy.c
+++ b/programs/test/udp_proxy.c
@@ -598,32 +598,17 @@ int send_delayed()
static unsigned char dropped[2048] = { 0 };
#define DROP_MAX 2
-/*
- * OpenSSL groups packets in a datagram the first time it sends them, but not
- * when it resends them. Count every record as seen the first time.
- */
+/* We only drop packets at the level of entire datagrams, not at the level
+ * of records. In particular, if the peer changes the way it packs multiple
+ * records into a single datagram, we don't necessarily count the number of
+ * times a record has been dropped correctly. However, the only known reason
+ * why a peer would change datagram packing is disabling the latter on
+ * retransmission, in which case we'd drop involved records at most
+ * DROP_MAX + 1 times. */
void update_dropped( const packet *p )
{
size_t id = p->len % sizeof( dropped );
- const unsigned char *end = p->buf + p->len;
- const unsigned char *cur = p->buf;
- size_t len = ( ( cur[11] << 8 ) | cur[12] ) + 13;
-
++dropped[id];
-
- /* Avoid counting single record twice */
- if( len == p->len )
- return;
-
- while( cur < end )
- {
- len = ( ( cur[11] << 8 ) | cur[12] ) + 13;
-
- id = len % sizeof( dropped );
- ++dropped[id];
-
- cur += len;
- }
}
int handle_message( const char *way,