@@ -1863,12 +1863,6 @@ tcp_md5_do_lookup_any_l3index(const struct sock *sk,
18631863 return __tcp_md5_do_lookup (sk , 0 , addr , family , true);
18641864}
18651865
1866- enum skb_drop_reason
1867- tcp_inbound_md5_hash (const struct sock * sk , const struct sk_buff * skb ,
1868- const void * saddr , const void * daddr ,
1869- int family , int l3index , const __u8 * hash_location );
1870-
1871-
18721866#define tcp_twsk_md5_key (twsk ) ((twsk)->tw_md5_key)
18731867#else
18741868static inline struct tcp_md5sig_key *
@@ -1885,13 +1879,6 @@ tcp_md5_do_lookup_any_l3index(const struct sock *sk,
18851879 return NULL ;
18861880}
18871881
1888- static inline enum skb_drop_reason
1889- tcp_inbound_md5_hash (const struct sock * sk , const struct sk_buff * skb ,
1890- const void * saddr , const void * daddr ,
1891- int family , int l3index , const __u8 * hash_location )
1892- {
1893- return SKB_NOT_DROPPED_YET ;
1894- }
18951882#define tcp_twsk_md5_key (twsk ) NULL
18961883#endif
18971884
@@ -2806,66 +2793,9 @@ static inline bool tcp_ao_required(struct sock *sk, const void *saddr,
28062793 return false;
28072794}
28082795
2809- /* Called with rcu_read_lock() */
2810- static inline enum skb_drop_reason
2811- tcp_inbound_hash (struct sock * sk , const struct request_sock * req ,
2812- const struct sk_buff * skb ,
2813- const void * saddr , const void * daddr ,
2814- int family , int dif , int sdif )
2815- {
2816- const struct tcphdr * th = tcp_hdr (skb );
2817- const struct tcp_ao_hdr * aoh ;
2818- const __u8 * md5_location ;
2819- int l3index ;
2820-
2821- /* Invalid option or two times meet any of auth options */
2822- if (tcp_parse_auth_options (th , & md5_location , & aoh )) {
2823- tcp_hash_fail ("TCP segment has incorrect auth options set" ,
2824- family , skb , "" );
2825- return SKB_DROP_REASON_TCP_AUTH_HDR ;
2826- }
2827-
2828- if (req ) {
2829- if (tcp_rsk_used_ao (req ) != !!aoh ) {
2830- NET_INC_STATS (sock_net (sk ), LINUX_MIB_TCPAOBAD );
2831- tcp_hash_fail ("TCP connection can't start/end using TCP-AO" ,
2832- family , skb , "%s" ,
2833- !aoh ? "missing AO" : "AO signed" );
2834- return SKB_DROP_REASON_TCP_AOFAILURE ;
2835- }
2836- }
2837-
2838- /* sdif set, means packet ingressed via a device
2839- * in an L3 domain and dif is set to the l3mdev
2840- */
2841- l3index = sdif ? dif : 0 ;
2842-
2843- /* Fast path: unsigned segments */
2844- if (likely (!md5_location && !aoh )) {
2845- /* Drop if there's TCP-MD5 or TCP-AO key with any rcvid/sndid
2846- * for the remote peer. On TCP-AO established connection
2847- * the last key is impossible to remove, so there's
2848- * always at least one current_key.
2849- */
2850- if (tcp_ao_required (sk , saddr , family , l3index , true)) {
2851- tcp_hash_fail ("AO hash is required, but not found" ,
2852- family , skb , "L3 index %d" , l3index );
2853- return SKB_DROP_REASON_TCP_AONOTFOUND ;
2854- }
2855- if (unlikely (tcp_md5_do_lookup (sk , l3index , saddr , family ))) {
2856- NET_INC_STATS (sock_net (sk ), LINUX_MIB_TCPMD5NOTFOUND );
2857- tcp_hash_fail ("MD5 Hash not found" ,
2858- family , skb , "L3 index %d" , l3index );
2859- return SKB_DROP_REASON_TCP_MD5NOTFOUND ;
2860- }
2861- return SKB_NOT_DROPPED_YET ;
2862- }
2863-
2864- if (aoh )
2865- return tcp_inbound_ao_hash (sk , skb , family , req , l3index , aoh );
2866-
2867- return tcp_inbound_md5_hash (sk , skb , saddr , daddr , family ,
2868- l3index , md5_location );
2869- }
2796+ enum skb_drop_reason tcp_inbound_hash (struct sock * sk ,
2797+ const struct request_sock * req , const struct sk_buff * skb ,
2798+ const void * saddr , const void * daddr ,
2799+ int family , int dif , int sdif );
28702800
28712801#endif /* _TCP_H */
0 commit comments