Skip to content

Commit

Permalink
mptcp: Exclude MPTCP options with IPv6 ADD_ADDR2
Browse files Browse the repository at this point in the history
This guarantees that ADD_ADDR2 fits in the TCP options in
case of IPv6 address advertisement and no port field.

In this implementation, only MPTCP DSS option and MP_PRIO option
are excluded. Plain TCP options are not affected.

Signed-off-by: Fabrizio Demaria <fabrizio.demaria@intel.com>
  • Loading branch information
fabriziodemaria committed Nov 25, 2015
1 parent d80199c commit 4b7f599
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 2 additions & 4 deletions net/mptcp/mptcp_fullmesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1555,8 +1555,7 @@ static void full_mesh_addr_signal(struct sock *sk, unsigned *size,
((mpcb->mptcp_ver == 0 &&
MAX_TCP_OPTION_SPACE - *size >= MPTCP_SUB_LEN_ADD_ADDR4_ALIGN) ||
(mpcb->mptcp_ver >= 1 &&
MAX_TCP_OPTION_SPACE - *size >=
MPTCP_SUB_LEN_ADD_ADDR4_ALIGN_VER1))) {
MAX_TCP_OPTION_SPACE - *size >= MPTCP_SUB_LEN_ADD_ADDR4_ALIGN_VER1))) {
int ind = mptcp_find_free_index(~unannouncedv4);

opts->options |= OPTION_MPTCP;
Expand Down Expand Up @@ -1597,8 +1596,7 @@ static void full_mesh_addr_signal(struct sock *sk, unsigned *size,
((mpcb->mptcp_ver == 0 &&
MAX_TCP_OPTION_SPACE - *size >= MPTCP_SUB_LEN_ADD_ADDR6_ALIGN) ||
(mpcb->mptcp_ver >= 1 &&
MAX_TCP_OPTION_SPACE - *size >=
MPTCP_SUB_LEN_ADD_ADDR6_ALIGN_VER1))) {
MAX_TCP_OPTION_SPACE - *size >= MPTCP_SUB_LEN_ADD_ADDR6_ALIGN_VER1))) {
int ind = mptcp_find_free_index(~unannouncedv6);

opts->options |= OPTION_MPTCP;
Expand Down
11 changes: 8 additions & 3 deletions net/mptcp/mptcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,12 +960,20 @@ void mptcp_established_options(struct sock *sk, struct sk_buff *skb,
if (skb)
tp->mptcp->include_mpc = 0;
}

if (unlikely(tp->mptcp->pre_established)) {
opts->options |= OPTION_MPTCP;
opts->mptcp_options |= OPTION_MP_JOIN | OPTION_TYPE_ACK;
*size += MPTCP_SUB_LEN_JOIN_ACK_ALIGN;
}

if (unlikely(mpcb->addr_signal) && mpcb->pm_ops->addr_signal) {
mpcb->pm_ops->addr_signal(sk, size, opts, skb);
if (opts->add_addr_v6)
/* Skip subsequent options */
return;
}

if (!tp->mptcp->include_mpc && !tp->mptcp->pre_established) {
opts->options |= OPTION_MPTCP;
opts->mptcp_options |= OPTION_DATA_ACK;
Expand All @@ -985,9 +993,6 @@ void mptcp_established_options(struct sock *sk, struct sk_buff *skb,
*size += MPTCP_SUB_LEN_DSS_ALIGN;
}

if (unlikely(mpcb->addr_signal) && mpcb->pm_ops->addr_signal)
mpcb->pm_ops->addr_signal(sk, size, opts, skb);

if (unlikely(tp->mptcp->send_mp_prio) &&
MAX_TCP_OPTION_SPACE - *size >= MPTCP_SUB_LEN_PRIO_ALIGN) {
opts->options |= OPTION_MPTCP;
Expand Down

0 comments on commit 4b7f599

Please sign in to comment.