From a325121759ad5a78bd79749f0a520d2ebfb72120 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 16 Jan 2024 16:16:15 +1100 Subject: icmp: Consolidate icmp_sock_handler() with icmpv6_sock_handler() Currently we have separate handlers for ICMP and ICMPv6 ping replies. Although there are a number of points of difference, with some creative refactoring we can combine these together sensibly. Although it doesn't save a vast amount of code, it does make it clearer that we're performing basically the same steps for each case. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- passt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'passt.c') diff --git a/passt.c b/passt.c index d315438..44d3a0b 100644 --- a/passt.c +++ b/passt.c @@ -392,10 +392,10 @@ loop: udp_sock_handler(&c, ref, eventmask, &now); break; case EPOLL_TYPE_ICMP: - icmp_sock_handler(&c, ref); + icmp_sock_handler(&c, AF_INET, ref); break; case EPOLL_TYPE_ICMPV6: - icmpv6_sock_handler(&c, ref); + icmp_sock_handler(&c, AF_INET6, ref); break; default: /* Can't happen */ -- cgit v1.2.3