diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-03 03:28:23 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-11-05 17:11:25 -0500 |
commit | 02e60370d4dac83f22d5ae75d5512bcb9a3f24b7 (patch) | |
tree | 3952d784c9d7c061a5ff7c0e23277783f10e55d2 /net/ipx/ipx_route.c | |
parent | 4833ed094097323f5f219820f6ebdc8dd66f501f (diff) |
[IPX]: Annotate and fix IPX checksum
Calculation of IPX checksum got buggered about 2.4.0. The old variant
mangled the packet; that got fixed, but calculation itself got buggered.
Restored the correct logics, fixed a subtle breakage we used to have even
back then: if the sum is 0 mod 0xffff, we want to return 0, not 0xffff.
The latter has special meaning for IPX (cheksum disabled). Observation
(and obvious fix) nicked from history of FreeBSD ipx_cksum.c...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipx/ipx_route.c')
-rw-r--r-- | net/ipx/ipx_route.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipx/ipx_route.c b/net/ipx/ipx_route.c index 8bfaefaf8841..68560ee0d797 100644 --- a/net/ipx/ipx_route.c +++ b/net/ipx/ipx_route.c | |||
@@ -19,7 +19,7 @@ DEFINE_RWLOCK(ipx_routes_lock); | |||
19 | 19 | ||
20 | extern struct ipx_interface *ipx_internal_net; | 20 | extern struct ipx_interface *ipx_internal_net; |
21 | 21 | ||
22 | extern __u16 ipx_cksum(struct ipxhdr *packet, int length); | 22 | extern __be16 ipx_cksum(struct ipxhdr *packet, int length); |
23 | extern struct ipx_interface *ipxitf_find_using_net(__be32 net); | 23 | extern struct ipx_interface *ipxitf_find_using_net(__be32 net); |
24 | extern int ipxitf_demux_socket(struct ipx_interface *intrfc, | 24 | extern int ipxitf_demux_socket(struct ipx_interface *intrfc, |
25 | struct sk_buff *skb, int copy); | 25 | struct sk_buff *skb, int copy); |
@@ -238,7 +238,7 @@ int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, | |||
238 | 238 | ||
239 | /* Apply checksum. Not allowed on 802.3 links. */ | 239 | /* Apply checksum. Not allowed on 802.3 links. */ |
240 | if (sk->sk_no_check || intrfc->if_dlink_type == htons(IPX_FRAME_8023)) | 240 | if (sk->sk_no_check || intrfc->if_dlink_type == htons(IPX_FRAME_8023)) |
241 | ipx->ipx_checksum = 0xFFFF; | 241 | ipx->ipx_checksum = htons(0xFFFF); |
242 | else | 242 | else |
243 | ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr)); | 243 | ipx->ipx_checksum = ipx_cksum(ipx, len + sizeof(struct ipxhdr)); |
244 | 244 | ||