-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Package Multipath TCP daemon (mptcpd) and wrapper (mptcpize). Signed-off-by: Daniel Golle <daniel@makrotopia.org>
- Loading branch information
Showing
9 changed files
with
560 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=mptcpd | ||
PKG_VERSION:=0.12 | ||
PKG_RELEASE:=1 | ||
|
||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | ||
PKG_SOURCE_URL:=https://github.com/multipath-tcp/mptcpd/releases/download/v$(PKG_VERSION) | ||
PKG_HASH:=0507d497383b773a168cd35f4680b41894fcd8d941cb6619800a8e2bed831cbe | ||
|
||
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org> | ||
PKG_LICENSE:=BSD-3-clause | ||
PKG_LICENSE_FILES:=COPYING | ||
|
||
PKG_BUILD_DEPENDS:=USE_MUSL:argp-standalone | ||
PKG_BUILD_PARALLEL:=1 | ||
PKG_CHECK_FORMAT_SECURITY:=0 | ||
PKG_FIXUP:=autoreconf | ||
PKG_INSTALL:=1 | ||
|
||
include $(INCLUDE_DIR)/package.mk | ||
|
||
CONFIGURE_ARGS += --with-kernel=upstream | ||
|
||
define Package/mptcpd/Default | ||
SECTION:=net | ||
CATEGORY:=Network | ||
DEPENDS:=+ell | ||
URL:=https://github.com/multipath-tcp/mptcpd | ||
endef | ||
|
||
define Package/mptcpd | ||
$(call Package/mptcpd/Default) | ||
TITLE:=Multipath TCP Daemon | ||
endef | ||
|
||
define Package/mptcpize | ||
$(call Package/mptcpd/Default) | ||
TITLE:=Multipath TCP wrapper | ||
endef | ||
|
||
define Package/mptcpd/conffiles | ||
/etc/mptcpd/mptcpd.conf | ||
endef | ||
|
||
define Package/mptcpd/install | ||
$(INSTALL_DIR) $(1)/etc/mptcpd | ||
$(CP) $(PKG_INSTALL_DIR)/etc/mptcpd/mptcpd.conf $(1)/etc/mptcpd | ||
$(INSTALL_DIR) $(1)/usr/bin | ||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/mptcpd $(1)/usr/bin | ||
$(INSTALL_DIR) $(1)/usr/lib/mptcpd | ||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmptcpd.so* $(1)/usr/lib | ||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/mptcpd/*.so $(1)/usr/lib/mptcpd | ||
$(INSTALL_DIR) $(1)/etc/init.d | ||
$(INSTALL_BIN) ./files/mptcpd.init $(1)/etc/init.d/mptcpd | ||
endef | ||
|
||
define Package/mptcpize/install | ||
$(INSTALL_DIR) $(1)/usr/bin | ||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/mptcpize $(1)/usr/bin | ||
$(INSTALL_DIR) $(1)/usr/lib/mptcpize | ||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/mptcpize/libmptcpwrap.so* $(1)/usr/lib/mptcpize | ||
endef | ||
|
||
$(eval $(call BuildPackage,mptcpd)) | ||
$(eval $(call BuildPackage,mptcpize)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh /etc/rc.common | ||
|
||
USE_PROCD=1 | ||
START=10 | ||
|
||
start_service() { | ||
procd_open_instance | ||
procd_set_param command /usr/bin/mptcpd | ||
procd_set_param respawn | ||
procd_close_instance | ||
} |
193 changes: 193 additions & 0 deletions
193
net/mptcpd/patches/001-Make-listening-socket-creation-optional.-297.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
From 334bb9c87005d851f4f2549f95342b8d0a41a6db Mon Sep 17 00:00:00 2001 | ||
From: marco-a-itl <marco.angaroni@italtel.com> | ||
Date: Fri, 23 Aug 2024 11:05:35 +0200 | ||
Subject: [PATCH] Make listening socket creation optional. (#297) | ||
|
||
In some cases, it is known in advanced that external applications have | ||
created or will create listening sockets, and mptcpd doesn't need to do | ||
that to avoid reporting failures because the address and port are | ||
already in use. | ||
|
||
This commit makes listening socket creation optional for userspace path | ||
manager plugins by extending the API: it is now possible to call | ||
`mptcpd_pm_add_addr_no_listener()` instead of `mptcpd_pm_add_addr()` to | ||
announce a new address without creating a new listener socket. | ||
|
||
Fixes #296. | ||
--- | ||
include/mptcpd/path_manager.h | 18 ++++++++++++++++ | ||
include/mptcpd/private/path_manager.h | 31 ++++++++++++++++----------- | ||
lib/path_manager.c | 28 +++++++++++++++++++----- | ||
src/netlink_pm_mptcp_org.c | 5 ++++- | ||
src/netlink_pm_upstream.c | 25 ++++++++++----------- | ||
5 files changed, 76 insertions(+), 31 deletions(-) | ||
|
||
--- a/include/mptcpd/path_manager.h | ||
+++ b/include/mptcpd/path_manager.h | ||
@@ -127,6 +127,24 @@ MPTCPD_API int mptcpd_pm_add_addr(struct | ||
mptcpd_token_t token); | ||
|
||
/** | ||
+ * @brief Advertise new network address to peers without creating a listener. | ||
+ * | ||
+ * @param[in] pm The mptcpd path manager object. | ||
+ * @param[in,out] addr Local IP address and port to be advertised | ||
+ * through the MPTCP protocol @c ADD_ADDR | ||
+ * option. If the port is zero no port will be | ||
+ * specified on the underlying protocol level. | ||
+ * @param[in] id MPTCP local address ID. | ||
+ * @param[in] token MPTCP connection token. | ||
+ * | ||
+ * @return @c 0 if operation was successful. -1 or @c errno otherwise. | ||
+ */ | ||
+MPTCPD_API int mptcpd_pm_add_addr_no_listener(struct mptcpd_pm *pm, | ||
+ struct sockaddr *addr, | ||
+ mptcpd_aid_t id, | ||
+ mptcpd_token_t token); | ||
+ | ||
+/** | ||
* @brief Stop advertising network address to peers. | ||
* | ||
* @param[in] pm The mptcpd path manager object. | ||
--- a/include/mptcpd/private/path_manager.h | ||
+++ b/include/mptcpd/private/path_manager.h | ||
@@ -138,18 +138,22 @@ struct mptcpd_pm_cmd_ops | ||
/** | ||
* @brief Advertise new network address to peers. | ||
* | ||
- * @param[in] pm The mptcpd path manager object. | ||
- * @param[in,out] addr Local IP address and port to be | ||
- * advertised through the MPTCP protocol | ||
- * @c ADD_ADDR option. If the port is | ||
- * zero an ephemeral port will be chosen, | ||
- * and assigned to the appropriate | ||
- * underlying address family-specific | ||
- * port member, e.g. @c sin_port or | ||
- * @c sin6_port. The port will be in | ||
- * network byte order. | ||
- * @param[in] id MPTCP local address ID. | ||
- * @param[in] token MPTCP connection token. | ||
+ * @param[in] pm The mptcpd path manager object. | ||
+ * @param[in,out] addr Local IP address and port to be | ||
+ * advertised through the MPTCP protocol | ||
+ * @c ADD_ADDR option. If the port is | ||
+ * zero an ephemeral port will be chosen, | ||
+ * and assigned to the appropriate | ||
+ * underlying address family-specific | ||
+ * port member, e.g. @c sin_port or | ||
+ * @c sin6_port. The port will be in | ||
+ * network byte order. | ||
+ * If listener is not created, port zero | ||
+ * will cause no port specification at | ||
+ * protocol level. | ||
+ * @param[in] id MPTCP local address ID. | ||
+ * @param[in] token MPTCP connection token. | ||
+ * @param[in] listener Create listener. | ||
* | ||
* @return @c 0 if operation was successful. -1 or @c errno | ||
* otherwise. | ||
@@ -157,7 +161,8 @@ struct mptcpd_pm_cmd_ops | ||
int (*add_addr)(struct mptcpd_pm *pm, | ||
struct sockaddr *addr, | ||
mptcpd_aid_t id, | ||
- mptcpd_token_t token); | ||
+ mptcpd_token_t token, | ||
+ bool listener); | ||
|
||
/** | ||
* @brief Stop advertising network address to peers. | ||
--- a/lib/path_manager.c | ||
+++ b/lib/path_manager.c | ||
@@ -238,10 +238,11 @@ int mptcpd_kpm_set_flags(struct mptcpd_p | ||
|
||
// ------------------------------------------------------------------- | ||
|
||
-int mptcpd_pm_add_addr(struct mptcpd_pm *pm, | ||
- struct sockaddr *addr, | ||
- mptcpd_aid_t address_id, | ||
- mptcpd_token_t token) | ||
+static int do_pm_add_addr(struct mptcpd_pm *pm, | ||
+ struct sockaddr *addr, | ||
+ mptcpd_aid_t address_id, | ||
+ mptcpd_token_t token, | ||
+ bool listener) | ||
{ | ||
if (pm == NULL || addr == NULL || address_id == 0) | ||
return EINVAL; | ||
@@ -258,7 +259,24 @@ int mptcpd_pm_add_addr(struct mptcpd_pm | ||
return ops->add_addr(pm, | ||
addr, | ||
address_id, | ||
- token); | ||
+ token, | ||
+ listener); | ||
+} | ||
+ | ||
+int mptcpd_pm_add_addr(struct mptcpd_pm *pm, | ||
+ struct sockaddr *addr, | ||
+ mptcpd_aid_t address_id, | ||
+ mptcpd_token_t token) | ||
+{ | ||
+ return do_pm_add_addr(pm, addr, address_id, token, true); | ||
+} | ||
+ | ||
+int mptcpd_pm_add_addr_no_listener(struct mptcpd_pm *pm, | ||
+ struct sockaddr *addr, | ||
+ mptcpd_aid_t address_id, | ||
+ mptcpd_token_t token) | ||
+{ | ||
+ return do_pm_add_addr(pm, addr, address_id, token, false); | ||
} | ||
|
||
int mptcpd_pm_remove_addr(struct mptcpd_pm *pm, | ||
--- a/src/netlink_pm_mptcp_org.c | ||
+++ b/src/netlink_pm_mptcp_org.c | ||
@@ -155,8 +155,11 @@ static bool append_remote_addr_attr(stru | ||
static int mptcp_org_add_addr(struct mptcpd_pm *pm, | ||
struct sockaddr *addr, | ||
mptcpd_aid_t id, | ||
- mptcpd_token_t token) | ||
+ mptcpd_token_t token, | ||
+ bool listener) | ||
{ | ||
+ (void) listener; | ||
+ | ||
/* | ||
Payload: | ||
Token | ||
--- a/src/netlink_pm_upstream.c | ||
+++ b/src/netlink_pm_upstream.c | ||
@@ -219,20 +219,21 @@ static int send_add_addr(struct mptcpd_p | ||
static int upstream_announce(struct mptcpd_pm *pm, | ||
struct sockaddr *addr, | ||
mptcpd_aid_t id, | ||
- mptcpd_token_t token) | ||
+ mptcpd_token_t token, | ||
+ bool listener) | ||
{ | ||
- /** | ||
- * Set up MPTCP listening socket. | ||
- * | ||
- * @note An ephemeral port will be assigned to the port in | ||
- * @a addr if it is zero. | ||
- * | ||
- * @todo This should be optional. | ||
- */ | ||
- int const r = mptcpd_lm_listen(pm->lm, addr); | ||
+ if (listener) { | ||
+ /** | ||
+ * Set up MPTCP listening socket. | ||
+ * | ||
+ * @note An ephemeral port will be assigned to the port in | ||
+ * @a addr if it is zero. | ||
+ */ | ||
+ int const r = mptcpd_lm_listen(pm->lm, addr); | ||
|
||
- if (r != 0) | ||
- return r; | ||
+ if (r != 0) | ||
+ return r; | ||
+ } | ||
|
||
/** | ||
* @todo Add support for the optional network interface index |
Oops, something went wrong.