mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Merge pull request #53 from flesser/mptcpd-v0.9
mptcpd: update to v0.9 and simplify patch
This commit is contained in:
commit
9df93a526b
4 changed files with 37 additions and 172 deletions
9
contributors/flesser.md
Normal file
9
contributors/flesser.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
2022-05-20
|
||||||
|
|
||||||
|
I hereby agree to the terms of the "OpenMPTCProuter Individual Contributor License Agreement", with MD5 checksum bc827a07eb93611d793ddb7c75083c00.
|
||||||
|
|
||||||
|
I furthermore declare that I am authorized and able to make this agreement and sign this declaration.
|
||||||
|
|
||||||
|
Signed,
|
||||||
|
|
||||||
|
Florian Karuhtz https://github.com/flesser
|
|
@ -10,13 +10,11 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME:=mptcpd
|
PKG_NAME:=mptcpd
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://github.com/intel/mptcpd.git
|
PKG_SOURCE_URL:=https://github.com/intel/mptcpd.git
|
||||||
PKG_SOURCE_VERSION:=0e7175adf721c95a3bd742be77cb85e0b47138cd
|
PKG_SOURCE_VERSION:=df4ea048cd3821f749bf06e0d01bb7d79faac812
|
||||||
PKG_VERSION:=0.7-$(PKG_SOURCE_VERSION)
|
PKG_VERSION:=0.9-$(PKG_SOURCE_VERSION)
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_MAINTAINER:=Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
PKG_MAINTAINER:=Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||||
|
|
||||||
PKG_FIXUP:=autoreconf
|
|
||||||
|
|
||||||
PKG_FORTIFY_SOURCE:=2
|
PKG_FORTIFY_SOURCE:=2
|
||||||
PKG_INSTALL:=1
|
PKG_INSTALL:=1
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
@ -36,7 +34,16 @@ define Package/$(PKG_NAME)/conffiles
|
||||||
/etc/mptcpd/mptcpd.conf
|
/etc/mptcpd/mptcpd.conf
|
||||||
endef
|
endef
|
||||||
|
|
||||||
TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral
|
CONFIGURE_ARGS += \
|
||||||
|
--disable-doxygen-doc \
|
||||||
|
--disable-logging
|
||||||
|
|
||||||
|
TARGET_CFLAGS += -Wno-unused-result -Wno-format-nonliteral
|
||||||
|
|
||||||
|
define Build/Prepare
|
||||||
|
$(Build/Prepare/Default)
|
||||||
|
( cd $(PKG_BUILD_DIR); $(AM_TOOL_PATHS) ./bootstrap )
|
||||||
|
endef
|
||||||
|
|
||||||
define Build/Compile
|
define Build/Compile
|
||||||
+$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
|
+$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
|
||||||
|
|
|
@ -1,167 +0,0 @@
|
||||||
--- 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 <argp.h>
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <errno.h>
|
|
||||||
-#include <error.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
@@ -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 <linux/limits.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
16
mptcpd/patches/stub_error_h.patch
Normal file
16
mptcpd/patches/stub_error_h.patch
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
--- a/src/error.h
|
||||||
|
+++ b/src/error.h
|
||||||
|
@@ -0,0 +1,13 @@
|
||||||
|
+#ifndef _ERROR_H
|
||||||
|
+#define _ERROR_H 1
|
||||||
|
+
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+
|
||||||
|
+// mimic the behaviour of https://man7.org/linux/man-pages/man3/error.3.html
|
||||||
|
+void error(int status, int errnum, const char *format, ...)
|
||||||
|
+{
|
||||||
|
+ fprintf(stderr, "Error %d: %s", errnum, format);
|
||||||
|
+ if (status != 0) exit(status);
|
||||||
|
+}
|
||||||
|
+#endif
|
Loading…
Add table
Add a link
Reference in a new issue