@@ -430,13 +430,16 @@ int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)
bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc)
{
struct mptcp_addr_info skc_local;
+ u8 flags;
mptcp_local_address((struct sock_common *)skc, &skc_local);
if (mptcp_pm_is_userspace(msk))
- return mptcp_userspace_pm_is_backup(msk, &skc_local);
+ flags = mptcp_userspace_pm_get_flags(msk, &skc_local);
+ else
+ flags = mptcp_pm_nl_get_flags(msk, &skc_local);
- return mptcp_pm_nl_is_backup(msk, &skc_local);
+ return !!(flags & MPTCP_PM_ADDR_FLAG_BACKUP);
}
void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk)
@@ -1166,19 +1166,19 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_pm_addr_entry
return ret;
}
-bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc)
+u8 mptcp_pm_nl_get_flags(struct mptcp_sock *msk, struct mptcp_addr_info *skc)
{
struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk);
struct mptcp_pm_addr_entry *entry;
- bool backup = false;
+ u8 flags = 0;
rcu_read_lock();
entry = __lookup_addr(pernet, skc);
if (entry)
- backup = !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP);
+ flags = entry->flags;
rcu_read_unlock();
- return backup;
+ return flags;
}
#define MPTCP_PM_CMD_GRP_OFFSET 0
@@ -149,19 +149,19 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk,
return mptcp_userspace_pm_append_new_local_addr(msk, local, true);
}
-bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk,
- struct mptcp_addr_info *skc)
+u8 mptcp_userspace_pm_get_flags(struct mptcp_sock *msk,
+ struct mptcp_addr_info *skc)
{
struct mptcp_pm_addr_entry *entry;
- bool backup = false;
+ u8 flags = 0;
spin_lock_bh(&msk->pm.lock);
entry = mptcp_userspace_pm_lookup_addr(msk, skc);
if (entry)
- backup = !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP);
+ flags = entry->flags;
spin_unlock_bh(&msk->pm.lock);
- return backup;
+ return flags;
}
static struct mptcp_sock *mptcp_userspace_pm_get_sock(const struct genl_info *info)
@@ -1130,8 +1130,8 @@ 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_pm_addr_entry *local);
int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_pm_addr_entry *local);
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);
+u8 mptcp_pm_nl_get_flags(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
+u8 mptcp_userspace_pm_get_flags(struct mptcp_sock *msk, struct mptcp_addr_info *skc);
int mptcp_userspace_pm_dump_addr(struct mptcp_id_bitmap *bitmap,
const struct genl_info *info);
int mptcp_userspace_pm_get_addr(u8 id, struct mptcp_pm_addr_entry *addr,