brain_wraps_around_on_endian.patch

Dave Täht, 04/15/2012 01:58 pm

Download (781 Bytes)

 
b/include/linux/tcp.h
21 21
#include <asm/byteorder.h>
22 22
#include <linux/socket.h>
23 23

  
24
struct tcphdr_unaligned {
25
	__be16	source;
26
	__be16	dest;
27
	__be32	seq;
28
	__be32	ack_seq;
29
#if defined(__LITTLE_ENDIAN_BITFIELD)
30
	__u8	res1:4,
31
		doff:4,
32
	__u8	fin:1,
33
		syn:1,
34
		rst:1,
35
		psh:1,
36
		ack:1,
37
		urg:1,
38
		ece:1,
39
		cwr:1;
40
#elif defined(__BIG_ENDIAN_BITFIELD)
41
	__u8	doff:4,
42
		res1:4,
43
	__u8	cwr:1,
44
		ece:1,
45
		urg:1,
46
		ack:1,
47
		psh:1,
48
		rst:1,
49
		syn:1,
50
		fin:1;
51
#else
52
#error	"Adjust your <asm/byteorder.h> defines"
53
#endif	
54
	__be16	window;
55
	__sum16	check;
56
	__be16	urg_ptr;
57
} __packed;
58

  
24 59
struct tcphdr {
25 60
	__be16	source;
26 61
	__be16	dest;