commit:     2716879722854bcd457b1ceb7025db16f4f2a179
Author:     Conrad Kostecki <conrad <AT> kostecki <DOT> com>
AuthorDate: Wed Sep  5 21:20:07 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Sep 29 10:43:30 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=27168797

net-misc/mcproxy: New package

Closes: https://bugs.gentoo.org/665314
Signed-off-by: Conrad Kostecki <conrad <AT> kostecki.com>
Package-Manager: Portage-2.3.49, Repoman-2.3.10
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/9787

 net-misc/mcproxy/Manifest                          |  1 +
 .../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 ++++
 net-misc/mcproxy/mcproxy-1.1.1.ebuild              | 55 ++++++++++++++++++++++
 net-misc/mcproxy/metadata.xml                      | 29 ++++++++++++
 7 files changed, 168 insertions(+)

diff --git a/net-misc/mcproxy/Manifest b/net-misc/mcproxy/Manifest
new file mode 100644
index 00000000000..b3c14ff5c82
--- /dev/null
+++ b/net-misc/mcproxy/Manifest
@@ -0,0 +1 @@
+DIST mcproxy-1.1.1.tar.gz 3373209 BLAKE2B 
0b54f7c20b9d6d66c5b88daeaa00901918057b449b932656355303a83c4e4f1feb370de0c55e55484b9bafc63bfd82b8ef8179144529f3074e3d94e147cc8ff5
 SHA512 
408bc27169c9c90080c7842aaeaf260d5349b735e017d1750118f190124f48743fbf15fc05eee16290e38cc2f752e27b28548714a3d0cd2366dfc53dafcda0bb

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 00000000000..2cbfb6590b7
--- /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 <[email protected]>
+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 00000000000..908bc353d4d
--- /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 00000000000..44efd721c54
--- /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 00000000000..0bad0f19cc8
--- /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

diff --git a/net-misc/mcproxy/mcproxy-1.1.1.ebuild 
b/net-misc/mcproxy/mcproxy-1.1.1.ebuild
new file mode 100644
index 00000000000..463944737b3
--- /dev/null
+++ b/net-misc/mcproxy/mcproxy-1.1.1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit linux-info qmake-utils systemd
+
+DESCRIPTION="A multicast proxy for IGMP/MLD"
+HOMEPAGE="https://mcproxy.realmv6.org/ https://github.com/mcproxy/mcproxy";
+SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+KEYWORDS="~amd64 ~x86"
+LICENSE="GPL-2+"
+SLOT="0"
+IUSE="doc"
+
+DEPEND="dev-qt/qtcore:5
+       doc? ( app-doc/doxygen )"
+
+S="${WORKDIR}/${P}/${PN}"
+
+PATCHES=( "${FILESDIR}/fix_checksum_calculation.patch" )
+
+CONFIG_CHECK="~IP_MULTICAST ~IP_MROUTE"
+
+src_prepare() {
+       # Change install path from '/usr/local/bin' to '/usr/bin'
+       sed -e 's/local//' -i mcproxy.pro || die
+
+       default
+}
+
+src_configure() {
+       eqmake5
+}
+
+src_compile() {
+       default
+
+       use doc && emake doc
+}
+
+src_install() {
+       emake INSTALL_ROOT="${ED%/}" install
+
+       insinto /etc
+       doins mcproxy.conf
+
+       newinitd "${FILESDIR}"/mcproxy.initd mcproxy
+       systemd_dounit "${FILESDIR}"/mcproxy.service
+
+       newconfd "${FILESDIR}"/mcproxy.confd mcproxy
+
+       use doc && dodoc -r ../docs/.
+}

diff --git a/net-misc/mcproxy/metadata.xml b/net-misc/mcproxy/metadata.xml
new file mode 100644
index 00000000000..e601c26a307
--- /dev/null
+++ b/net-misc/mcproxy/metadata.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Conrad Kostecki</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>[email protected]</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <longdescription>
+               IGMP/MLD proxies offer the possibility option to combine
+               local multicast networks with a larger multicast infrastructure.
+               In contrast to multicast routers, proxies are lightweight and
+               do not require the support of a multicast routing protocol such 
as PIM or DVMRP.
+               A common use case is a local stub networks that interconnects 
with
+               a remote multicast routing domain, e.g. via a tunnel.
+               But it can also be used in PMIPv6 domain to enable multicast 
for sources and listeners (RFC 6224).
+               The Mcproxy meets the requirements of the IGMP/MLD proxying 
standard (RFC 4605)
+               and has additional functionalities. The multicast proxy can be 
instantiated multiple times,
+               is dynamically configurable at runtime, supports multiple 
upstreams and peering-interfaces
+               for a non hierarchical interconnection of multicast proxies.
+       </longdescription>
+       <upstream>
+               <bugs-to>https://github.com/mcproxy/mcproxy/issues</bugs-to>
+               <remote-id type="github">mcproxy/mcproxy</remote-id>
+       </upstream>
+</pkgmetadata>

Reply via email to