Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
mptcp: netlink: support MPTCPv1's ADD_ADDR
Browse files Browse the repository at this point in the history
An HMAC has to be added which makes the size different as well.

This support is now easy to add by re-using the code extracted from the
fullmesh PM to new dedicated functions.

This also makes the code simpler and easier to read.

Note that like the fullmesh PM, setting a different port is currently
not supported.

Reviewed-by: Tim Froidcoeur <tim.froidcoeur@tessares.net>
Acked-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
  • Loading branch information
matttbe committed Jan 10, 2023
1 parent 7c93884 commit 5844ad9
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions net/mptcp/mptcp_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,40 +528,26 @@ mptcp_nl_pm_addr_signal(struct sock *sk, unsigned *size,
int remove_addr_len;

unannounced = (~priv->announced4) & priv->loc4_bits;
if (unannounced &&
MAX_TCP_OPTION_SPACE - *size >= MPTCP_SUB_LEN_ADD_ADDR4_ALIGN) {
if (unannounced && mptcp_options_add_addr4_enough_space(mpcb, *size)) {
int i = mptcp_nl_find_free_index(~unannounced);

opts->options |= OPTION_MPTCP;
opts->mptcp_options |= OPTION_ADD_ADDR;
opts->add_addr4.addr_id = priv->locaddr4[i].loc4_id;
opts->add_addr4.addr = priv->locaddr4[i].addr;
opts->add_addr_v4 = 1;
*size += mptcp_options_fill_add_addr4(mpcb, opts,
&priv->locaddr4[i]);

if (skb)
priv->announced4 |= (1 << i);
*size += MPTCP_SUB_LEN_ADD_ADDR4_ALIGN;

mpcb->add_addr_signal++;
}

#if IS_ENABLED(CONFIG_IPV6)
unannounced = (~priv->announced6) & priv->loc6_bits;
if (unannounced &&
MAX_TCP_OPTION_SPACE - *size >= MPTCP_SUB_LEN_ADD_ADDR6_ALIGN) {
if (unannounced && mptcp_options_add_addr6_enough_space(mpcb, *size)) {
int i = mptcp_nl_find_free_index(~unannounced);

opts->options |= OPTION_MPTCP;
opts->mptcp_options |= OPTION_ADD_ADDR;
opts->add_addr6.addr_id = priv->locaddr6[i].loc6_id;
opts->add_addr6.addr = priv->locaddr6[i].addr;
opts->add_addr_v6 = 1;
*size += mptcp_options_fill_add_addr6(mpcb, opts,
&priv->locaddr6[i]);

if (skb)
priv->announced6 |= (1 << i);
*size += MPTCP_SUB_LEN_ADD_ADDR6_ALIGN;

mpcb->add_addr_signal++;
}
#endif

Expand Down

0 comments on commit 5844ad9

Please sign in to comment.