Skip to contentSkip to conversation

TCP_IPV4_MATCH macro

DISCUSSION Aviv Greenberg 1 participant 1 message Aug 28, 2001

lore
Share & tools
lore
#0 lore raw

In tcp.h line 238 :

#define TCP_IPV4_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
	(((__sk)->daddr			== (__saddr))	&&		\
	 ((__sk)->rcv_saddr		== (__daddr))	&&		\
	 ((*((__u32 *)&((__sk)->dport)))== (__ports))   &&		\
	 (!((__sk)->bound_dev_if) || ((__sk)->bound_dev_if == (__dif))))

the ((*((__u32 *)&((__sk)->dport))) part is nasty because it assumes that the next field in the structure is 'num'. Why not use the TCP_COMBINED_PORTS for that.? There are other such nasties in the macros there.

An alternative would be a nice comment in the sock structure.

Alexey ? DaveM ? Someone ? :)

Signature · 1 line
	- Aviv Greeberg