From a275eedf452c9818f79816a1463433f50eca3263 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 7 Jul 2021 12:14:09 +0200 Subject: [PATCH] Update mptcpd --- libell/Makefile | 6 +- mptcpd/Makefile | 11 ++- mptcpd/patches/log.patch | 24 ----- mptcpd/patches/remove_log.patch | 167 ++++++++++++++++++++++++++++++++ 4 files changed, 177 insertions(+), 31 deletions(-) delete mode 100644 mptcpd/patches/log.patch create mode 100644 mptcpd/patches/remove_log.patch diff --git a/libell/Makefile b/libell/Makefile index 99ac29e1f..8b12f4b51 100644 --- a/libell/Makefile +++ b/libell/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2020 Ycarus (Yannick Chabanois) +# Copyright (C) 2020-2021 Ycarus (Yannick Chabanois) # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,10 +8,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ell -PKG_VERSION:=0.30 +PKG_VERSION:=0.41 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=51cf8cc66a9d1038e41f7d619ea5660aa4476904496562b2d45ca79370ca4a5e +PKG_HASH:=4e8dba6c53cf152dbd0fd1dc3d4c7b04abf79e20a948895f85943e586870505c PKG_SOURCE_URL:=@KERNEL/linux/libs/ell PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=GPL diff --git a/mptcpd/Makefile b/mptcpd/Makefile index a23a4a41b..47f0de339 100644 --- a/mptcpd/Makefile +++ b/mptcpd/Makefile @@ -8,13 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mptcpd -PKG_VERSION:=0.5.1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/intel/mptcpd/releases/download/v$(PKG_VERSION) -PKG_HASH:=0ee4418880f20a1a2eff5c54c26185a75092cb44cbabe0fa3f25a2c5886459e7 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/intel/mptcpd.git +PKG_SOURCE_VERSION:=0e7175adf721c95a3bd742be77cb85e0b47138cd +PKG_VERSION:=0.7-$(PKG_SOURCE_VERSION) PKG_RELEASE:=1 PKG_MAINTAINER:=Ycarus (Yannick Chabanois) +PKG_FIXUP:=autoreconf + PKG_FORTIFY_SOURCE:=2 PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 @@ -43,6 +45,7 @@ endef define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/usr/bin $(CP) $(PKG_INSTALL_DIR)/usr/bin/mptcpd $(1)/usr/bin/mptcpd + $(CP) $(PKG_INSTALL_DIR)/usr/bin/mptcpize $(1)/usr/bin/mptcpize $(INSTALL_DIR) $(1)/usr/include/mptcpd $(CP) $(PKG_INSTALL_DIR)/usr/include/mptcpd/*.h $(1)/usr/include/ $(INSTALL_DIR) $(1)/usr/lib/mptcpd diff --git a/mptcpd/patches/log.patch b/mptcpd/patches/log.patch deleted file mode 100644 index c0bc52e3c..000000000 --- a/mptcpd/patches/log.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/src/configuration.c 2020-04-14 21:31:22.057292953 +0200 -+++ b/src/configuration.c 2020-04-14 21:32:13.712364449 +0200 -@@ -35,10 +35,10 @@ - */ - //@{ - /// Underlying string concatenation macro. --#define MPTCPD_CONCAT_IMPL(x, ...) x ## __VA_ARGS__ -+//#define MPTCPD_CONCAT_IMPL(x, ...) x ## __VA_ARGS__ - - /// Concatenate strings using the preprocessor. --#define MPTCPD_CONCAT(x, ...) MPTCPD_CONCAT_IMPL(x, __VA_ARGS__) -+//#define MPTCPD_CONCAT(x, ...) MPTCPD_CONCAT_IMPL(x, __VA_ARGS__) - //@} - - // Compile-time default logging choice -@@ -47,7 +47,7 @@ - # error Problem configuring default log message destination. - #endif - /// Name of the default logging function determined at compile-time. --#define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER) -+#define MPTCPD_SET_LOG_FUNCTION l_log_set_stderr - - /** - * @brief Get the function that sets the log message destination. diff --git a/mptcpd/patches/remove_log.patch b/mptcpd/patches/remove_log.patch new file mode 100644 index 000000000..ed077f859 --- /dev/null +++ b/mptcpd/patches/remove_log.patch @@ -0,0 +1,167 @@ +--- a/src/configuration.c 2021-06-29 17:44:20.481179981 +0200 ++++ b/src/configuration.c 2021-06-29 17:44:52.580655950 +0200 +@@ -37,21 +37,12 @@ + * Preprocessor concatenation that expands preprocessor tokens as + * needed by leveraging the usual indirection technique. + */ +-///@{ +-/// Underlying string concatenation macro. +-#define MPTCPD_CONCAT_IMPL(x, ...) x ## __VA_ARGS__ +- +-/// Concatenate strings using the preprocessor. +-#define MPTCPD_CONCAT(x, ...) MPTCPD_CONCAT_IMPL(x, __VA_ARGS__) +-///@} + + // Compile-time default logging choice + #ifndef MPTCPD_LOGGER + // This should never occur! + # error Problem configuring default log message destination. + #endif +-/// Name of the default logging function determined at compile-time. +-#define MPTCPD_SET_LOG_FUNCTION MPTCPD_CONCAT(l_log_set_, MPTCPD_LOGGER) + + /** + * @brief Get the function that sets the log message destination. +@@ -474,7 +465,6 @@ + + struct mptcpd_config *mptcpd_config_create(int argc, char *argv[]) + { +- MPTCPD_SET_LOG_FUNCTION(); // For early logging. + + struct mptcpd_config *const config = + l_new(struct mptcpd_config, 1); +--- a/src/mptcpize.c 2021-06-29 19:29:57.810281053 +0200 ++++ b/src/mptcpize.c 2021-06-29 19:29:29.942701557 +0200 +@@ -17,7 +17,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -79,7 +78,7 @@ + nr++; + envp = calloc(nr + 3, sizeof(char *)); + if (!envp) +- error(1, errno, "can't allocate env list"); ++ fprintf(stderr, "can't allocate env list"); + + // ... filtering out any 'LD_PRELOAD' ... + nr = 0; +@@ -103,7 +102,7 @@ + // build the NULL terminated arg list + argv = calloc(argc + 1, sizeof(char *)); + if (!argv) +- error(1, errno, "can't allocate argument list"); ++ fprintf(stderr, "can't allocate argument list"); + + memcpy(argv, av, argc * sizeof(char*)); + return execvpe(argv[0], argv, envp); +@@ -124,33 +123,33 @@ + len = strlen(name) + 1 + strlen(SYSTEMCTL_SHOW); + cmd = malloc(len); + if (!cmd) +- error(1, 0, "can't allocate systemctl command string"); ++ fprintf(stderr, "can't allocate systemctl command string"); + + sprintf(cmd, SYSTEMCTL_SHOW"%s", name); + systemctl = popen(cmd, "r"); + if (!systemctl) +- error(1, errno, "can't execute %s", cmd); ++ fprintf(stderr, "can't execute %s", cmd); + + free(cmd); + while ((read = getline(&line, &len, systemctl)) != -1) { + if (strncmp(line, SYSTEMD_UNIT_VAR, strlen(SYSTEMD_UNIT_VAR)) == 0) { + char *ret = strdup(&line[strlen(SYSTEMD_UNIT_VAR)]); + if (!ret) +- error(1, errno, "failed to duplicate string"); ++ fprintf(stderr, "failed to duplicate string"); + + // trim trailing newline, if any + len = strlen(ret); + if (len > 0 && ret[len - 1] == '\n') + ret[--len] = 0; + if (len == 0) +- error(1, 0, "can't find unit file for service %s", name); ++ fprintf(stderr, "can't find unit file for service %s", name); + free(line); + pclose(systemctl); + return ret; + } + } + +- error(1, 0, "can't find FragmentPath attribute for unit %s", name); ++ fprintf(stderr, "can't find FragmentPath attribute for unit %s", name); + + // never reached: just silence gcc + return NULL; +@@ -175,12 +174,12 @@ + unit = locate_unit(argv[0]); + src = fopen(unit, "r"); + if (!src) +- error(1, errno, "can't open file %s", unit); ++ fprintf(stderr, "can't open file %s", unit); + + strcpy(dst_path, "/tmp/unit_XXXXXX"); + dst = mkstemp(dst_path); + if (dst < 0) +- error(1, errno, "can't create tmp file"); ++ fprintf(stderr, "can't create tmp file"); + + // reset any prior error, to allow later check on errno + errno = 0; +@@ -194,27 +193,27 @@ + + if (!is_env) { + if (write(dst, line, read) < 0) +- error(1, errno, "can't write '%s' into %s", line, dst_path); ++ fprintf(stderr, "can't write '%s' into %s", line, dst_path); + } + + if (append_env && + (is_env || strncmp(line, SYSTEMD_SERVICE_TAG, strlen(SYSTEMD_SERVICE_TAG)) == 0)) { + if (dprintf(dst, "%s%s\n", SYSTEMD_ENV_VAR, MPTCPWRAP_ENV) < 0) +- error(1, errno, "can't write to env string into %s", dst_path); ++ fprintf(stderr, "can't write to env string into %s", dst_path); + append_env = 0; + } + } + if (errno != 0) +- error(1, errno, "can't read from %s", unit); ++ fprintf(stderr, "can't read from %s", unit); + free(line); + fclose(src); + close(dst); + + if (rename(dst_path, unit) < 0) +- error(1, errno, "can't rename %s to %s", dst_path, unit); ++ fprintf(stderr, "can't rename %s to %s", dst_path, unit); + + if (system("systemctl daemon-reload") != 0) +- error(1, errno, "can't reload unit, manual 'systemctl daemon-reload' is required"); ++ fprintf(stderr, "can't reload unit, manual 'systemctl daemon-reload' is required"); + + printf("mptcp successfully %s on unit %s\n", + enable ? "enabled" : "disabled", unit); +@@ -239,7 +238,7 @@ + argp_program_version = "mptcpize "VERSION; + argp_program_bug_address = "<" PACKAGE_BUGREPORT ">"; + if (argp_parse(&argp, argc, argv, ARGP_IN_ORDER, &idx, 0) < 0) +- error(1, errno, "can't parse arguments"); ++ fprintf(stderr, "can't parse arguments"); + + argc -= idx; + argv += idx; +--- a/src/mptcpize.c 2021-07-05 20:06:07.035838944 +0200 ++++ b/src/mptcpize.c 2021-07-05 20:06:26.875505617 +0200 +@@ -7,8 +7,6 @@ + * Copyright (c) 2021, Red Hat, Inc. + */ + +-#define _GNU_SOURCE +- + #include + + #include