From 4227dad822e0ddc7feb3e715ce5974f2965403b7 Mon Sep 17 00:00:00 2001 From: Qian Date: Thu, 27 Apr 2017 17:55:11 -0700 Subject: [PATCH] ocserv: split UDP and TCP port configs Added a new config entry udp_port to split UDP port from TCP. This is useful when particular port is blocked by the ISP. udp_port falls back to port if not set to be compatible with current config file. Also fixed an ifname typo from the last commit. Signed-off-by: Qian Sheng --- net/ocserv/Makefile | 2 +- net/ocserv/files/ocserv.conf.template | 2 +- net/ocserv/files/ocserv.init | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/net/ocserv/Makefile b/net/ocserv/Makefile index d99c5ba27d..502fab2972 100644 --- a/net/ocserv/Makefile +++ b/net/ocserv/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ocserv PKG_VERSION:=0.11.7 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_USE_MIPS16:=0 PKG_BUILD_DIR :=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) diff --git a/net/ocserv/files/ocserv.conf.template b/net/ocserv/files/ocserv.conf.template index a46c21c63c..1e71e9ce2c 100644 --- a/net/ocserv/files/ocserv.conf.template +++ b/net/ocserv/files/ocserv.conf.template @@ -43,7 +43,7 @@ max-same-clients = |MAX_SAME| # TCP and UDP port number tcp-port = |PORT| -|UDP|udp-port = |PORT| +|UDP|udp-port = |UDP_PORT| # Stats report time. The number of seconds after which each # worker process will report its usage statistics (number of diff --git a/net/ocserv/files/ocserv.init b/net/ocserv/files/ocserv.init index 63d0caae00..489ec897f4 100755 --- a/net/ocserv/files/ocserv.init +++ b/net/ocserv/files/ocserv.init @@ -13,6 +13,7 @@ setup_config() { config_get predictable_ips $1 predictable_ips "1" config_get compression $1 compression "0" config_get udp $1 udp "1" + config_get udp_port $1 udp_port "" config_get auth $1 auth "plain" config_get cisco_compat $1 cisco_compat "1" config_get ipaddr $1 ipaddr "" @@ -48,8 +49,7 @@ setup_config() { ping_leases=1 local ifname - network_get_device ifname lan - if test -n "ifname";then + if network_get_device ifname lan; then test -n "$ipaddr" && sysctl -w "net.ipv4.conf.$ifname.proxy_arp"=1 >/dev/null test -n "$ip6addr" && sysctl -w "net.ipv6.conf.$ifname.proxy_ndp"=1 >/dev/null fi @@ -72,6 +72,7 @@ setup_config() { test $split_dns = "1" && enable_split_dns="" test $compression = "1" && enable_compression="" + test -z $udp_port && udp_port="$port" test -z $default_domain && default_domain=$(uci get dhcp.@dnsmasq[0].domain) test -n $default_domain && enable_default_domain="" test -z $ip6addr && enable_ipv6="#" @@ -84,6 +85,7 @@ setup_config() { mkdir -p /var/etc sed -e "s/|PORT|/$port/g" \ + -e "s/|UDP_PORT|/$udp_port/g" \ -e "s/|MAX_CLIENTS|/$max_clients/g" \ -e "s/|MAX_SAME|/$max_same/g" \ -e "s/|DPD|/$dpd/g" \ -- 2.30.2