aboutgitcodebugslistschat
path: root/icmp.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-08-11 15:12:24 +1000
committerStefano Brivio <sbrivio@redhat.com>2023-08-13 17:30:07 +0200
commit05f606ab0b85fdca083e1dfe71331353c4efe02e (patch)
treec06872fba9b364532642d5b15d6acd58e07532f7 /icmp.h
parentd850caab66190678d15b968052116e2570e9ffe1 (diff)
downloadpasst-05f606ab0b85fdca083e1dfe71331353c4efe02e.tar
passt-05f606ab0b85fdca083e1dfe71331353c4efe02e.tar.gz
passt-05f606ab0b85fdca083e1dfe71331353c4efe02e.tar.bz2
passt-05f606ab0b85fdca083e1dfe71331353c4efe02e.tar.lz
passt-05f606ab0b85fdca083e1dfe71331353c4efe02e.tar.xz
passt-05f606ab0b85fdca083e1dfe71331353c4efe02e.tar.zst
passt-05f606ab0b85fdca083e1dfe71331353c4efe02e.zip
epoll: Split handling of ICMP and ICMPv6 sockets
We have different epoll type values for ICMP and ICMPv6 sockets, but they both call the same handler function, icmp_sock_handler(). However that function does essentially nothing in common for the two cases. So, split it into icmp_sock_handler() and icmpv6_sock_handler() and dispatch them separately from the top level. While we're there remove some parameters that the function was never using anyway. Also move the test for c->no_icmp into the functions, so that all the logic specific to ICMP is within the handler, rather than in the top level dispatch code. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'icmp.h')
-rw-r--r--icmp.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/icmp.h b/icmp.h
index 29c7829..32f0c47 100644
--- a/icmp.h
+++ b/icmp.h
@@ -10,8 +10,8 @@
struct ctx;
-void icmp_sock_handler(const struct ctx *c, union epoll_ref ref,
- uint32_t events, const struct timespec *now);
+void icmp_sock_handler(const struct ctx *c, union epoll_ref ref);
+void icmpv6_sock_handler(const struct ctx *c, union epoll_ref ref);
int icmp_tap_handler(const struct ctx *c, int af, const void *addr,
const struct pool *p, const struct timespec *now);
void icmp_timer(const struct ctx *c, const struct timespec *ts);
@@ -24,10 +24,7 @@ void icmp_init(void);
* @id: Associated echo identifier, needed if bind() fails
*/
union icmp_epoll_ref {
- struct {
- uint32_t v6:1,
- id:16;
- };
+ uint16_t id;
uint32_t u32;
};