Re: [PATCH 1/1] tcp: Replace constants with #define macros
From: Vijay Subramanian <hidden>
Date: 2011-12-20 20:02:53
Thanks a lot for reviewing the patch. Please see responses below. On 20 December 2011 02:27, David Laight [off-list ref] wrote:
quoted
+/*These are used to set the sack_ok field in struct tcp_options_received */ +#define SACK_SEEN (1 << 0) /*1 = peer is SACK capable, */ +#define FACK_ENABLED (1 << 1) /*1 = FACK is enabled locally*/ +#define DSACK_SEEN (1 << 2) /*1 = DSACK was received from peer*/ +Since that is a fairly public header, some namespace protection might be sensible.
I assume you are talking about collision with userspace. These definitions are already protected by #ifdef __KERNEL__. That should be enough to protect against collisions with userspace I think.
quoted
- tcp_opt->sack_ok = (options >> 4) & 0x1; + tcp_opt->sack_ok = (options >> 4) & SACK_SEEN;Looks to me like that 0x1 isn't SAC_SEEK! So this is now misleading.
Can you please elaborate? Are you saying this is wrong or that it could be done better? Thanks for your time! Vijay