projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-x86 into next
[oweals/u-boot.git]
/
net
/
net.c
diff --git
a/net/net.c
b/net/net.c
index 5114364edd8b544886ab356efe8d4185cdbc9ce8..5199d679a1fbfc9c3d24d3d0577d7e5a375fe4f4 100644
(file)
--- a/
net/net.c
+++ b/
net/net.c
@@
-1271,7
+1271,7
@@
void net_process_received_packet(uchar *in_packet, int len)
#ifdef CONFIG_UDP_CHECKSUM
if (ip->udp_xsum != 0) {
ulong xsum;
#ifdef CONFIG_UDP_CHECKSUM
if (ip->udp_xsum != 0) {
ulong xsum;
- u
short
*sumptr;
+ u
8
*sumptr;
ushort sumlen;
xsum = ip->ip_p;
ushort sumlen;
xsum = ip->ip_p;
@@
-1282,22
+1282,16
@@
void net_process_received_packet(uchar *in_packet, int len)
xsum += (ntohl(ip->ip_dst.s_addr) >> 0) & 0x0000ffff;
sumlen = ntohs(ip->udp_len);
xsum += (ntohl(ip->ip_dst.s_addr) >> 0) & 0x0000ffff;
sumlen = ntohs(ip->udp_len);
- sumptr = (u
short *)&(ip->udp_src)
;
+ sumptr = (u
8 *)&ip->udp_src
;
while (sumlen > 1) {
while (sumlen > 1) {
- ushort sumdata;
-
- sumdata = *sumptr++;
- xsum += ntohs(sumdata);
+ /* inlined ntohs() to avoid alignment errors */
+ xsum += (sumptr[0] << 8) + sumptr[1];
+ sumptr += 2;
sumlen -= 2;
}
sumlen -= 2;
}
- if (sumlen > 0) {
- ushort sumdata;
-
- sumdata = *(unsigned char *)sumptr;
- sumdata = (sumdata << 8) & 0xff00;
- xsum += sumdata;
- }
+ if (sumlen > 0)
+ xsum += (sumptr[0] << 8) + sumptr[0];
while ((xsum >> 16) != 0) {
xsum = (xsum & 0x0000ffff) +
((xsum >> 16) & 0x0000ffff);
while ((xsum >> 16) != 0) {
xsum = (xsum & 0x0000ffff) +
((xsum >> 16) & 0x0000ffff);