]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - include/net/tcp.h
tcp: unify tcp_v4_rtx_synack and tcp_v6_rtx_synack
[mirror_ubuntu-jammy-kernel.git] / include / net / tcp.h
index e80abe4486cbd252eb556997978fc804d389db7e..8e9c28dccb80b979a86655592853809ef4220d4d 100644 (file)
@@ -493,14 +493,8 @@ static inline u32 tcp_cookie_time(void)
 
 u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,
                              u16 *mssp);
-__u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mss);
-#else
-static inline __u32 cookie_v4_init_sequence(struct sock *sk,
-                                           struct sk_buff *skb,
-                                           __u16 *mss)
-{
-       return 0;
-}
+__u32 cookie_v4_init_sequence(struct sock *sk, const struct sk_buff *skb,
+                             __u16 *mss);
 #endif
 
 __u32 cookie_init_timestamp(struct request_sock *req);
@@ -516,13 +510,6 @@ u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph,
                              const struct tcphdr *th, u16 *mssp);
 __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb,
                              __u16 *mss);
-#else
-static inline __u32 cookie_v6_init_sequence(struct sock *sk,
-                                           struct sk_buff *skb,
-                                           __u16 *mss)
-{
-       return 0;
-}
 #endif
 /* tcp_output.c */
 
@@ -535,7 +522,7 @@ void tcp_retransmit_timer(struct sock *sk);
 void tcp_xmit_retransmit_queue(struct sock *);
 void tcp_simple_retransmit(struct sock *);
 int tcp_trim_head(struct sock *, struct sk_buff *, u32);
-int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int);
+int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int, gfp_t);
 
 void tcp_send_probe0(struct sock *);
 void tcp_send_partial(struct sock *);
@@ -1098,7 +1085,7 @@ static inline int tcp_full_space(const struct sock *sk)
 
 static inline void tcp_openreq_init(struct request_sock *req,
                                    struct tcp_options_received *rx_opt,
-                                   struct sk_buff *skb)
+                                   struct sk_buff *skb, struct sock *sk)
 {
        struct inet_request_sock *ireq = inet_rsk(req);
 
@@ -1117,6 +1104,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
        ireq->ecn_ok = 0;
        ireq->ir_rmt_port = tcp_hdr(skb)->source;
        ireq->ir_num = ntohs(tcp_hdr(skb)->dest);
+       ireq->ir_mark = inet_request_mark(sk, skb);
 }
 
 extern void tcp_openreq_init_rwin(struct request_sock *req,
@@ -1585,6 +1573,8 @@ int tcp4_proc_init(void);
 void tcp4_proc_exit(void);
 #endif
 
+int tcp_rtx_synack(struct sock *sk, struct request_sock *req);
+
 /* TCP af-specific functions */
 struct tcp_sock_af_ops {
 #ifdef CONFIG_TCP_MD5SIG
@@ -1611,8 +1601,37 @@ struct tcp_request_sock_ops {
                                                  const struct request_sock *req,
                                                  const struct sk_buff *skb);
 #endif
+       void (*init_req)(struct request_sock *req, struct sock *sk,
+                        struct sk_buff *skb);
+#ifdef CONFIG_SYN_COOKIES
+       __u32 (*cookie_init_seq)(struct sock *sk, const struct sk_buff *skb,
+                                __u16 *mss);
+#endif
+       struct dst_entry *(*route_req)(struct sock *sk, struct flowi *fl,
+                                      const struct request_sock *req,
+                                      bool *strict);
+       __u32 (*init_seq)(const struct sk_buff *skb);
+       int (*send_synack)(struct sock *sk, struct dst_entry *dst,
+                          struct flowi *fl, struct request_sock *req,
+                          u16 queue_mapping, struct tcp_fastopen_cookie *foc);
 };
 
+#ifdef CONFIG_SYN_COOKIES
+static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops,
+                                        struct sock *sk, struct sk_buff *skb,
+                                        __u16 *mss)
+{
+       return ops->cookie_init_seq(sk, skb, mss);
+}
+#else
+static inline __u32 cookie_init_sequence(const struct tcp_request_sock_ops *ops,
+                                        struct sock *sk, struct sk_buff *skb,
+                                        __u16 *mss)
+{
+       return 0;
+}
+#endif
+
 int tcpv4_offload_init(void);
 
 void tcp_v4_init(void);