bandwidthd: update to 2.0.1-34, sqlite support and SMTP tracking

Addition of sqlite storage
Tracking of SMTP traffic instead of P2P traffic
Based on NethServer bandwidthd implementation

Signed-off-by: Jean-Michel lacroix <lacroix@lepine-lacroix.info>
This commit is contained in:
Jean-Michel Lacroix
2017-01-01 12:44:56 -05:00
parent a876e13fd6
commit 5c9665a070
26 changed files with 1130 additions and 209 deletions
+129 -26
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2015 OpenWrt.org
# Copyright (C) 2006-2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bandwidthd
PKG_VERSION:=2.0.1
PKG_RELEASE:=5
PKG_VERSION:=2.0.1-34
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=@SF/bandwidthd
PKG_MD5SUM:=aa79aad7bd489fd2cae1f7dc086ca8b6
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/NethServer/bandwidthd/archive/$(PKG_VERSION)
PKG_MD5SUM:=a4075335d06fe91ae815616ed9e27375
PKG_MAINTAINER:=Jean-Michel Lacroix <lacroix@lepine-lacroix.info>
@@ -21,6 +21,8 @@ PKG_LICENSE:=GPL-2.0
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
define Package/bandwidthd/Default
@@ -32,8 +34,8 @@ endef
define Package/bandwidthd
$(call Package/bandwidthd/Default)
TITLE += (without postgresql)
VARIANT:=no-pgsql
TITLE += (without database)
VARIANT:=no-db
DEPENDS:=+libgd +libpcap
endef
@@ -44,6 +46,20 @@ $(call Package/bandwidthd/Default)
DEPENDS:=+libgd +libpcap +libpq
endef
define Package/bandwidthd-sqlite
$(call Package/bandwidthd/Default)
TITLE += (with sqlite enabled)
VARIANT:=sqlite
DEPENDS:=+libgd +libpcap +libsqlite3 +php7 +php7-cgi +php7-mod-gd +php7-mod-pdo +php7-mod-pdo-sqlite
endef
define Package/bandwidthd-php
$(call Package/bandwidthd/Default)
TITLE = PHP files to graph bandwidthd data from postgresql
VARIANT:=php
DEPENDS:=+libpcre +libxml2 +php7 +php7-cgi +php7-mod-pgsql +php7-mod-gd
endef
define Package/bandwidthd/description
A bandwidthd tracking utility.
endef
@@ -53,15 +69,32 @@ $(call Package/bandwidthd/description)
With the ability to store in a postgresql database.
endef
define Package/bandwidthd-sqlite/description
$(call Package/bandwidthd/description)
With the ability to store in a sqlite database.
endef
define Package/bandwidthd-php/description
PHP files to graph bandwidthd data from pgsql.
endef
define Package/bandwidthd/daemon
This package contains bandwidthd a bandwidth tracking utility.
This package contains bandwidthd, a bandwidth tracking utility.
endef
define Package/bandwidthd-pgsql/daemon
This package contains bandwidthd a bandwidth tracking utility.
This package contains bandwidthd, a bandwidth tracking utility.
endef
ifeq ($(BUILD_VARIANT),no-pgsql)
define Package/bandwidthd-sqlite/daemon
This package contains bandwidthd, a bandwidth tracking utility.
endef
define Package/bandwidthd-php/daemon
This package contains the PHP files to graph the data from a pgsql database.
endef
ifeq ($(BUILD_VARIANT),no-db)
CONFIGURE_ARGS += \
ac_cv_file__sw_lib=no \
ac_cv_file__sw_include=no \
@@ -69,20 +102,45 @@ CONFIGURE_ARGS += \
ac_cv_file__usr_pkg_include=no \
ac_cv_file__usr_local_pgsql_lib=no \
ac_cv_file__usr_local_pgsql_include=no \
ac_cv_lib_pq_PQconnectdb=no
ac_cv_lib_pq_PQconnectdb=no \
ac_cv_lib_sqlite3_sqlite3_open=no
endif
ifeq ($(BUILD_VARIANT),pgsql)
CONFIGURE_ARGS += \
ac_cv_file__sw_lib=no \
ac_cv_file__sw_include=no \
ac_cv_file__usr_pkg_lib=no \
ac_cv_file__usr_pkg_include=no \
ac_cv_file__usr_local_pgsql_lib=no \
ac_cv_file__usr_local_pgsql_include=no
ac_cv_file__sw_lib=no \
ac_cv_file__sw_include=no \
ac_cv_file__usr_pkg_lib=no \
ac_cv_file__usr_pkg_include=no \
ac_cv_file__usr_local_pgsql_lib=no \
ac_cv_file__usr_local_pgsql_include=no \
ac_cv_lib_sqlite3_sqlite3_open=no
endif
EXTRA_CFLAGS+= $(TARGET_CPPFLAGS) -std=gnu89
ifeq ($(BUILD_VARIANT),sqlite)
CONFIGURE_ARGS += \
ac_cv_file__sw_lib=no \
ac_cv_file__sw_include=no \
ac_cv_file__usr_pkg_lib=no \
ac_cv_file__usr_pkg_include=no \
ac_cv_file__usr_local_pgsql_lib=no \
ac_cv_file__usr_local_pgsql_include=no \
ac_cv_lib_pq_PQconnectdb=no
endif
ifeq ($(BUILD_VARIANT),php)
CONFIGURE_ARGS += \
ac_cv_file__sw_lib=no \
ac_cv_file__sw_include=no \
ac_cv_file__usr_pkg_lib=no \
ac_cv_file__usr_pkg_include=no \
ac_cv_file__usr_local_pgsql_lib=no \
ac_cv_file__usr_local_pgsql_include=no \
ac_cv_lib_pq_PQconnectdb=no \
ac_cv_lib_sqlite3_sqlite3_open=no
endif
EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
EXTRA_LDFLAGS+= $(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
define Package/bandwidthd/install
@@ -93,8 +151,8 @@ define Package/bandwidthd/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd
$(INSTALL_DIR) $(1)/www
$(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/logo.gif $(1)/www/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/
$(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/logo.gif
endef
define Package/bandwidthd-pgsql/install
@@ -103,15 +161,50 @@ define Package/bandwidthd-pgsql/install
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/bandwidthd-pgsql.config $(1)/etc/config/bandwidthd
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/bandwidthd-pgsql.init $(1)/etc/init.d/bandwidthd
$(INSTALL_DIR) $(1)/www/phphtdocs
$(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/
$(INSTALL_DATA) ./files/logo.gif $(1)/www/
$(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd
$(INSTALL_DIR) $(1)/www
$(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/
$(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/logo.gif
$(INSTALL_DIR) $(1)/usr/share/postgresql
$(INSTALL_DATA) $(PKG_BUILD_DIR)/schema.postgresql $(1)/usr/share/postgresql
$(INSTALL_BIN) $(PKG_BUILD_DIR)/phphtdocs/bd_pgsql_purge.sh $(1)/usr/share/postgresql
endef
define Package/bandwidthd-sqlite/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/bandwidthd-sqlite.config $(1)/etc/config/bandwidthd
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/bandwidthd-sqlite.init $(1)/etc/init.d/bandwidthd
$(INSTALL_DIR) $(1)/www/phphtdocs
$(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/phphtdocs-sqlite/details.php $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/phphtdocs-sqlite/footer.php $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/phphtdocs-sqlite/graph.php $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/phphtdocs-sqlite/include.php $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/phphtdocs-sqlite/index.php $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/phphtdocs/logo.gif
ln -s /var/etc/bandwidthd-php.conf $(1)/www/phphtdocs/config.conf.php
$(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/
$(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/logo.gif
endef
define Package/bandwidthd-php/install
$(INSTALL_DIR) $(1)/www/phphtdocs
$(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/phphtdocs/details.php $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/phphtdocs/footer.php $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/phphtdocs/graph.php $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/phphtdocs/include.php $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/phphtdocs/index.php $(1)/www/phphtdocs/
$(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/phphtdocs/logo.gif
ln -s /var/etc/bandwidthd-php.conf $(1)/www/phphtdocs/config.conf
$(INSTALL_DIR) $(1)//etc/config
$(INSTALL_CONF) ./files/bandwidthd-php.config $(1)/etc/config/bandwidthd-php
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/bandwidthd-php.init $(1)/etc/init.d/bandwidthd-php
endef
define Package/bandwidthd/conffiles
/etc/config/bandwidthd
endef
@@ -120,5 +213,15 @@ define Package/bandwidthd-pgsql/conffiles
/etc/config/bandwidthd
endef
define Package/bandwidthd-sqlite/conffiles
/etc/config/bandwidthd
endef
define Package/bandwidthd-php/conffiles
/etc/config/bandwidthd-php
endef
$(eval $(call BuildPackage,bandwidthd))
$(eval $(call BuildPackage,bandwidthd-pgsql))
$(eval $(call BuildPackage,bandwidthd-sqlite))
$(eval $(call BuildPackage,bandwidthd-php))