ocserv: Added option to pass split-dns configuration to clients
authorNikos Mavrogiannopoulos <redacted>
Tue, 24 Nov 2015 23:04:03 +0000 (00:04 +0100)
committerNikos Mavrogiannopoulos <redacted>
Tue, 24 Nov 2015 23:04:03 +0000 (00:04 +0100)
Relates to #1975

Signed-off-by: Nikos Mavrogiannopoulos <redacted>
net/ocserv/Makefile
net/ocserv/README
net/ocserv/files/ocserv.conf.template
net/ocserv/files/ocserv.init

index f205ba0a95d7971d75abc5443eae940fc93aef12..4024e9bad936cd60ab2deda241a1d695678b9a22 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ocserv
 PKG_VERSION:=0.10.9
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_USE_MIPS16:=0
 
 PKG_BUILD_DIR :=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
index ed1ff4287f0ae65bb75c3f5f967559225b1c3f66..018b2f95cc778652701ce7ea2529b937ebdb3a3c 100644 (file)
@@ -105,6 +105,22 @@ config ocservusers
 -----------------------------------------------------------------
 ```
 
+Setting up split-dns
+====================
+
+To allow the clients to resolv with the local domain add the following
+to the ocserv configuration file.
+
+```
+----/etc/config/ocserv-------------------------------------------
+config ocserv 'config'
+       option split_dns '1'
+       option default_domain 'mydomain'
+```
+
+The ```default_domain``` is optional and if not set, it will be autodetected
+from dnsmasq's configuration.
+
 
 Setting up the firewall
 =======================
index 24ae2f0ec9067e8a17208e301d4f99d8606c3864..d3a8860aad9f0c56dbd4278d8e8a2c08b00e418d 100644 (file)
@@ -271,7 +271,7 @@ ipv4-netmask = |NETMASK|
 
 # The domains over which the provided DNS should be used. Use
 # multiple lines for multiple domains.
-|ENABLE_DEFAULT_DOMAIN|split-dns = |DEFAULT_DOMAIN|
+|ENABLE_SPLIT_DNS|split-dns = |DEFAULT_DOMAIN|
 
 # Prior to leasing any IP from the pool ping it to verify that
 # it is not in use by another (unrelated to this server) host.
index 61eb67cd32efcd30b619ba0c288f5fb93ce50c90..cbbe91af0e9b13a9df0a27ad35d3c6be1f701330 100644 (file)
@@ -18,6 +18,7 @@ setup_config() {
        config_get ip6addr      $1 ip6addr ""
        config_get proxy_arp    $1 proxy_arp "0"
        config_get ping_leases  $1 ping_leases "0"
+       config_get split_dns    $1 split_dns "0"
        config_get default_domain  $1 default_domain ""
 
        # Enable proxy arp, and make sure that ping leases is set to true in that case,
@@ -57,6 +58,7 @@ setup_config() {
        enable_default_domain="#"
        enable_udp="#"
        enable_compression="#"
+       enable_split_dns="#"
        test $predictable_ips = "0" && predictable_ips="false"
        test $predictable_ips = "1" && predictable_ips="true"
        test $cisco_compat = "0" && cisco_compat="false"
@@ -64,8 +66,11 @@ setup_config() {
        test $ping_leases = "0" && ping_leases="false"
        test $ping_leases = "1" && ping_leases="true"
        test $udp = "1" && enable_udp=""
+       test $split_dns = "1" && enable_split_dns=""
        test $compression = "1" && enable_compression=""
-       test -z $default_domain && enable_default_domain=""
+
+       test $split_dns = "1" && test -z $default_domain && default_domain=$(uci get dhcp.@dnsmasq[0].domain)
+       test -n $default_domain && enable_default_domain=""
        test -z $ip6addr && enable_ipv6="#"
 
        test $auth = "plain" && authsuffix="\[passwd=/var/etc/ocpasswd\]"
@@ -84,6 +89,7 @@ setup_config() {
            -e "s/|PREDICTABLE_IPS|/$predictable_ips/g" \
            -e "s/|DEFAULT_DOMAIN|/$default_domain/g" \
            -e "s/|ENABLE_DEFAULT_DOMAIN|/$enable_default_domain/g" \
+           -e "s/|ENABLE_SPLIT_DNS|/$enable_split_dns/g" \
            -e "s/|CISCO_COMPAT|/$cisco_compat/g" \
            -e "s/|PING_LEASES|/$ping_leases/g" \
            -e "s/|UDP|/$enable_udp/g" \
git clone https://git.99rst.org/PROJECT