aboutgitcodebugslistschat
path: root/icmp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-03-28 16:56:01 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-03-29 15:35:38 +0200
commit37c228ada88b7fa0001659b13c34a783ba75df83 (patch)
tree8322a8de553fdf30f89fed48e985547316a01964 /icmp.c
parent1f4b7fa0d75d25f518047e77c88718ec1cc3f5bb (diff)
downloadpasst-37c228ada88b7fa0001659b13c34a783ba75df83.tar
passt-37c228ada88b7fa0001659b13c34a783ba75df83.tar.gz
passt-37c228ada88b7fa0001659b13c34a783ba75df83.tar.bz2
passt-37c228ada88b7fa0001659b13c34a783ba75df83.tar.lz
passt-37c228ada88b7fa0001659b13c34a783ba75df83.tar.xz
passt-37c228ada88b7fa0001659b13c34a783ba75df83.tar.zst
passt-37c228ada88b7fa0001659b13c34a783ba75df83.zip
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 <sbrivio@redhat.com>
Diffstat (limited to 'icmp.c')
-rw-r--r--icmp.c12
1 files changed, 10 insertions, 2 deletions
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;
}