tcp: provide SYN headers for passive connections
This patch allows a server application to get the TCP SYN headers for its passive connections. This is useful if the server is doing fingerprinting of clients based on SYN packet contents. Two socket options are added: TCP_SAVE_SYN and TCP_SAVED_SYN. The first is used on a socket to enable saving the SYN headers for child connections. This can be set before or after the listen() call. The latter is used to retrieve the SYN headers for passive connections, if the parent listener has enabled TCP_SAVE_SYN. TCP_SAVED_SYN is read once, it frees the saved SYN headers. The data returned in TCP_SAVED_SYN are network (IPv4/IPv6) and TCP headers. Original patch was written by Tom Herbert, I changed it to not hold a full skb (and associated dst and conntracking reference). We have used such patch for about 3 years at Google. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Tested-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
					parent
					
						
							
								fcba67c94a
							
						
					
				
			
			
				commit
				
					
						cd8ae85299
					
				
			
		
					 7 changed files with 70 additions and 1 deletions
				
			
		|  | @ -113,6 +113,8 @@ enum { | |||
| #define TCP_TIMESTAMP		24 | ||||
| #define TCP_NOTSENT_LOWAT	25	/* limit number of unsent bytes in write queue */ | ||||
| #define TCP_CC_INFO		26	/* Get Congestion Control (optional) info */ | ||||
| #define TCP_SAVE_SYN		27	/* Record SYN headers for new connections */ | ||||
| #define TCP_SAVED_SYN		28	/* Get SYN headers recorded for connection */ | ||||
| 
 | ||||
| struct tcp_repair_opt { | ||||
| 	__u32	opt_code; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Eric Dumazet
				Eric Dumazet