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

Support listener events #304

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

matttbe
Copy link
Member

@matttbe matttbe commented Oct 7, 2024

These events have been added to the upstream kernel a while ago, see commit f8c9dfbd875b ("mptcp: add pm listener events") in the kernel.

To better explain why these events are useful, better to quote the feature request:

MPTCP for Linux, when not using the in-kernel PM, depends on the userspace PM to create extra listening sockets before announcing addresses and ports. Let's call these "PM listeners".

With the existing MPTCP netlink events, a userspace PM can create PM listeners at startup time, or in response to an incoming connection. Creating sockets in response to connections is not optimal: ADD_ADDRs can't be sent until the sockets are created and listen()ed, and if all connections are closed then it may not be clear to the userspace PM daemon that PM listener sockets should be cleaned up.

With the addition of MPTCP netlink events for listening socket close & create, PM listening sockets can be managed based on application activity.

These new events are then now handled by mptcpd, and plugins can be notified via two new hooks:

  • listener_created(laddr, pm)
  • listener_closed(laddr, pm)

Note that without this PR, many entries are visible in the logs mentioning these events are not supported each time a new listener socket is created (maybe it would be better to display this warning only once, but that's a different issue):

Unhandled MPTCP event: 15
Unhandled MPTCP event: 16

@coveralls
Copy link

coveralls commented Oct 8, 2024

Pull Request Test Coverage Report for Build 11252856342

Details

  • 10 of 40 (25.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.7%) to 64.075%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/path_manager.c 0 30 0.0%
Files with Coverage Reduction New Missed Lines %
src/path_manager.c 1 18.44%
Totals Coverage Status
Change from base Build 10861100461: -0.7%
Covered Lines: 1409
Relevant Lines: 2199

💛 - Coveralls

These events have been added to the upstream kernel a while ago, see
commit f8c9dfbd875b ("mptcp: add pm listener events") in the kernel.

To better explain why these events are useful, better to quote [1]:

  MPTCP for Linux, when not using the in-kernel PM, depends on the
  userspace PM to create extra listening sockets before announcing
  addresses and ports. Let's call these "PM listeners".

  With the existing MPTCP netlink events, a userspace PM can create PM
  listeners at startup time, or in response to an incoming connection.
  Creating sockets in response to connections is not optimal: ADD_ADDRs
  can't be sent until the sockets are created and listen()ed, and if all
  connections are closed then it may not be clear to the userspace PM
  daemon that PM listener sockets should be cleaned up.

  With the addition of MPTCP netlink events for listening socket close &
  create, PM listening sockets can be managed based on application
  activity.

These new events are then now handled by mptcpd, and plugins can be
notified via two new hooks:

 - listener_created(laddr, pm)
 - listener_closed(laddr, pm)

Link: multipath-tcp/mptcp_net-next#313 [1]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Just to serve as an example, similar to what is done for other events
like ADD_ADDR, RM_ADDR, and MP_PRIO.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Just the structure to be able to test the new hooks.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Adding new hooks, checking the laddr value -- similar to what is done
when a new connection is created -- and incrementing the linked counter,
like the other hooks.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Tests 1 and 2 are imitating the server side: a new listening socket is
created. Not in the other ones, imitating the client side.

Also validate the null plugin.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
@matttbe matttbe marked this pull request as ready for review October 9, 2024 10:15
matttbe added a commit to matttbe/mptcpd that referenced this pull request Oct 9, 2024
The API has been modified: only new items have been added, see PR multipath-tcp#297
and multipath-tcp#304.

It is then required to increase CURRENT and AGE, according to libtool's
documentation.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants