[packages] chrony: use network.sh to find subnet
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 29 May 2012 01:47:55 +0000 (01:47 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 29 May 2012 01:47:55 +0000 (01:47 +0000)
SVN-Revision: 31975

net/chrony/Makefile
net/chrony/files/ntpd.init

index 7ce3ec330d5b0553975cbfc9c3460fec1420b79c..dc7b5ad0e5ecf163fc4a1a85c17acb257d3dda26 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2009 OpenWrt.org
+# Copyright (C) 2006-2012 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=chrony
 PKG_VERSION:=1.26
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:= ftp://download.tuxfamily.org/projects/chrony/ \
index dae0184daa5b09e571d5fe32b0749c8d037f7bb3..6e742faf383275008fb4e3a18dfbe8c70aba88c9 100644 (file)
@@ -15,8 +15,8 @@ start() {
                config_get NTP_SERVERS $CONFIG_SECTION TimeServers
                config_get CLIENT_NETWORKS $CONFIG_SECTION ClientAccessFrom
                CHRONY_KEY=$(awk '/^1 / { print $2; }' /etc/chrony/chrony.keys)
-               include /lib/network
-               scan_interfaces
+
+               . /lib/functions/network.sh
 
                # Define servers and do a rapid series of time measurements
                # to get up to date
@@ -35,18 +35,9 @@ start() {
                        echo password $CHRONY_KEY
                        echo makestep
                        for NETNAME in $CLIENT_NETWORKS; do
-                               local INTERFACE
-                               local IP
-                               local NETMASK
-                               local BROADCAST
-                               local NETWORK
-                               local PREFIX
-
-                               config_get INTERFACE "$NETNAME" ifname
-                               if [ -n "$INTERFACE" ] ; then
-                                       eval $(ifconfig $INTERFACE | grep inet | sed -e 's/.*addr:/IP=/' -e 's/ .*Mask:/; NETMASK=/')
-                                       eval $(ipcalc.sh $IP $NETMASK)
-                                       echo allow $NETWORK/$PREFIX
+                               local subnet
+                               if network_get_subnet subnet "$NETNAME"; then
+                                       echo allow $subnet
                                fi
                        done
                ) | chronyc > /dev/null 2>&1