siproxd: add max clients configuration and default 575/head
authorTony Ambardar <itugrok@yahoo.com>
Mon, 21 Sep 2020 14:01:28 +0000 (07:01 -0700)
committerTony Ambardar <itugrok@yahoo.com>
Wed, 23 Sep 2020 05:21:12 +0000 (22:21 -0700)
Add a configuration option SIPROXD_MAX_CLIENTS used for compile-time sizing
of the maximum supported proxy clients. Set this to a default value of 32,
which is more suitable for a small network or CPE router and uses much
less memory than the upstream value of 512 (e.g. RSS of 2 MB vs 17 MB).

Drop the following patch in favour of the new config option:

  * 005-reduce-rtpproxy-urlmap-size.patch

Also fix an incorrect configure option, and silence many warnings due to
unused VCS 'ident' variables in the sources.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
net/siproxd/Makefile
net/siproxd/patches/005-reduce-rtpproxy-urlmap-size.patch [deleted file]

index 30a4c11bff84bbd2beedd1cdd4cadde34ac748fe..d16c040f411242ebd41d1a01dd1625fee084c559 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=siproxd
 PKG_VERSION:=0.8.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/siproxd
@@ -19,6 +19,8 @@ PKG_FIXUP:=autoreconf
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
 
+PKG_CONFIG_DEPENDS:=CONFIG_SIPROXD_MAX_CLIENTS
+
 PKG_LICENSE:=GPL-2.0+
 PKG_LICENSE_FILES:=COPYING
 
@@ -46,14 +48,37 @@ define Package/siproxd/conffiles
 /etc/config/siproxd
 endef
 
+define Package/siproxd/config
+       config SIPROXD_MAX_CLIENTS
+               int "Max supported clients"
+               default 32
+               depends on PACKAGE_siproxd
+               help
+                 Default 32 is sufficient for home environments. Larger values
+                 consume more memory (e.g. RSS of 17 MB with upstream default 512).
+endef
+
 CONFIGURE_ARGS+= \
        --with-libosip-prefix="$(STAGING_DIR)/usr" \
-       --disable-ltdl-convenience \
+       --without-included-ltdl \
        --disable-doc
 
 MAKE_FLAGS+= \
        SUBDIRS="src scripts contrib"
 
+TARGET_CFLAGS+= \
+       -Wno-unused-const-variable
+
+URLMAP:=$(CONFIG_SIPROXD_MAX_CLIENTS)
+RTPPROXY:=$(shell expr $(URLMAP) \* 2)
+
+define Build/Configure
+       $(call Build/Configure/Default)
+       $(ESED) 's;^(#define[[:space:]]+URLMAP_SIZE).*$$$$;\1 $(URLMAP);' \
+               -e 's;^(#define[[:space:]]+RTPPROXY_SIZE).*$$$$;\1 $(RTPPROXY);' \
+               $(PKG_BUILD_DIR)/src/siproxd.h
+endef
+
 define Package/siproxd/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/siproxd $(1)/usr/sbin
@@ -72,7 +97,8 @@ define BuildPlugin
 
   define Package/siproxd-mod-$(subst _,-,$(1))/install
        $(INSTALL_DIR) $$(1)/usr/lib/siproxd
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/siproxd/plugin_$(1).so $$(1)/usr/lib/siproxd
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/siproxd/plugin_$(1).so \
+               $$(1)/usr/lib/siproxd
   endef
 
   $$(eval $$(call BuildPackage,siproxd-mod-$(subst _,-,$(1))))
diff --git a/net/siproxd/patches/005-reduce-rtpproxy-urlmap-size.patch b/net/siproxd/patches/005-reduce-rtpproxy-urlmap-size.patch
deleted file mode 100644 (file)
index 43587c5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-diff -urN siproxd-0.8.3/src/siproxd.h siproxd-0.8.3-patch/src/siproxd.h
---- siproxd-0.8.3/src/siproxd.h        2019-11-09 09:42:04.000000000 -0800
-+++ siproxd-0.8.3-patch/src/siproxd.h  2020-09-04 20:02:47.961246801 -0700
-@@ -282,13 +282,13 @@
- #define TCP_IDLE_TO   300     /* TCP connection idle timeout in seconds */
- #define TCP_CONNECT_TO        500     /* TCP connect() timeout in msec */
--#define URLMAP_SIZE   512     /* number of URL mapping table entries  */
-+#define URLMAP_SIZE   128     /* number of URL mapping table entries  */
-                               /* this limits the number of clients!   */
- #define SOURCECACHE_SIZE 256  /* number of return addresses           */
- #define DEJITTERLIMIT 1500000 /* max value for dejitter configuration */
--#define RTPPROXY_SIZE 1024    /* number of rtp proxy entries          */
-+#define RTPPROXY_SIZE 256     /* number of rtp proxy entries          */
-                               /* this limits the number of calls!     */
- #define BUFFER_SIZE   8196    /* input buffer for read from socket    */