busybox: sysntpd: option to bind server to iface
[openwrt/staging/chunkeey.git] / package / utils / busybox / files / sysntpd
index e4a070762f2e6be299db8a7af7a8383062b0cf57..c4c311c242fead663c9b11b4c5522faf841b8845 100755 (executable)
@@ -30,7 +30,12 @@ get_dhcp_ntp_servers() {
 
 validate_ntp_section() {
        uci_load_validate system timeserver "$1" "$2" \
-               'server:list(host)' 'enabled:bool:1' 'enable_server:bool:0' 'use_dhcp:bool:1' 'dhcp_interface:list(string)'
+               'dhcp_interface:list(string)' \
+               'enable_server:bool:0' \
+               'enabled:bool:1' \
+               'interface:string' \
+               'server:list(host)' \
+               'use_dhcp:bool:1'
 }
 
 start_ntpd_instance() {
@@ -49,7 +54,10 @@ start_ntpd_instance() {
 
        procd_open_instance
        procd_set_param command "$PROG" -n -N
-       [ "$enable_server" = "1" ] && procd_append_param command -l
+       if [ "$enable_server" = "1" ]; then
+               procd_append_param command -l
+               [ -n "$interface" ] && procd_append_param command -I $interface
+       fi
        [ -x "$HOTPLUG_SCRIPT" ] && procd_append_param command -S "$HOTPLUG_SCRIPT"
        for peer in $server; do
                procd_append_param command -p $peer