From 37c228ada88b7fa0001659b13c34a783ba75df83 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Mon, 28 Mar 2022 16:56:01 +0200 Subject: tap, tcp, udp, icmp: Cut down on some oversized buffers The existing sizes provide no measurable differences in throughput and packet rates at this point. They were probably needed as batched implementations were not complete, but they can be decreased quite a bit now. Signed-off-by: Stefano Brivio --- icmp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'icmp.c') diff --git a/icmp.c b/icmp.c index 94093d2..0eb5bfe 100644 --- a/icmp.c +++ b/icmp.c @@ -43,13 +43,13 @@ /** * struct icmp_id_sock - Tracking information for single ICMP echo identifier * @sock: Bound socket for identifier - * @ts: Last associated activity from tap, seconds * @seq: Last sequence number sent to tap, host order + * @ts: Last associated activity from tap, seconds */ struct icmp_id_sock { int sock; - time_t ts; uint16_t seq; + time_t ts; }; /* Indexed by ICMP echo identifier */ @@ -168,6 +168,10 @@ int icmp_tap_handler(const struct ctx *c, int af, const void *addr, s = sock_l4(c, AF_INET, IPPROTO_ICMP, id, 0, iref.u32); if (s < 0) goto fail_sock; + if (s > SOCKET_MAX) { + close(s); + return 1; + } icmp_id_map[V4][id].sock = s; } @@ -201,6 +205,10 @@ int icmp_tap_handler(const struct ctx *c, int af, const void *addr, iref.u32); if (s < 0) goto fail_sock; + if (s > SOCKET_MAX) { + close(s); + return 1; + } icmp_id_map[V6][id].sock = s; } -- cgit v1.2.3