From 543fc7298b55d05aae1fde7c7ed003ce9557aaa1 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 24 Aug 2016 12:35:35 +0200 Subject: [PATCH] package: explicitely configure DTLS mode --- openwrt/freewtp/files/wtp.config | 8 +------- openwrt/freewtp/files/wtp.init | 7 ++++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/openwrt/freewtp/files/wtp.config b/openwrt/freewtp/files/wtp.config index 5b16a95..61e78b7 100644 --- a/openwrt/freewtp/files/wtp.config +++ b/openwrt/freewtp/files/wtp.config @@ -3,10 +3,4 @@ config wtp option location 'Magdeburg' option name 'wtp-ap' option host '127.0.0.1' -# either use DTLS with ca, cert and key -# option ca '/etc/wtp/ca.crt' -# option cert '/etc/wtp/wtp.crt' -# option key '/etc/wtp/wtp.key' -# or PSK -# option identity 'myname' -# option psk 'verysecret' + option dtlsmode 'off' diff --git a/openwrt/freewtp/files/wtp.init b/openwrt/freewtp/files/wtp.init index 0eb13a5..af4ff5c 100755 --- a/openwrt/freewtp/files/wtp.init +++ b/openwrt/freewtp/files/wtp.init @@ -73,7 +73,7 @@ EOF wtp_conf_x509() { echo " dtls: {" - if [ -z "$psk" -a -z "$identity" -a -z "$ca" -a -z "$cert" -a -z "$key" ]; then + if [ "$dtlsmode" = "off" ]; then echo " enable = false;" echo " };" echo @@ -87,14 +87,14 @@ wtp_conf_x509() { echo " dtlsdatachannel = false;" echo " };" echo - if [ "$psk" -o "$identity" ]; then + if [ "$dtlsmode" = "psk" ]; then echo " type = \"presharedkey\";" echo echo " presharedkey: {" echo " identity = \"${identity}\";" echo " pskkey = \"${psk}\";" echo " };" - elif [ "$ca" -o "$cert" -o "$key" ]; then + elif [ "$dtlsmode" = "x509" ]; then echo " type = \"x509\";" echo echo " x509: {" @@ -265,6 +265,7 @@ wtp_uci_conf() { config_get location "$1" location config_get country "$1" country config_get name "$1" name + config_get dtlsmode "$1" dtlsmode config_get ca "$1" ca config_get cert "$1" cert config_get key "$1" key