#define pr_fmt(fmt) …
#include <linux/inet.h>
#include <linux/kernel.h>
#include <net/inet_common.h>
#include <net/netns/generic.h>
#include <net/mptcp.h>
#include "protocol.h"
#include "mib.h"
#include "mptcp_pm_gen.h"
static int pm_nl_pernet_id;
struct mptcp_pm_add_entry { … };
struct pm_nl_pernet { … };
#define MPTCP_PM_ADDR_MAX …
#define ADD_ADDR_RETRANS_MAX …
static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net)
{ … }
static struct pm_nl_pernet *
pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk)
{ … }
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)
{ … }
static void remote_address(const struct sock_common *skc,
struct mptcp_addr_info *addr)
{ … }
static bool lookup_subflow_by_saddr(const struct list_head *list,
const struct mptcp_addr_info *saddr)
{ … }
static bool lookup_subflow_by_daddr(const struct list_head *list,
const struct mptcp_addr_info *daddr)
{ … }
static struct mptcp_pm_addr_entry *
select_local_address(const struct pm_nl_pernet *pernet,
const struct mptcp_sock *msk)
{ … }
static struct mptcp_pm_addr_entry *
select_signal_address(struct pm_nl_pernet *pernet, const struct mptcp_sock *msk)
{ … }
unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk)
{ … }
EXPORT_SYMBOL_GPL(…);
bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk)
{ … }
struct mptcp_pm_add_entry *
mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk,
const struct mptcp_addr_info *addr)
{ … }
bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk)
{ … }
static void mptcp_pm_add_timer(struct timer_list *timer)
{ … }
struct mptcp_pm_add_entry *
mptcp_pm_del_add_timer(struct mptcp_sock *msk,
const struct mptcp_addr_info *addr, bool check_id)
{ … }
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)
{ … }
static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk,
struct mptcp_addr_info *local,
bool fullmesh,
struct mptcp_addr_info *addrs)
{ … }
static void __mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow,
bool prio, bool backup)
{ … }
static void mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow,
bool prio, bool backup)
{ … }
static struct mptcp_pm_addr_entry *
__lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id)
{ … }
static struct mptcp_pm_addr_entry *
__lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info)
{ … }
static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
{ … }
static void mptcp_pm_nl_fully_established(struct mptcp_sock *msk)
{ … }
static void mptcp_pm_nl_subflow_established(struct mptcp_sock *msk)
{ … }
static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk,
struct mptcp_addr_info *remote,
struct mptcp_addr_info *addrs)
{ … }
static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
{ … }
void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk)
{ … }
int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
struct mptcp_addr_info *addr,
struct mptcp_addr_info *rem,
u8 bkup)
{ … }
static bool mptcp_local_id_match(const struct mptcp_sock *msk, u8 local_id, u8 id)
{ … }
static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,
const struct mptcp_rm_list *rm_list,
enum linux_mptcp_mib_field rm_type)
{ … }
static void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)
{ … }
void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk,
const struct mptcp_rm_list *rm_list)
{ … }
void mptcp_pm_nl_work(struct mptcp_sock *msk)
{ … }
static bool address_use_port(struct mptcp_pm_addr_entry *entry)
{ … }
static void __mptcp_pm_release_addr_entry(struct mptcp_pm_addr_entry *entry)
{ … }
static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet,
struct mptcp_pm_addr_entry *entry,
bool needs_id)
{ … }
static struct lock_class_key mptcp_slock_keys[2];
static struct lock_class_key mptcp_keys[2];
static int mptcp_pm_nl_create_listen_socket(struct sock *sk,
struct mptcp_pm_addr_entry *entry)
{ … }
int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc)
{ … }
bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc)
{ … }
#define MPTCP_PM_CMD_GRP_OFFSET …
#define MPTCP_PM_EV_GRP_OFFSET …
static const struct genl_multicast_group mptcp_pm_mcgrps[] = …;
void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk)
{ … }
static int mptcp_pm_family_to_addr(int family)
{ … }
static int mptcp_pm_parse_pm_addr_attr(struct nlattr *tb[],
const struct nlattr *attr,
struct genl_info *info,
struct mptcp_addr_info *addr,
bool require_family)
{ … }
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)
{ … }
static struct pm_nl_pernet *genl_info_pm_nl(struct genl_info *info)
{ … }
static int mptcp_nl_add_subflow_or_signal_addr(struct net *net)
{ … }
static bool mptcp_pm_has_addr_attr_id(const struct nlattr *attr,
struct genl_info *info)
{ … }
int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
int mptcp_pm_nl_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id,
u8 *flags, int *ifindex)
{ … }
static bool remove_anno_list_by_saddr(struct mptcp_sock *msk,
const struct mptcp_addr_info *addr)
{ … }
static bool mptcp_pm_remove_anno_addr(struct mptcp_sock *msk,
const struct mptcp_addr_info *addr,
bool force)
{ … }
static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net,
const struct mptcp_pm_addr_entry *entry)
{ … }
static int mptcp_nl_remove_id_zero_address(struct net *net,
struct mptcp_addr_info *addr)
{ … }
int mptcp_pm_nl_del_addr_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list)
{ … }
static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk,
struct list_head *rm_list)
{ … }
static void mptcp_nl_remove_addrs_list(struct net *net,
struct list_head *rm_list)
{ … }
static void __flush_addrs(struct list_head *list)
{ … }
static void __reset_counters(struct pm_nl_pernet *pernet)
{ … }
int mptcp_pm_nl_flush_addrs_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
int mptcp_nl_fill_addr(struct sk_buff *skb,
struct mptcp_pm_addr_entry *entry)
{ … }
int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct genl_info *info)
{ … }
int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
int mptcp_pm_nl_dump_addr(struct sk_buff *msg,
struct netlink_callback *cb)
{ … }
int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{ … }
static int parse_limit(struct genl_info *info, int id, unsigned int *limit)
{ … }
int mptcp_pm_nl_set_limits_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
int mptcp_pm_nl_get_limits_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
static void mptcp_pm_nl_fullmesh(struct mptcp_sock *msk,
struct mptcp_addr_info *addr)
{ … }
static int mptcp_nl_set_flags(struct net *net,
struct mptcp_addr_info *addr,
u8 bkup, u8 changed)
{ … }
int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info)
{ … }
int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info)
{ … }
static void mptcp_nl_mcast_send(struct net *net, struct sk_buff *nlskb, gfp_t gfp)
{ … }
bool mptcp_userspace_pm_active(const struct mptcp_sock *msk)
{ … }
static int mptcp_event_add_subflow(struct sk_buff *skb, const struct sock *ssk)
{ … }
static int mptcp_event_put_token_and_ssk(struct sk_buff *skb,
const struct mptcp_sock *msk,
const struct sock *ssk)
{ … }
static int mptcp_event_sub_established(struct sk_buff *skb,
const struct mptcp_sock *msk,
const struct sock *ssk)
{ … }
static int mptcp_event_sub_closed(struct sk_buff *skb,
const struct mptcp_sock *msk,
const struct sock *ssk)
{ … }
static int mptcp_event_created(struct sk_buff *skb,
const struct mptcp_sock *msk,
const struct sock *ssk)
{ … }
void mptcp_event_addr_removed(const struct mptcp_sock *msk, uint8_t id)
{ … }
void mptcp_event_addr_announced(const struct sock *ssk,
const struct mptcp_addr_info *info)
{ … }
void mptcp_event_pm_listener(const struct sock *ssk,
enum mptcp_event_type event)
{ … }
void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk,
const struct sock *ssk, gfp_t gfp)
{ … }
struct genl_family mptcp_genl_family __ro_after_init = …;
static int __net_init pm_nl_init_net(struct net *net)
{ … }
static void __net_exit pm_nl_exit_net(struct list_head *net_list)
{ … }
static struct pernet_operations mptcp_pm_pernet_ops = …;
void __init mptcp_pm_nl_init(void)
{ … }