From: flu0r1ne Date: Thu, 7 May 2026 20:03:48 +0000 (+0400) Subject: packet: rename shared UDP checksum helper X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F581%2Fhead;p=thirdparty%2Fmtr.git packet: rename shared UDP checksum helper --- diff --git a/packet/construct_unix.c b/packet/construct_unix.c index f86fd52..29cac31 100644 --- a/packet/construct_unix.c +++ b/packet/construct_unix.c @@ -175,8 +175,8 @@ void set_udp_ports( /* Prepend pseudoheader to the udp datagram and calculate checksum */ static -int udp4_checksum(void *pheader, void *udata, int psize, int dsize, - int alt_checksum) +int udp_checksum(void *pheader, void *udata, int psize, int dsize, + int alt_checksum) { unsigned int totalsize = psize + dsize; unsigned char csumpacket[totalsize]; @@ -234,7 +234,7 @@ int construct_udp4_packet( udp_size + sizeof(struct UDPHeader)]; } - *checksum_off = htons(udp4_checksum(&udph, udp, + *checksum_off = htons(udp_checksum(&udph, udp, sizeof(struct UDPPseudoHeader), udp_size, udp->checksum != 0)); @@ -277,7 +277,7 @@ int construct_udp6_packet( checksum_off is udp payload */ checksum_off = (uint16_t *)&packet_buffer[sizeof(struct UDPHeader)]; } - *checksum_off = htons(udp4_checksum(&udph, udp, + *checksum_off = htons(udp_checksum(&udph, udp, sizeof(struct IP6PseudoHeader), udp_size, udp->checksum != 0)); return 0;