1
0
Fork 0
mirror of https://passt.top/passt synced 2025-05-28 04:17:20 +02:00

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 <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2024-01-16 16:16:15 +11:00 committed by Stefano Brivio
parent 70d43f9c05
commit a325121759
3 changed files with 37 additions and 59 deletions

View file

@ -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 */