restund: remove package

Removing as upstream dropped the project. Users can use coturn instead.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
This commit is contained in:
Sebastian Kemper 2022-02-01 18:16:14 +01:00
parent 51e62de182
commit b508e76300
7 changed files with 0 additions and 350 deletions

View file

@ -1,141 +0,0 @@
#
# Copyright (C) 2010-2017 OpenWrt.org
# Copyright (C) 2010 Alfred E. Heggestad
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=restund
PKG_VERSION:=0.4.12
PKG_RELEASE:=9
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.creytiv.com/pub
PKG_HASH:=3170441dc882352ab0275556b6fc889b38b14203d936071b5fa12f39a5c86d47
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=docs/COPYING
PKG_MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
restund-mods:=mysql
PKG_CONFIG_DEPENDS:=$(patsubst %,CONFIG_PACKAGE_restund-mod-%,$(restund-mods))
include $(INCLUDE_DIR)/package.mk
define Package/restund/Default
SECTION:=net
CATEGORY:=Network
SUBMENU:=Telephony
URL:=http://www.creytiv.com
endef
define Package/restund
$(call Package/restund/Default)
TITLE:=Modular STUN/TURN server
DEPENDS:=+libre
USERID:=$(PKG_NAME)=373:$(PKG_NAME)=373
endef
restund-mod-mysql:=USE_MYSQL
RESTUND_MOD_OPTIONS:= \
$(foreach m,$(restund-mods),$(restund-mod-$(m))=$(if $(CONFIG_PACKAGE_restund-mod-$(m)),1))
MAKE_FLAGS+= \
CROSS_COMPILE="$(TARGET_CROSS)" \
EXTRA_LFLAGS="$(TARGET_LDFLAGS)" \
LD="$(TARGET_CC)" \
LIBRE_MK="$(STAGING_DIR)/usr/share/re/re.mk" \
LIBRE_INC="$(STAGING_DIR)/usr/include/re" \
LIBRE_SO="$(STAGING_DIR)/usr/lib" \
OS=linux \
RELEASE=1 \
SYSROOT="$(shell $(FIND) $(TOOLCHAIN_DIR) -path '*/include/pthread.h' | sed -ne '1s|/include/pthread.h||p')" \
SYSROOT_ALT="$(STAGING_DIR)/usr" \
$(RESTUND_MOD_OPTIONS)
define Package/restund/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/restund $(1)/usr/sbin
$(INSTALL_DIR) $(1)/usr/lib/restund/modules
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)/usr/lib/restund/modules/auth.so \
$(PKG_INSTALL_DIR)/usr/lib/restund/modules/binding.so \
$(PKG_INSTALL_DIR)/usr/lib/restund/modules/filedb.so \
$(PKG_INSTALL_DIR)/usr/lib/restund/modules/restauth.so \
$(PKG_INSTALL_DIR)/usr/lib/restund/modules/stat.so \
$(PKG_INSTALL_DIR)/usr/lib/restund/modules/status.so \
$(PKG_INSTALL_DIR)/usr/lib/restund/modules/syslog.so \
$(PKG_INSTALL_DIR)/usr/lib/restund/modules/turn.so \
$(1)/usr/lib/restund/modules
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/restund.conf $(1)/etc
$(SED) \
's|^\(module_path\)\([ \t]\+\).*$$$$|\1\2/usr/lib/restund/modules|g' \
$(1)/etc/restund.conf
$(INSTALL_DIR) $(1)/etc/default
$(INSTALL_CONF) ./files/restund.default $(1)/etc/default/restund
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/restund.init $(1)/etc/init.d/restund
endef
define Package/restund/conffiles
/etc/default/restund
/etc/init.d/restund
/etc/restund.conf
endef
define Package/restund/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
echo
echo "o-------------------------------------------------------------------o"
echo "| restund note |"
echo "o-------------------------------------------------------------------o"
echo "| restund has been dropped upstream and will be deleted from the |"
echo "| OpenWrt telephony feed in February 2022. |"
echo "| |"
echo "| You may want to migrate to the coturn package, which provides |"
echo "| turnserver. |"
echo "o-------------------------------------------------------------=^_^=-o"
echo
fi
exit 0
endef
#
# 1. Name
# 2. Title
# 3. Files
# 4. Depends
#
define BuildPlugin
define Package/restund-mod-$(1)
$$(call Package/restund/Default)
TITLE:=restund $(2) module
DEPENDS:=restund $(patsubst +%,+PACKAGE_$(PKG_NAME)-mod-$(1):%,$(4))
endef
define Package/restund-mod-$(1)/install
[ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/usr/lib/restund/modules
for f in $(3); do \
$(INSTALL_DATA) \
$(PKG_INSTALL_DIR)/usr/lib/restund/modules/$$$$$$$${f}.so \
$$(1)/usr/lib/restund/modules; \
done
endef
$$(eval $$(call BuildPackage,restund-mod-$(1)))
endef
$(eval $(call BuildPackage,restund))
$(eval $(call BuildPlugin,mysql,MySQL database backend,mysql_ser,+libmysqlclient))

View file

@ -1,8 +0,0 @@
### restund init configuration ###
# Uncomment once you verified your configuration, otherwise the init script will
# not start restund.
#ENABLE_RESTUND="yes"
# The following is added to the command line when starting restund:
OPTIONS=""

View file

@ -1,39 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2017 OpenWrt.org
START=60
USE_PROCD=1
#PROCD_DEBUG=1
DAEMON=restund
DEFAULT=/etc/default/$DAEMON
LOGGER="/usr/bin/logger -p user.err -s -t $DAEMON"
OPTIONS=
PROG=/usr/sbin/$DAEMON
[ -f $DEFAULT ] && . $DEFAULT
start_service() {
local dir=
if [ "$ENABLE_RESTUND" != yes ]; then
$LOGGER User configuration incomplete - not starting $DAEMON
$LOGGER Check ENABLE_RESTUND in $DEFAULT
exit 1
fi
procd_open_instance
procd_set_param command $PROG
procd_append_param command \
-n \
$OPTIONS
procd_set_param pidfile /var/run/${DAEMON}.pid
# forward stderr to logd
procd_set_param stderr 1
# forward stdout to logd
procd_set_param stdout 1
procd_set_param user $DAEMON
procd_close_instance
}

View file

@ -1,12 +0,0 @@
--- a/modules/status/status.c
+++ b/modules/status/status.c
@@ -30,9 +30,6 @@ static void server_info(struct mbuf *mb)
mbuf_write_str(mb, "<table>\n");
mbuf_write_str(mb,
" <tr><td>Version:</td><td>" VERSION "</td></tr>\n");
- mbuf_write_str(mb,
- " <tr><td>Built:</td><td>" __DATE__ " " __TIME__
- "</td></tr>\n");
mbuf_printf(mb, " <tr><td>Uptime:</td><td>%H</td></tr>\n",
fmt_human_time, &uptime);
mbuf_write_str(mb, "</table>\n");

View file

@ -1,69 +0,0 @@
From ffa2d56cac3d37715fe1381df81802774240da92 Mon Sep 17 00:00:00 2001
From: Dusan Stevanovic <dule@wire.com>
Date: Thu, 11 Mar 2021 10:58:32 +0100
Subject: [PATCH] turn: block forwarding to loopback/any
---
modules/turn/turn.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
--- a/modules/turn/turn.c
+++ b/modules/turn/turn.c
@@ -153,6 +153,7 @@ static bool indication_handler(struct re
struct stun_attr *data, *peer;
struct allocation *al;
struct perm *perm;
+ const struct sa *psa;
int err;
(void)sock;
(void)ctx;
@@ -173,13 +174,17 @@ static bool indication_handler(struct re
if (!peer || !data)
return true;
- perm = perm_find(al->perms, &peer->v.xor_peer_addr);
+ psa = &peer->v.xor_peer_addr;
+ perm = perm_find(al->perms, psa);
if (!perm) {
++al->dropc_tx;
return true;
}
- err = udp_send(al->rel_us, &peer->v.xor_peer_addr, &data->v.data);
+ if (sa_is_loopback(psa) || sa_is_any(psa))
+ err = EPERM;
+ else
+ err = udp_send(al->rel_us, psa, &data->v.data);
if (err)
turnd.errc_tx++;
else {
@@ -200,6 +205,7 @@ static bool raw_handler(int proto, const
uint16_t numb, len;
struct perm *perm;
struct chan *chan;
+ const struct sa *psa;
int err;
al = allocation_find(proto, src, dst);
@@ -219,7 +225,8 @@ static bool raw_handler(int proto, const
if (!chan)
return false;
- perm = perm_find(al->perms, chan_peer(chan));
+ psa = chan_peer(chan);
+ perm = perm_find(al->perms, psa);
if (!perm) {
++al->dropc_tx;
return false;
@@ -227,7 +234,10 @@ static bool raw_handler(int proto, const
mb->end = mb->pos + len;
- err = udp_send(al->rel_us, chan_peer(chan), mb);
+ if (sa_is_loopback(psa) || sa_is_any(psa))
+ err = EPERM;
+ else
+ err = udp_send(al->rel_us, psa, mb);
if (err)
turnd.errc_tx++;
else {

View file

@ -1,29 +0,0 @@
From e2f4094e23c73d4563a55f0de72244f34bb5b702 Mon Sep 17 00:00:00 2001
From: Dusan Stevanovic <dule@wire.com>
Date: Thu, 11 Mar 2021 11:53:50 +0100
Subject: [PATCH] turn: also don't forward linklocal addresses
---
modules/turn/turn.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/modules/turn/turn.c
+++ b/modules/turn/turn.c
@@ -181,7 +181,7 @@ static bool indication_handler(struct re
return true;
}
- if (sa_is_loopback(psa) || sa_is_any(psa))
+ if (sa_is_loopback(psa) || sa_is_any(psa) || sa_is_linklocal(psa))
err = EPERM;
else
err = udp_send(al->rel_us, psa, &data->v.data);
@@ -234,7 +234,7 @@ static bool raw_handler(int proto, const
mb->end = mb->pos + len;
- if (sa_is_loopback(psa) || sa_is_any(psa))
+ if (sa_is_loopback(psa) || sa_is_any(psa) || sa_is_linklocal(psa))
err = EPERM;
else
err = udp_send(al->rel_us, psa, mb);

View file

@ -1,52 +0,0 @@
From 955064fc220b5739010a2e207a8561ea44f974d3 Mon Sep 17 00:00:00 2001
From: Dusan Stevanovic <dule@wire.com>
Date: Thu, 11 Mar 2021 13:15:27 +0100
Subject: [PATCH] turn: block whole loopback range, also block broadcast
---
modules/turn/turn.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
--- a/modules/turn/turn.c
+++ b/modules/turn/turn.c
@@ -144,6 +144,22 @@ static bool request_handler(struct restu
return true;
}
+static inline bool is_loopback(const struct sa *sa)
+{
+ return (ntohl(sa->u.in.sin_addr.s_addr) & 0xffffff00) == 0x7f000000;
+}
+
+static inline bool is_broadcast(const struct sa *sa)
+{
+ return ntohl(sa->u.in.sin_addr.s_addr) == 0xffffffff;
+}
+
+static inline bool is_blocked(const struct sa *sa)
+{
+ return is_loopback(sa) || is_broadcast(sa)
+ || sa_is_any(sa) || sa_is_linklocal(sa);
+
+}
static bool indication_handler(struct restund_msgctx *ctx, int proto,
void *sock, const struct sa *src,
@@ -181,7 +197,7 @@ static bool indication_handler(struct re
return true;
}
- if (sa_is_loopback(psa) || sa_is_any(psa) || sa_is_linklocal(psa))
+ if (is_blocked(psa))
err = EPERM;
else
err = udp_send(al->rel_us, psa, &data->v.data);
@@ -234,7 +250,7 @@ static bool raw_handler(int proto, const
mb->end = mb->pos + len;
- if (sa_is_loopback(psa) || sa_is_any(psa) || sa_is_linklocal(psa))
+ if (is_blocked(psa))
err = EPERM;
else
err = udp_send(al->rel_us, psa, mb);