igmp_tcp_alignment.patch

igmp* packed, tcp_parse_aligned_timestamp handles unaligned timestamps - Robert Bradley, 04/15/2012 05:46 pm

Download (1.6 kB)

 
b/include/linux/igmp.h
32 32
	__u8 code;		/* For newer IGMP */
33 33
	__sum16 csum;
34 34
	__be32 group;
35
};
35
} __packed;
36 36

  
37 37
/* V3 group record types [grec_type] */
38 38
#define IGMPV3_MODE_IS_INCLUDE		1
......
48 48
	__be16	grec_nsrcs;
49 49
	__be32	grec_mca;
50 50
	__be32	grec_src[0];
51
};
51
} __packed;
52 52

  
53 53
struct igmpv3_report {
54 54
	__u8 type;
......
57 57
	__be16 resv2;
58 58
	__be16 ngrec;
59 59
	struct igmpv3_grec grec[0];
60
};
60
} __packed;
61 61

  
62 62
struct igmpv3_query {
63 63
	__u8 type;
......
78 78
	__u8 qqic;
79 79
	__be16 nsrcs;
80 80
	__be32 srcs[0];
81
};
81
} __packed;
82 82

  
83 83
#define IGMP_HOST_MEMBERSHIP_QUERY	0x11	/* From RFC1112 */
84 84
#define IGMP_HOST_MEMBERSHIP_REPORT	0x12	/* Ditto */
b/net/ipv4/tcp_input.c
3944 3944
{
3945 3945
	const __be32 *ptr = (const __be32 *)(th + 1);
3946 3946

  
3947
	if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16)
3947
	if (__get_unaligned_cpu32(ptr) == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16)
3948 3948
			  | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) {
3949 3949
		tp->rx_opt.saw_tstamp = 1;
3950 3950
		++ptr;
3951
		tp->rx_opt.rcv_tsval = ntohl(*ptr);
3951
		tp->rx_opt.rcv_tsval = ntohl(__get_unaligned_cpu32(ptr));
3952 3952
		++ptr;
3953
		tp->rx_opt.rcv_tsecr = ntohl(*ptr);
3953
		tp->rx_opt.rcv_tsecr = ntohl(__get_unaligned_cpu32(ptr));
3954 3954
		return 1;
3955 3955
	}
3956 3956
	return 0;