patch-1.3.7 linux/net/ipv4/udp.c
Next file: linux/net/ipx/af_ipx.c
Previous file: linux/net/ipv4/tcp.c
Back to the patch index
Back to the overall index
- Lines: 44
- Date:
Thu Jul 6 13:22:05 1995
- Orig file:
v1.3.6/linux/net/ipv4/udp.c
- Orig date:
Fri Jun 30 16:22:33 1995
diff -u --recursive --new-file v1.3.6/linux/net/ipv4/udp.c linux/net/ipv4/udp.c
@@ -165,10 +165,9 @@
}
-static unsigned short udp_check(struct udphdr *uh, int len, unsigned long saddr, unsigned long daddr)
+static unsigned short udp_check(struct udphdr *uh, int len, unsigned long saddr, unsigned long daddr, unsigned long base)
{
- return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP,
- csum_partial((char*)uh, len, 0)));
+ return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base));
}
struct udpfakehdr
@@ -204,7 +203,7 @@
src = ufh->from;
dst = to+sizeof(struct udphdr);
}
- ufh->wcheck = csum_partial_copyffs(src, dst, len, ufh->wcheck);
+ ufh->wcheck = csum_partial_copy_fromuser(src, dst, len, ufh->wcheck);
if (offset == 0)
{
ufh->wcheck = csum_partial((char *)ufh, sizeof(struct udphdr),
@@ -243,7 +242,7 @@
src = ufh->from;
dst = to+sizeof(struct udphdr);
}
- memcpy_fromfs(src,dst,len);
+ memcpy_fromfs(dst,src,len);
if (offset == 0)
memcpy(to, ufh, sizeof(struct udphdr));
}
@@ -542,7 +541,11 @@
return(0);
}
- if (uh->check && udp_check(uh, len, saddr, daddr))
+ if (uh->check && (
+ ( skb->ip_summed && udp_check(uh, len, saddr, daddr, skb->csum ) ) ||
+ ( !skb->ip_summed && udp_check(uh, len, saddr, daddr,csum_partial((char*)uh, len, 0)))
+ )
+ )
{
/* <mea@utu.fi> wants to know, who sent it, to
go and stomp on the garbage sender... */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this