From 62f67115b5c46134c34f88f4b1cbdacc19384c0a Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 30 Sep 2018 11:19:18 +0100 Subject: gentoo resync : 30.09.2018 --- .../mcproxy/files/fix_checksum_calculation.patch | 41 ++++++++++++++++++++++ net-misc/mcproxy/files/mcproxy.confd | 5 +++ net-misc/mcproxy/files/mcproxy.initd | 27 ++++++++++++++ net-misc/mcproxy/files/mcproxy.service | 10 ++++++ 4 files changed, 83 insertions(+) create mode 100644 net-misc/mcproxy/files/fix_checksum_calculation.patch create mode 100644 net-misc/mcproxy/files/mcproxy.confd create mode 100644 net-misc/mcproxy/files/mcproxy.initd create mode 100644 net-misc/mcproxy/files/mcproxy.service (limited to 'net-misc/mcproxy/files') diff --git a/net-misc/mcproxy/files/fix_checksum_calculation.patch b/net-misc/mcproxy/files/fix_checksum_calculation.patch new file mode 100644 index 000000000000..2cbfb6590b72 --- /dev/null +++ b/net-misc/mcproxy/files/fix_checksum_calculation.patch @@ -0,0 +1,41 @@ +From 93b5ace42268160ebbfff4c61818fb15fa2d9b99 Mon Sep 17 00:00:00 2001 +From: Sebastian Woelke +Date: Thu, 24 Aug 2017 14:41:50 +0200 +Subject: [PATCH] Fix checksum calculation + +--- + mcproxy/src/utils/mroute_socket.cpp | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/mcproxy/src/utils/mroute_socket.cpp b/mcproxy/src/utils/mroute_socket.cpp +index 61289dd..3a55359 100644 +--- a/src/utils/mroute_socket.cpp ++++ b/src/utils/mroute_socket.cpp +@@ -157,17 +157,23 @@ u_int16_t mroute_socket::calc_checksum(const unsigned char* buf, int buf_size) c + + u_int16_t* b = (u_int16_t*)buf; + int sum = 0; ++ int csum; + + for (int i = 0; i < buf_size / 2; i++) { +- ADD_SIGNED_NUM_U16(sum, b[i]); +- //sum +=b[i]; ++ sum +=b[i]; + } + + if (buf_size % 2 == 1) { +- //sum += buf[buf_size-1]; +- ADD_SIGNED_NUM_U16(sum, buf[buf_size - 1]); ++ sum += buf[buf_size-1]; + } + ++ // fold checksum ++ csum = sum & 0xFFFF; ++ sum = sum >> 16; ++ sum += csum; ++ // fold again in case of overflow. ++ sum += sum >> 16; ++ + return ~sum; + } + diff --git a/net-misc/mcproxy/files/mcproxy.confd b/net-misc/mcproxy/files/mcproxy.confd new file mode 100644 index 000000000000..908bc353d4d9 --- /dev/null +++ b/net-misc/mcproxy/files/mcproxy.confd @@ -0,0 +1,5 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# Additional command line options +# MCPROXY_OPTS="" diff --git a/net-misc/mcproxy/files/mcproxy.initd b/net-misc/mcproxy/files/mcproxy.initd new file mode 100644 index 000000000000..44efd721c549 --- /dev/null +++ b/net-misc/mcproxy/files/mcproxy.initd @@ -0,0 +1,27 @@ +#!/sbin/openrc-run +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +config="/etc/${RC_SVCNAME}.conf" +extra_commands="checkconfig" +name="Mcproxy" +pidfile="/run/${RC_SVCNAME}.pid" + +command="mcproxy" +command_background="true" +command_args="${MCPROXY_OPTS} -f ${config}" +command_args_checkconfig="-c" +procname="${RC_SVCNAME}" + +checkconfig() { + ${command} ${command_args_checkconfig} +} + +start_pre() { + if [ ! -f "${config}" ]; then + eerror "Please create ${config} before starting ${name}!" + return 1 + else + return 0 + fi +} diff --git a/net-misc/mcproxy/files/mcproxy.service b/net-misc/mcproxy/files/mcproxy.service new file mode 100644 index 000000000000..0bad0f19cc86 --- /dev/null +++ b/net-misc/mcproxy/files/mcproxy.service @@ -0,0 +1,10 @@ +[Unit] +After=network-online.target +Description=Mcproxy + +[Service] +ExecStart=/usr/bin/mcproxy -f /etc/mcproxy.conf +Type=simple + +[Install] +WantedBy=network.target -- cgit v1.2.3