openvpn: move list of params and bools to a separate file
authorYousong Zhou <yszhou4tech@gmail.com>
Sun, 26 Feb 2017 07:22:04 +0000 (15:22 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Tue, 7 Mar 2017 13:31:59 +0000 (21:31 +0800)
So that future patches for addition/removal of them can be more
readable

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
package/network/services/openvpn/Makefile
package/network/services/openvpn/files/openvpn.init
package/network/services/openvpn/files/openvpn.options [new file with mode: 0644]

index 7507e2029bb502c8e471be554c733eae1006fd1e..ebfc51f95562482e38f9fba32a48de0c5a849624 100644 (file)
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 PKG_NAME:=openvpn
 
 PKG_VERSION:=2.4.0
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE_URL:=http://swupdate.openvpn.net/community/releases
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
@@ -106,6 +106,7 @@ endef
 define Package/openvpn-$(BUILD_VARIANT)/install
        $(INSTALL_DIR) \
                $(1)/usr/sbin \
+               $(1)/usr/share/openvpn \
                $(1)/etc/init.d \
                $(1)/etc/config \
                $(1)/etc/openvpn \
@@ -118,6 +119,9 @@ define Package/openvpn-$(BUILD_VARIANT)/install
        $(INSTALL_BIN) \
                files/openvpn.init \
                $(1)/etc/init.d/openvpn
+       $(INSTALL_DATA) \
+               files/openvpn.options \
+               $(1)/usr/share/openvpn/openvpn.options
 
        $(INSTALL_CONF) files/openvpn.config \
                $(1)/etc/config/openvpn
index d1f37d5c0f5e74333ed153e3f00d54430c02a43f..0d77d65956946de4eb89ef9ffe0678a40845166c 100644 (file)
@@ -93,40 +93,14 @@ start_instance() {
        [ ! -d "/var/etc" ] && mkdir -p "/var/etc"
        [ -f "/var/etc/openvpn-$s.conf" ] && rm "/var/etc/openvpn-$s.conf"
 
-       # append flags
-       append_bools "$s" \
-               allow_recursive_routing auth_nocache auth_user_pass_optional bind ccd_exclusive client client_cert_not_required \
-               client_to_client comp_noadapt disable disable_occ down_pre duplicate_cn fast_io float http_proxy_retry \
-               ifconfig_noexec ifconfig_nowarn ifconfig_pool_linear management_forget_disconnect management_hold \
-               management_query_passwords management_signal mktun mlock mtu_test multihome mute_replay_warnings \
-               ncp_disable nobind no_iv no_name_remapping no_replay opt_verify passtos persist_key persist_local_ip \
-               persist_remote_ip persist_tun ping_timer_rem pull push_reset remote_random rmtun route_noexec route_nopull \
-               single_session socks_proxy_retry suppress_timestamps tcp_nodelay test_crypto tls_client tls_exit tls_server \
-               tun_ipv6 up_delay up_restart username_as_common_name
-
-       # append params
-       append_params "$s" \
-               cd askpass auth auth_retry auth_user_pass auth_user_pass_verify bcast_buffers ca cert capath \
-               chroot cipher client_config_dir client_connect client_disconnect comp_lzo compress connect_freq \
-               connect_retry connect_timeout connect_retry_max crl_verify dev dev_node dev_type dh \
-               ecdh_curve echo engine explicit_exit_notify fragment group hand_window hash_size http_proxy \
-               http_proxy_option http_proxy_timeout ifconfig ifconfig_pool ifconfig_pool_persist ifconfig_push \
-               inactive ipchange iroute keepalive key key_direction key_method keysize learn_address link_mtu lladdr \
-               local log log_append lport management management_log_cache max_clients max_routes_per_client mode \
-               mssfix mtu_disc mute ncp_ciphers nice ns_cert_type ping ping_exit ping_restart pkcs12 plugin \
-               port port_share prng proto pull_filter rcvbuf redirect_gateway remap_usr1 remote remote_cert_eku \
-               remote_cert_ku remote_cert_tls reneg_bytes reneg_pkts reneg_sec replay_persist replay_window \
-               resolv_retry route route_delay route_gateway route_metric route_pre_down route_up rport \
-               script_security secret server server_bridge setenv shaper sndbuf socks_proxy status status_version \
-               syslog tcp_queue_limit tls_auth tls_crypt tls_version_min tls_cipher tls_timeout \
-               tls_verify tmp_dir topology tran_window tun_mtu tun_mtu_extra txqueuelen user verb \
-               down push up verify_x509_name x509_username_field ifconfig_ipv6 route_ipv6 server_ipv6 \
-               ifconfig_ipv6_pool ifconfig_ipv6_push iroute_ipv6
+       append_bools "$s" $OPENVPN_BOOLS
+       append_params "$s" $OPENVPN_PARAMS
 
        openvpn_add_instance "$s" "/var/etc" "openvpn-$s.conf"
 }
 
 start_service() {
+       . /usr/share/openvpn/openvpn.options
        config_load 'openvpn'
        config_foreach start_instance 'openvpn'
 
diff --git a/package/network/services/openvpn/files/openvpn.options b/package/network/services/openvpn/files/openvpn.options
new file mode 100644 (file)
index 0000000..022f530
--- /dev/null
@@ -0,0 +1,197 @@
+OPENVPN_PARAMS='
+askpass
+auth
+auth_retry
+auth_user_pass
+auth_user_pass_verify
+bcast_buffers
+ca
+capath
+cd
+cert
+chroot
+cipher
+client_config_dir
+client_connect
+client_disconnect
+comp_lzo
+compress
+connect_freq
+connect_retry
+connect_retry_max
+connect_timeout
+crl_verify
+dev
+dev_node
+dev_type
+dh
+down
+ecdh_curve
+echo
+engine
+explicit_exit_notify
+fragment
+group
+hand_window
+hash_size
+http_proxy
+http_proxy_option
+http_proxy_timeout
+ifconfig
+ifconfig_ipv6
+ifconfig_ipv6_pool
+ifconfig_ipv6_push
+ifconfig_pool
+ifconfig_pool_persist
+ifconfig_push
+inactive
+ipchange
+iroute
+iroute_ipv6
+keepalive
+key
+key_direction
+key_method
+keysize
+learn_address
+link_mtu
+lladdr
+local
+log
+log_append
+lport
+management
+management_log_cache
+max_clients
+max_routes_per_client
+mode
+mssfix
+mtu_disc
+mute
+ncp_ciphers
+nice
+ns_cert_type
+ping
+ping_exit
+ping_restart
+pkcs12
+plugin
+port
+port_share
+prng
+proto
+pull_filter
+push
+rcvbuf
+redirect_gateway
+remap_usr1
+remote
+remote_cert_eku
+remote_cert_ku
+remote_cert_tls
+reneg_bytes
+reneg_pkts
+reneg_sec
+replay_persist
+replay_window
+resolv_retry
+route
+route_delay
+route_gateway
+route_ipv6
+route_metric
+route_pre_down
+route_up
+rport
+script_security
+secret
+server
+server_bridge
+server_ipv6
+setenv
+shaper
+sndbuf
+socks_proxy
+status
+status_version
+syslog
+tcp_queue_limit
+tls_auth
+tls_cipher
+tls_crypt
+tls_timeout
+tls_verify
+tls_version_min
+tmp_dir
+topology
+tran_window
+tun_mtu
+tun_mtu_extra
+txqueuelen
+up
+user
+verb
+verify_x509_name
+x509_username_field
+'
+
+OPENVPN_BOOLS='
+allow_recursive_routing
+auth_nocache
+auth_user_pass_optional
+bind
+ccd_exclusive
+client
+client_cert_not_required
+client_to_client
+comp_noadapt
+disable
+disable_occ
+down_pre
+duplicate_cn
+fast_io
+float
+http_proxy_retry
+ifconfig_noexec
+ifconfig_nowarn
+ifconfig_pool_linear
+management_forget_disconnect
+management_hold
+management_query_passwords
+management_signal
+mktun
+mlock
+mtu_test
+multihome
+mute_replay_warnings
+ncp_disable
+nobind
+no_iv
+no_name_remapping
+no_replay
+opt_verify
+passtos
+persist_key
+persist_local_ip
+persist_remote_ip
+persist_tun
+ping_timer_rem
+pull
+push_reset
+remote_random
+rmtun
+route_noexec
+route_nopull
+single_session
+socks_proxy_retry
+suppress_timestamps
+tcp_nodelay
+test_crypto
+tls_client
+tls_exit
+tls_server
+tun_ipv6
+up_delay
+up_restart
+username_as_common_name
+'