Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optional values for MPTCP_CMD_SUB_CREATE in netlink_pm_mptcp_org.c #134

Closed
VenkateswaranJ opened this issue May 8, 2021 · 4 comments · Fixed by #139
Closed

optional values for MPTCP_CMD_SUB_CREATE in netlink_pm_mptcp_org.c #134

VenkateswaranJ opened this issue May 8, 2021 · 4 comments · Fixed by #139
Assignees
Labels
bug Something isn't working question Further information is requested
Milestone

Comments

@VenkateswaranJ
Copy link

Hi,

It looks like the comment https://github.com/intel/mptcpd/blob/master/src/netlink_pm_mptcp_org.c#L317-L321 are not correct. Local address, remote address and remote port are not optional for MPTCP_CMD_SUB_CREATE command. Only source port, backup flag and if_idx are optional. Please check the out of tree mptcp Netlink path manager implementation at kernel side https://github.com/multipath-tcp/mptcp/blob/mptcp_v0.95/net/mptcp/mptcp_netlink.c#L862-L872

Also, why we are not adding MPTCP_ATTR_FAMILY for subflow create command? I see the bug comment https://github.com/intel/mptcpd/blob/v0.7/src/netlink_pm_mptcp_org.c#L333 but I don't understand it.

Am I missing something here?

@VenkateswaranJ VenkateswaranJ changed the title optonal values for MPTCP_CMD_SUB_CREATE in netlink_pm_mptcp_org.c optional values for MPTCP_CMD_SUB_CREATE in netlink_pm_mptcp_org.c May 8, 2021
@ossama-othman
Copy link
Member

The optional attribute comments and handling in netlink_pm_mptcp_org.c were based on the API documentation in <linux/mptcp.h>. There it states that only the MPTCP connection token, address family, local address ID and remote address ID are required. All other attributes are marked as optional (placed between square brackets). However, the implementation you pointed to does appear to indicate that the source and destination address, and destination port are required.

@matttbe: Are the attributes in question actually required in the multipath-tcp.org kernel? Did I misunderstand the API docs?

@ossama-othman ossama-othman added the question Further information is requested label May 10, 2021
@ossama-othman
Copy link
Member

ossama-othman commented May 10, 2021

Also, why we are not adding MPTCP_ATTR_FAMILY for subflow create command? I see the bug comment https://github.com/intel/mptcpd/blob/v0.7/src/netlink_pm_mptcp_org.c#L333 but I don't understand it.

Thanks for bringing this up. It's a long standing piece of code that really should be corrected. Mptcpd doesn't explicitly require plugin authors to pass in a separate address family argument since it is readily available in the sockaddr supplied by the user. I felt that it would be redundant to add a separate address family parameter. Unfortunately, the local/remote address parameters are currently treated as optional by mptcpd, which is why I left the @bug comment. Assuming that the remote address truly is required we can easily address this bug and the comment.

@ossama-othman
Copy link
Member

Sorry. I inadvertently closed this issue. Reopened.

@ossama-othman ossama-othman added the bug Something isn't working label May 10, 2021
@ossama-othman ossama-othman added this to the Q2-2021 milestone May 10, 2021
@matttbe
Copy link
Member

matttbe commented May 11, 2021

Good catch!

@matttbe: Are the attributes in question actually required in the multipath-tcp.org kernel? Did I misunderstand the API docs?

@ossama-othman indeed the "doc" is not OK in mptcp.h: https://github.com/multipath-tcp/mptcp/blob/mptcp_v0.95/include/uapi/linux/mptcp.h#L90

 *   - MPTCP_CMD_SUB_CREATE: token, family, loc_id, rem_id, [saddr4 | saddr6,
 *                           daddr4 | daddr6, dport [, sport, backup, if_idx]]
 *       Create a new subflow.

We need the token, family, loc_id and rem_id but also the destination address and port, which makes sense when you want to create a new subflow :)
But the source address is not mandatory, loc_id can be used to find the address if not given.

So it should be:

 *   - MPTCP_CMD_SUB_CREATE: token, family, loc_id, rem_id, daddr4 | daddr6,
 *                           dport[, saddr4 | saddr6 sport, backup, if_idx]
 *       Create a new subflow.

I can fix that if nobody already has a patch.

@ossama-othman ossama-othman self-assigned this May 24, 2021
ossama-othman pushed a commit that referenced this issue May 24, 2021
The remote address and port are required when creating a
subflow. Update the mptcpd_pm_add_subflow() implementation
accordingly.

Fixes #134.
matttbe added a commit to multipath-tcp/mptcp that referenced this issue Jun 30, 2021
To create a subflow, like for a TCP connection, we always need a
destination address and port.

We need to reflect what is done in mptcp_netlink.c: if daddr4 or daddr6
is not set, the creation fails with -EINVAL.

Closes: multipath-tcp/mptcpd#134
Fixes: 4ea5dee ("mptcp: new netlink-based path manager")
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
matttbe added a commit to multipath-tcp/mptcp that referenced this issue Jun 30, 2021
To create a subflow, like for a TCP connection, we always need a
destination address and port.

We need to reflect what is done in mptcp_netlink.c: if daddr4 or daddr6
is not set, the creation fails with -EINVAL.

Closes: multipath-tcp/mptcpd#134
Fixes: 4ea5dee ("mptcp: new netlink-based path manager")
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
(cherry picked from commit 1260f8d)
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Diaz1401 pushed a commit to mengkernel/kernel_xiaomi_sm8250 that referenced this issue Jul 30, 2022
To create a subflow, like for a TCP connection, we always need a
destination address and port.

We need to reflect what is done in mptcp_netlink.c: if daddr4 or daddr6
is not set, the creation fails with -EINVAL.

Closes: multipath-tcp/mptcpd#134
Fixes: 4ea5dee ("mptcp: new netlink-based path manager")
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
(cherry picked from commit 1260f8d1a751bd04d657f132469d9448fba22eb1)
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Diaz1401 <reagor8161@outlook.com>
Diaz1401 pushed a commit to mengkernel/kernel_xiaomi_sm8250 that referenced this issue Aug 30, 2022
To create a subflow, like for a TCP connection, we always need a
destination address and port.

We need to reflect what is done in mptcp_netlink.c: if daddr4 or daddr6
is not set, the creation fails with -EINVAL.

Closes: multipath-tcp/mptcpd#134
Fixes: 4ea5dee ("mptcp: new netlink-based path manager")
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
(cherry picked from commit 1260f8d1a751bd04d657f132469d9448fba22eb1)
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Diaz1401 <reagor8161@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants