@@ -34,6 +34,8 @@ struct mptcp_ext {
u8 reset_reason:4;
};
+#define TCPOLEN_MPTCP_RST 4
+
struct mptcp_out_options {
#if IS_ENABLED(CONFIG_MPTCP)
u16 suboptions;
@@ -155,6 +157,8 @@ void mptcp_seq_show(struct seq_file *seq);
int mptcp_subflow_init_cookie_req(struct request_sock *req,
const struct sock *sk_listener,
struct sk_buff *skb);
+
+__be32 mptcp_option_rst(u8 flags, u8 reason);
#else
static inline void mptcp_init(void)
@@ -240,6 +244,11 @@ static inline int
mptcp_subflow_init_cookie_req(struct request_sock *req,
{
return 0; /* TCP fallback */
}
+
+__be32 mptcp_option_rst(u8 flags, u8 reason)
+{
+ return 0;
+}
#endif /* CONFIG_MPTCP */
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
@@ -193,8 +193,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
#define TCPOPT_FASTOPEN_MAGIC 0xF989
#define TCPOPT_SMC_MAGIC 0xE2D4C3D9
-/* MPTCP suboptions used in TCP */
-#define MPTCPOPT_RST 8
/*
* TCP option lengths
*/
@@ -218,7 +216,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
#define TCPOLEN_MD5SIG_ALIGNED 20
#define TCPOLEN_MSS_ALIGNED 4
#define TCPOLEN_EXP_SMC_BASE_ALIGNED 8
-#define TCPOLEN_MPTCP_RST 4
/* Flags in tp->nonagle */
#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */
@@ -2380,9 +2377,4 @@ static inline u64 tcp_transmit_time(const struct sock *sk)
return 0;
}
-static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
-{
- return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) |
- ((nib & 0xF) << 8) | field);
-}
#endif /* _TCP_H */
@@ -782,8 +782,7 @@ static void tcp_v4_send_reset(const struct sock
*sk, struct sk_buff *skb)
reason = ext->reset_reason;
}
- rep.opt[0] = mptcp_option(MPTCPOPT_RST, TCPOLEN_MPTCP_RST,
- flags, reason);
+ rep.opt[0] = mptcp_option_rst(flags, reason);
arg.iov[0].iov_len += TCPOLEN_MPTCP_RST;
rep.th.doff = arg.iov[0].iov_len / 4;
@@ -924,8 +924,7 @@ static void tcp_v6_send_response(const struct sock
*sk, struct sk_buff *skb, u32
reason = ext->reset_reason;
}
- *topt++ = mptcp_option(MPTCPOPT_RST, TCPOLEN_MPTCP_RST,
- flags, reason);
+ *topt++ = mptcp_option_rst(flags, reason);
}
#ifdef CONFIG_TCP_MD5SIG
@@ -706,6 +706,12 @@ static bool
mptcp_established_options_fastclose(struct sock *sk,
return true;
}
+__be32 mptcp_option_rst(u8 flags, u8 reason)
+{
+ return mptcp_option(MPTCPOPT_RST, TCPOLEN_MPTCP_RST,
+ flags, reason);
+}
+
static noinline void mptcp_established_options_rst(struct sock *sk,
struct sk_buff *skb,
unsigned int *size,
unsigned int remaining,
@@ -35,6 +35,7 @@
#define MPTCPOPT_MP_PRIO 5
#define MPTCPOPT_MP_FAIL 6
#define MPTCPOPT_MP_FASTCLOSE 7
+#define MPTCPOPT_RST 8
/* MPTCP suboption lengths */
#define TCPOLEN_MPTCP_MPC_SYN 4
@@ -158,6 +159,12 @@ struct mptcp_options_received {
u16 port;
};
+static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
+{
+ return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) |
+ ((nib & 0xF) << 8) | field);
+}
+
struct mptcp_addr_info {
sa_family_t family;
__be16 port;