linux/net/mptcp/protocol.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Multipath TCP
 *
 * Copyright (c) 2017 - 2019, Intel Corporation.
 */

#ifndef __MPTCP_PROTOCOL_H
#define __MPTCP_PROTOCOL_H

#include <linux/random.h>
#include <net/tcp.h>
#include <net/inet_connection_sock.h>
#include <uapi/linux/mptcp.h>
#include <net/genetlink.h>
#include <net/rstreason.h>

#define MPTCP_SUPPORTED_VERSION

/* MPTCP option bits */
#define OPTION_MPTCP_MPC_SYN
#define OPTION_MPTCP_MPC_SYNACK
#define OPTION_MPTCP_MPC_ACK
#define OPTION_MPTCP_MPJ_SYN
#define OPTION_MPTCP_MPJ_SYNACK
#define OPTION_MPTCP_MPJ_ACK
#define OPTION_MPTCP_ADD_ADDR
#define OPTION_MPTCP_RM_ADDR
#define OPTION_MPTCP_FASTCLOSE
#define OPTION_MPTCP_PRIO
#define OPTION_MPTCP_RST
#define OPTION_MPTCP_DSS
#define OPTION_MPTCP_FAIL

#define OPTION_MPTCP_CSUMREQD

#define OPTIONS_MPTCP_MPC
#define OPTIONS_MPTCP_MPJ

/* MPTCP option subtypes */
#define MPTCPOPT_MP_CAPABLE
#define MPTCPOPT_MP_JOIN
#define MPTCPOPT_DSS
#define MPTCPOPT_ADD_ADDR
#define MPTCPOPT_RM_ADDR
#define MPTCPOPT_MP_PRIO
#define MPTCPOPT_MP_FAIL
#define MPTCPOPT_MP_FASTCLOSE
#define MPTCPOPT_RST

/* MPTCP suboption lengths */
#define TCPOLEN_MPTCP_MPC_SYN
#define TCPOLEN_MPTCP_MPC_SYNACK
#define TCPOLEN_MPTCP_MPC_ACK
#define TCPOLEN_MPTCP_MPC_ACK_DATA
#define TCPOLEN_MPTCP_MPJ_SYN
#define TCPOLEN_MPTCP_MPJ_SYNACK
#define TCPOLEN_MPTCP_MPJ_ACK
#define TCPOLEN_MPTCP_DSS_BASE
#define TCPOLEN_MPTCP_DSS_ACK32
#define TCPOLEN_MPTCP_DSS_ACK64
#define TCPOLEN_MPTCP_DSS_MAP32
#define TCPOLEN_MPTCP_DSS_MAP64
#define TCPOLEN_MPTCP_DSS_CHECKSUM
#define TCPOLEN_MPTCP_ADD_ADDR
#define TCPOLEN_MPTCP_ADD_ADDR_PORT
#define TCPOLEN_MPTCP_ADD_ADDR_BASE
#define TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT
#define TCPOLEN_MPTCP_ADD_ADDR6
#define TCPOLEN_MPTCP_ADD_ADDR6_PORT
#define TCPOLEN_MPTCP_ADD_ADDR6_BASE
#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT
#define TCPOLEN_MPTCP_PORT_LEN
#define TCPOLEN_MPTCP_PORT_ALIGN
#define TCPOLEN_MPTCP_RM_ADDR_BASE
#define TCPOLEN_MPTCP_PRIO
#define TCPOLEN_MPTCP_PRIO_ALIGN
#define TCPOLEN_MPTCP_FASTCLOSE
#define TCPOLEN_MPTCP_RST
#define TCPOLEN_MPTCP_FAIL

#define TCPOLEN_MPTCP_MPC_ACK_DATA_CSUM

/* MPTCP MP_JOIN flags */
#define MPTCPOPT_BACKUP
#define MPTCPOPT_THMAC_LEN

/* MPTCP MP_CAPABLE flags */
#define MPTCP_VERSION_MASK
#define MPTCP_CAP_CHECKSUM_REQD
#define MPTCP_CAP_EXTENSIBILITY
#define MPTCP_CAP_DENY_JOIN_ID0
#define MPTCP_CAP_HMAC_SHA256
#define MPTCP_CAP_FLAG_MASK

/* MPTCP DSS flags */
#define MPTCP_DSS_DATA_FIN
#define MPTCP_DSS_DSN64
#define MPTCP_DSS_HAS_MAP
#define MPTCP_DSS_ACK64
#define MPTCP_DSS_HAS_ACK
#define MPTCP_DSS_FLAG_MASK

/* MPTCP ADD_ADDR flags */
#define MPTCP_ADDR_ECHO

/* MPTCP MP_PRIO flags */
#define MPTCP_PRIO_BKUP

/* MPTCP TCPRST flags */
#define MPTCP_RST_TRANSIENT

/* MPTCP socket atomic flags */
#define MPTCP_WORK_RTX
#define MPTCP_FALLBACK_DONE
#define MPTCP_WORK_CLOSE_SUBFLOW

/* MPTCP socket release cb flags */
#define MPTCP_PUSH_PENDING
#define MPTCP_CLEAN_UNA
#define MPTCP_ERROR_REPORT
#define MPTCP_RETRANSMIT
#define MPTCP_FLUSH_JOIN_LIST
#define MPTCP_SYNC_STATE
#define MPTCP_SYNC_SNDBUF

struct mptcp_skb_cb {};

#define MPTCP_SKB_CB(__skb)

static inline bool before64(__u64 seq1, __u64 seq2)
{}

#define after64(seq2, seq1)

struct mptcp_options_received {};

static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field)
{}

enum mptcp_pm_status {};

enum mptcp_pm_type {};

/* Status bits below MPTCP_PM_ALREADY_ESTABLISHED need pm worker actions */
#define MPTCP_PM_WORK_MASK

enum mptcp_addr_signal_status {};

/* max value of mptcp_addr_info.id */
#define MPTCP_PM_MAX_ADDR_ID

struct mptcp_pm_data {};

struct mptcp_pm_addr_entry {};

struct mptcp_data_frag {};

/* MPTCP connection sock */
struct mptcp_sock {};

#define mptcp_data_lock(sk)
#define mptcp_data_unlock(sk)

#define mptcp_for_each_subflow(__msk, __subflow)
#define mptcp_for_each_subflow_safe(__msk, __subflow, __tmp)

extern struct genl_family mptcp_genl_family;

static inline void msk_owned_by_me(const struct mptcp_sock *msk)
{}

#ifdef CONFIG_DEBUG_NET
/* MPTCP-specific: we might (indirectly) call this helper with the wrong sk */
#undef tcp_sk
#define tcp_sk(ptr)
#define mptcp_sk(ptr)

#else /* !CONFIG_DEBUG_NET */
#define mptcp_sk
#endif

/* the msk socket don't use the backlog, also account for the bulk
 * free memory
 */
static inline int __mptcp_rmem(const struct sock *sk)
{}

static inline int mptcp_win_from_space(const struct sock *sk, int space)
{}

static inline int mptcp_space_from_win(const struct sock *sk, int win)
{}

static inline int __mptcp_space(const struct sock *sk)
{}

static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk)
{}

static inline struct mptcp_data_frag *mptcp_send_next(struct sock *sk)
{}

static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk)
{}

static inline struct mptcp_data_frag *mptcp_rtx_head(struct sock *sk)
{}

struct csum_pseudo_header {};

struct mptcp_subflow_request_sock {};

static inline struct mptcp_subflow_request_sock *
mptcp_subflow_rsk(const struct request_sock *rsk)
{}

struct mptcp_delegated_action {};

DECLARE_PER_CPU(struct mptcp_delegated_action, mptcp_delegated_actions);

#define MPTCP_DELEGATE_SCHEDULED
#define MPTCP_DELEGATE_SEND
#define MPTCP_DELEGATE_ACK
#define MPTCP_DELEGATE_SNDBUF

#define MPTCP_DELEGATE_ACTIONS_MASK
/* MPTCP subflow context */
struct mptcp_subflow_context {};

static inline struct mptcp_subflow_context *
mptcp_subflow_ctx(const struct sock *sk)
{}

static inline struct sock *
mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow)
{}

static inline void
mptcp_subflow_ctx_reset(struct mptcp_subflow_context *subflow)
{}

/* Convert reset reasons in MPTCP to enum sk_rst_reason type */
static inline enum sk_rst_reason
sk_rst_convert_mptcp_reason(u32 reason)
{}

static inline void
mptcp_send_active_reset_reason(struct sock *sk)
{}

static inline u64
mptcp_subflow_get_map_offset(const struct mptcp_subflow_context *subflow)
{}

static inline u64
mptcp_subflow_get_mapped_dsn(const struct mptcp_subflow_context *subflow)
{}

void mptcp_subflow_process_delegated(struct sock *ssk, long actions);

static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *subflow, int action)
{}

static inline struct mptcp_subflow_context *
mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated)
{}

int mptcp_is_enabled(const struct net *net);
unsigned int mptcp_get_add_addr_timeout(const struct net *net);
int mptcp_is_checksum_enabled(const struct net *net);
int mptcp_allow_join_id0(const struct net *net);
unsigned int mptcp_stale_loss_cnt(const struct net *net);
unsigned int mptcp_close_timeout(const struct sock *sk);
int mptcp_get_pm_type(const struct net *net);
const char *mptcp_get_scheduler(const struct net *net);
void mptcp_get_available_schedulers(char *buf, size_t maxlen);
void __mptcp_subflow_fully_established(struct mptcp_sock *msk,
				       struct mptcp_subflow_context *subflow,
				       const struct mptcp_options_received *mp_opt);
bool __mptcp_retransmit_pending_data(struct sock *sk);
void mptcp_check_and_set_pending(struct sock *sk);
void __mptcp_push_pending(struct sock *sk, unsigned int flags);
bool mptcp_subflow_data_available(struct sock *sk);
void __init mptcp_subflow_init(void);
void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how);
void mptcp_close_ssk(struct sock *sk, struct sock *ssk,
		     struct mptcp_subflow_context *subflow);
void __mptcp_subflow_send_ack(struct sock *ssk);
void mptcp_subflow_reset(struct sock *ssk);
void mptcp_subflow_queue_clean(struct sock *sk, struct sock *ssk);
void mptcp_sock_graft(struct sock *sk, struct socket *parent);
struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk);
bool __mptcp_close(struct sock *sk, long timeout);
void mptcp_cancel_work(struct sock *sk);
void __mptcp_unaccepted_force_close(struct sock *sk);
void mptcp_set_owner_r(struct sk_buff *skb, struct sock *sk);
void mptcp_set_state(struct sock *sk, int state);

bool mptcp_addresses_equal(const struct mptcp_addr_info *a,
			   const struct mptcp_addr_info *b, bool use_port);
void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr);

/* called with sk socket lock held */
int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
			    const struct mptcp_addr_info *remote);
int mptcp_subflow_create_socket(struct sock *sk, unsigned short family,
				struct socket **new_sock);
void mptcp_info2sockaddr(const struct mptcp_addr_info *info,
			 struct sockaddr_storage *addr,
			 unsigned short family);
struct mptcp_sched_ops *mptcp_sched_find(const char *name);
int mptcp_register_scheduler(struct mptcp_sched_ops *sched);
void mptcp_unregister_scheduler(struct mptcp_sched_ops *sched);
void mptcp_sched_init(void);
int mptcp_init_sched(struct mptcp_sock *msk,
		     struct mptcp_sched_ops *sched);
void mptcp_release_sched(struct mptcp_sock *msk);
void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow,
				 bool scheduled);
struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk);
struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk);
int mptcp_sched_get_send(struct mptcp_sock *msk);
int mptcp_sched_get_retrans(struct mptcp_sock *msk);

static inline u64 mptcp_data_avail(const struct mptcp_sock *msk)
{}

static inline bool mptcp_epollin_ready(const struct sock *sk)
{}

int mptcp_set_rcvlowat(struct sock *sk, int val);

static inline bool __tcp_can_send(const struct sock *ssk)
{}

static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *subflow)
{}

void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow);

bool mptcp_subflow_active(struct mptcp_subflow_context *subflow);

void mptcp_subflow_drop_ctx(struct sock *ssk);

static inline void mptcp_subflow_tcp_fallback(struct sock *sk,
					      struct mptcp_subflow_context *ctx)
{}

void __init mptcp_proto_init(void);
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
int __init mptcp_proto_v6_init(void);
#endif

struct sock *mptcp_sk_clone_init(const struct sock *sk,
				 const struct mptcp_options_received *mp_opt,
				 struct sock *ssk,
				 struct request_sock *req);
void mptcp_get_options(const struct sk_buff *skb,
		       struct mptcp_options_received *mp_opt);

void mptcp_finish_connect(struct sock *sk);
void __mptcp_sync_state(struct sock *sk, int state);
void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout);

static inline void mptcp_stop_tout_timer(struct sock *sk)
{}

static inline void mptcp_set_close_tout(struct sock *sk, unsigned long tout)
{}

static inline void mptcp_start_tout_timer(struct sock *sk)
{}

static inline bool mptcp_is_fully_established(struct sock *sk)
{}

void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk);
void mptcp_data_ready(struct sock *sk, struct sock *ssk);
bool mptcp_finish_join(struct sock *sk);
bool mptcp_schedule_work(struct sock *sk);
int mptcp_setsockopt(struct sock *sk, int level, int optname,
		     sockptr_t optval, unsigned int optlen);
int mptcp_getsockopt(struct sock *sk, int level, int optname,
		     char __user *optval, int __user *option);

u64 __mptcp_expand_seq(u64 old_seq, u64 cur_seq);
static inline u64 mptcp_expand_seq(u64 old_seq, u64 cur_seq, bool use_64bit)
{}
void __mptcp_check_push(struct sock *sk, struct sock *ssk);
void __mptcp_data_acked(struct sock *sk);
void __mptcp_error_report(struct sock *sk);
bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit);
static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk)
{}

static inline u32 mptcp_notsent_lowat(const struct sock *sk)
{}

static inline bool mptcp_stream_memory_free(const struct sock *sk, int wake)
{}

static inline bool __mptcp_stream_is_writeable(const struct sock *sk, int wake)
{}

static inline void mptcp_write_space(struct sock *sk)
{}

static inline void __mptcp_sync_sndbuf(struct sock *sk)
{}

/* The called held both the msk socket and the subflow socket locks,
 * possibly under BH
 */
static inline void __mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk)
{}

/* the caller held only the subflow socket lock, either in process or
 * BH context. Additionally this can be called under the msk data lock,
 * so we can't acquire such lock here: let the delegate action acquires
 * the needed locks in suitable order.
 */
static inline void mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk)
{}

void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags);

#define MPTCP_TOKEN_MAX_RETRIES

void __init mptcp_token_init(void);
static inline void mptcp_token_init_request(struct request_sock *req)
{}

int mptcp_token_new_request(struct request_sock *req);
void mptcp_token_destroy_request(struct request_sock *req);
int mptcp_token_new_connect(struct sock *ssk);
void mptcp_token_accept(struct mptcp_subflow_request_sock *r,
			struct mptcp_sock *msk);
bool mptcp_token_exists(u32 token);
struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token);
struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot,
					 long *s_num);
void mptcp_token_destroy(struct mptcp_sock *msk);

void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn);

void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac);
__sum16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum);

void __init mptcp_pm_init(void);
void mptcp_pm_data_init(struct mptcp_sock *msk);
void mptcp_pm_data_reset(struct mptcp_sock *msk);
int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info,
			struct mptcp_addr_info *addr);
int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info,
			 bool require_family,
			 struct mptcp_pm_addr_entry *entry);
bool mptcp_pm_addr_families_match(const struct sock *sk,
				  const struct mptcp_addr_info *loc,
				  const struct mptcp_addr_info *rem);
void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk);
void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk);
void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, int server_side);
void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk);
bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk);
void mptcp_pm_connection_closed(struct mptcp_sock *msk);
void mptcp_pm_subflow_established(struct mptcp_sock *msk);
bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk);
void mptcp_pm_subflow_check_next(struct mptcp_sock *msk,
				 const struct mptcp_subflow_context *subflow);
void mptcp_pm_add_addr_received(const struct sock *ssk,
				const struct mptcp_addr_info *addr);
void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,
			      const struct mptcp_addr_info *addr);
void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk);
void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk);
void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,
			       const struct mptcp_rm_list *rm_list);
void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup);
void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq);
int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
				 struct mptcp_addr_info *addr,
				 struct mptcp_addr_info *rem,
				 u8 bkup);
bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
			      const struct mptcp_addr_info *addr);
void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk);
struct mptcp_pm_add_entry *
mptcp_pm_del_add_timer(struct mptcp_sock *msk,
		       const struct mptcp_addr_info *addr, bool check_id);
struct mptcp_pm_add_entry *
mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk,
				const struct mptcp_addr_info *addr);
int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,
					 unsigned int id,
					 u8 *flags, int *ifindex);
int mptcp_pm_nl_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id,
					    u8 *flags, int *ifindex);
int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk,
						   unsigned int id,
						   u8 *flags, int *ifindex);
int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info);
int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info);
int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info);
int mptcp_pm_announce_addr(struct mptcp_sock *msk,
			   const struct mptcp_addr_info *addr,
			   bool echo);
int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list);
int mptcp_pm_remove_subflow(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list);
void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list);

void mptcp_free_local_addr_list(struct mptcp_sock *msk);

void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk,
		 const struct sock *ssk, gfp_t gfp);
void mptcp_event_addr_announced(const struct sock *ssk, const struct mptcp_addr_info *info);
void mptcp_event_addr_removed(const struct mptcp_sock *msk, u8 id);
void mptcp_event_pm_listener(const struct sock *ssk,
			     enum mptcp_event_type event);
bool mptcp_userspace_pm_active(const struct mptcp_sock *msk);

void __mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow,
				     const struct mptcp_options_received *mp_opt);
void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subflow,
					      struct request_sock *req);
int mptcp_nl_fill_addr(struct sk_buff *skb,
		       struct mptcp_pm_addr_entry *entry);

static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk)
{}

static inline bool mptcp_pm_should_add_signal_addr(struct mptcp_sock *msk)
{}

static inline bool mptcp_pm_should_add_signal_echo(struct mptcp_sock *msk)
{}

static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk)
{}

static inline bool mptcp_pm_is_userspace(const struct mptcp_sock *msk)
{}

static inline bool mptcp_pm_is_kernel(const struct mptcp_sock *msk)
{}

static inline unsigned int mptcp_add_addr_len(int family, bool echo, bool port)
{}

static inline int mptcp_rm_addr_len(const struct mptcp_rm_list *rm_list)
{}

bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb,
			      unsigned int opt_size, unsigned int remaining,
			      struct mptcp_addr_info *addr, bool *echo,
			      bool *drop_other_suboptions);
bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
			     struct mptcp_rm_list *rm_list);
int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);
int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc);
bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb);
int mptcp_pm_nl_dump_addr(struct sk_buff *msg,
			  struct netlink_callback *cb);
int mptcp_userspace_pm_dump_addr(struct sk_buff *msg,
				 struct netlink_callback *cb);
int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info);
int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct genl_info *info);
int mptcp_userspace_pm_get_addr(struct sk_buff *skb,
				struct genl_info *info);

static inline u8 subflow_get_local_id(const struct mptcp_subflow_context *subflow)
{}

void __init mptcp_pm_nl_init(void);
void mptcp_pm_nl_work(struct mptcp_sock *msk);
void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk,
				     const struct mptcp_rm_list *rm_list);
unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk);
unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk);
unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk);
unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk);

/* called under PM lock */
static inline void __mptcp_pm_close_subflow(struct mptcp_sock *msk)
{}

static inline void mptcp_pm_close_subflow(struct mptcp_sock *msk)
{}

void mptcp_sockopt_sync(struct mptcp_sock *msk, struct sock *ssk);
void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk);

static inline struct mptcp_ext *mptcp_get_ext(const struct sk_buff *skb)
{}

void mptcp_diag_subflow_init(struct tcp_ulp_ops *ops);

static inline bool __mptcp_check_fallback(const struct mptcp_sock *msk)
{}

static inline bool mptcp_check_fallback(const struct sock *sk)
{}

static inline void __mptcp_do_fallback(struct mptcp_sock *msk)
{}

static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *msk)
{}

static inline void mptcp_do_fallback(struct sock *ssk)
{}

#define pr_fallback(a)

static inline bool mptcp_check_infinite_map(struct sk_buff *skb)
{}

static inline bool is_active_ssk(struct mptcp_subflow_context *subflow)
{}

static inline bool subflow_simultaneous_connect(struct sock *sk)
{}

#ifdef CONFIG_SYN_COOKIES
void subflow_init_req_cookie_join_save(const struct mptcp_subflow_request_sock *subflow_req,
				       struct sk_buff *skb);
bool mptcp_token_join_cookie_init_state(struct mptcp_subflow_request_sock *subflow_req,
					struct sk_buff *skb);
void __init mptcp_join_cookie_init(void);
#else
static inline void
subflow_init_req_cookie_join_save(const struct mptcp_subflow_request_sock *subflow_req,
				  struct sk_buff *skb) {}
static inline bool
mptcp_token_join_cookie_init_state(struct mptcp_subflow_request_sock *subflow_req,
				   struct sk_buff *skb)
{
	return false;
}

static inline void mptcp_join_cookie_init(void) {}
#endif

#endif /* __MPTCP_PROTOCOL_H */