[packages] chrony: use network.sh to find subnet

git-svn-id: svn://svn.openwrt.org/openwrt/packages@31975 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2012-05-29 01:47:55 +00:00
parent 25a50447bb
commit debb9936a4
2 changed files with 7 additions and 16 deletions

View 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/ \

View 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