aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpc.c
diff options
context:
space:
mode:
authorBaruch Siach <baruch@tkos.co.il>2011-09-07 17:52:37 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-09-07 17:55:40 +0200
commite8f36330d9bb27f9f7e66aa6f01ff92c07d86f62 (patch)
tree863018163a166cc690902d8027a3f04f9f812dd3 /networking/udhcp/dhcpc.c
parent8c84f7545cf08925edb23d94d9f6519b338267c6 (diff)
downloadbusybox-w32-e8f36330d9bb27f9f7e66aa6f01ff92c07d86f62.tar.gz
busybox-w32-e8f36330d9bb27f9f7e66aa6f01ff92c07d86f62.tar.bz2
busybox-w32-e8f36330d9bb27f9f7e66aa6f01ff92c07d86f62.zip
networking: consolidate the IP checksum code. -129 bytes.
Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r--networking/udhcp/dhcpc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 4d755e6b8..3be09f4d7 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -739,7 +739,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
739 /* verify IP checksum */ 739 /* verify IP checksum */
740 check = packet.ip.check; 740 check = packet.ip.check;
741 packet.ip.check = 0; 741 packet.ip.check = 0;
742 if (check != udhcp_checksum(&packet.ip, sizeof(packet.ip))) { 742 if (check != inet_cksum((uint16_t *)&packet.ip, sizeof(packet.ip))) {
743 log1("Bad IP header checksum, ignoring"); 743 log1("Bad IP header checksum, ignoring");
744 return -2; 744 return -2;
745 } 745 }
@@ -750,7 +750,7 @@ static NOINLINE int udhcp_recv_raw_packet(struct dhcp_packet *dhcp_pkt, int fd)
750 packet.ip.tot_len = packet.udp.len; /* yes, this is needed */ 750 packet.ip.tot_len = packet.udp.len; /* yes, this is needed */
751 check = packet.udp.check; 751 check = packet.udp.check;
752 packet.udp.check = 0; 752 packet.udp.check = 0;
753 if (check && check != udhcp_checksum(&packet, bytes)) { 753 if (check && check != inet_cksum((uint16_t *)&packet, bytes)) {
754 log1("Packet with bad UDP checksum received, ignoring"); 754 log1("Packet with bad UDP checksum received, ignoring");
755 return -2; 755 return -2;
756 } 756 }