Skip to content

Commit

Permalink
udp4_checksum -> udp_checksum (also used for ipv6)
Browse files Browse the repository at this point in the history
`udp4_checksum` is also used to checksum udp over ipv6.
  • Loading branch information
flu0r1ne committed Oct 3, 2023
1 parent 0b34810 commit 94362ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packet/construct_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ 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 udp_checksum(void *pheader, void *udata, int psize, int dsize,
int alt_checksum)
{
unsigned int totalsize = psize + dsize;
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -276,7 +276,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;
Expand Down

0 comments on commit 94362ed

Please sign in to comment.