aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/dccp.h
diff options
context:
space:
mode:
authorAndrea Bittau <a.bittau@cs.ucl.ac.uk>2006-03-20 22:23:32 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-20 22:23:32 -0500
commit60fe62e789076ae7c13f7ffb35fec4b24802530d (patch)
treecc8d507a4276c3d5a2bcb72746660d485bc2e045 /net/dccp/dccp.h
parenta193a4abdd1f742a57f3f70b6a83c3e536876e97 (diff)
[DCCP]: sparse endianness annotations
This also fixes the layout of dccp_hdr short sequence numbers, problem was not fatal now as we only support long (48 bits) sequence numbers. Signed-off-by: Andrea Bittau <a.bittau@cs.ucl.ac.uk> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/dccp.h')
-rw-r--r--net/dccp/dccp.h23
1 files changed, 6 insertions, 17 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 93f26dd6e6cb..1764adb4f15e 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -262,7 +262,7 @@ extern int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
262 int addr_len); 262 int addr_len);
263 263
264extern int dccp_v4_checksum(const struct sk_buff *skb, 264extern int dccp_v4_checksum(const struct sk_buff *skb,
265 const u32 saddr, const u32 daddr); 265 const __be32 saddr, const __be32 daddr);
266 266
267extern int dccp_v4_send_reset(struct sock *sk, 267extern int dccp_v4_send_reset(struct sock *sk,
268 enum dccp_reset_codes code); 268 enum dccp_reset_codes code);
@@ -270,7 +270,7 @@ extern void dccp_send_close(struct sock *sk, const int active);
270extern int dccp_invalid_packet(struct sk_buff *skb); 270extern int dccp_invalid_packet(struct sk_buff *skb);
271 271
272static inline int dccp_bad_service_code(const struct sock *sk, 272static inline int dccp_bad_service_code(const struct sock *sk,
273 const __u32 service) 273 const __be32 service)
274{ 274{
275 const struct dccp_sock *dp = dccp_sk(sk); 275 const struct dccp_sock *dp = dccp_sk(sk);
276 276
@@ -334,27 +334,16 @@ static inline void dccp_hdr_set_seq(struct dccp_hdr *dh, const u64 gss)
334{ 334{
335 struct dccp_hdr_ext *dhx = (struct dccp_hdr_ext *)((void *)dh + 335 struct dccp_hdr_ext *dhx = (struct dccp_hdr_ext *)((void *)dh +
336 sizeof(*dh)); 336 sizeof(*dh));
337 337 dh->dccph_seq2 = 0;
338#if defined(__LITTLE_ENDIAN_BITFIELD) 338 dh->dccph_seq = htons((gss >> 32) & 0xfffff);
339 dh->dccph_seq = htonl((gss >> 32)) >> 8;
340#elif defined(__BIG_ENDIAN_BITFIELD)
341 dh->dccph_seq = htonl((gss >> 32));
342#else
343#error "Adjust your <asm/byteorder.h> defines"
344#endif
345 dhx->dccph_seq_low = htonl(gss & 0xffffffff); 339 dhx->dccph_seq_low = htonl(gss & 0xffffffff);
346} 340}
347 341
348static inline void dccp_hdr_set_ack(struct dccp_hdr_ack_bits *dhack, 342static inline void dccp_hdr_set_ack(struct dccp_hdr_ack_bits *dhack,
349 const u64 gsr) 343 const u64 gsr)
350{ 344{
351#if defined(__LITTLE_ENDIAN_BITFIELD) 345 dhack->dccph_reserved1 = 0;
352 dhack->dccph_ack_nr_high = htonl((gsr >> 32)) >> 8; 346 dhack->dccph_ack_nr_high = htons(gsr >> 32);
353#elif defined(__BIG_ENDIAN_BITFIELD)
354 dhack->dccph_ack_nr_high = htonl((gsr >> 32));
355#else
356#error "Adjust your <asm/byteorder.h> defines"
357#endif
358 dhack->dccph_ack_nr_low = htonl(gsr & 0xffffffff); 347 dhack->dccph_ack_nr_low = htonl(gsr & 0xffffffff);
359} 348}
360 349