Merge pull request #959 from rogerpueyo/openwrt-21.02-backport-bird1-fixes
Backport bird1-openwrt fixes to 21.02
This commit is contained in:
commit
8071852b45
7 changed files with 192 additions and 226 deletions
166
bird1-openwrt/Makefile
Normal file
166
bird1-openwrt/Makefile
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014-2017 Eloi Carbó <eloicaso@openmailbox.org>
|
||||||
|
# Copyright (C) 2022-2023 Roger Pueyo Centelles <roger.pueyo@guifi.net>
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
BIRD1_PKG := bird1
|
||||||
|
BIRD1_IPV4_PKG := $(BIRD1_PKG)-ipv4
|
||||||
|
BIRD1_IPV6_PKG := $(BIRD1_PKG)-ipv6
|
||||||
|
BIRD4 := bird4
|
||||||
|
BIRD6 := bird6
|
||||||
|
|
||||||
|
PKG_NAME := $(BIRD1_PKG)-openwrt
|
||||||
|
PKG_IPV4_NAME := $(BIRD1_IPV4_PKG)-openwrt
|
||||||
|
PKG_IPV6_NAME := $(BIRD1_IPV6_PKG)-openwrt
|
||||||
|
PKG_VERSION := 0.3
|
||||||
|
PKG_RELEASE := 5
|
||||||
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
PKG_LICENSE := GPL-3.0-or-later
|
||||||
|
|
||||||
|
PKG_UCI_NAME := $(BIRD1_PKG)-uci
|
||||||
|
PKG_LUCI_NAME := $(BIRD1_PKG)-luci
|
||||||
|
PKG_IPV4_UCI_NAME := $(BIRD1_IPV4_PKG)-uci
|
||||||
|
PKG_IPV6_UCI_NAME := $(BIRD1_IPV6_PKG)-uci
|
||||||
|
PKG_IPV4_LUCI_NAME := luci-app-$(BIRD1_IPV4_PKG)
|
||||||
|
PKG_IPV6_LUCI_NAME := luci-app-$(BIRD1_IPV6_PKG)
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Build/Prepare
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Build/Compile
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_UCI_NAME)/Default
|
||||||
|
TITLE:=The BIRD UCI module (v1.6)
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
SUBMENU:=Routing and Redirection
|
||||||
|
MAINTAINER:=Roger Pueyo Centelles <roger.pueyo@guifi.net>
|
||||||
|
URL:=https://github.com/openwrt/bird1-openwrt/
|
||||||
|
DEPENDS:=+libuci +uci
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_LUCI_NAME)/Default
|
||||||
|
TITLE:=LuCI support for BIRD (v1.6)
|
||||||
|
SECTION:=luci
|
||||||
|
CATEGORY:=LuCI
|
||||||
|
SUBMENU:=3. Applications
|
||||||
|
MAINTAINER:=Roger Pueyo Centelles <roger.pueyo@guifi.net>
|
||||||
|
URL:=https://github.com/openwrt/bird1-openwrt/
|
||||||
|
DEPENDS:=+luci-base +luci-compat
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_UCI_NAME)/description
|
||||||
|
$(BIRD1_PKG) UCI integration module
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_LUCI_NAME)/description
|
||||||
|
$(BIRD1_PKG) application for LuCI
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV4_UCI_NAME)
|
||||||
|
$(call Package/$(PKG_UCI_NAME)/Default)
|
||||||
|
TITLE+= (IPv4)
|
||||||
|
DEPENDS+= +$(BIRD1_IPV4_PKG)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV6_UCI_NAME)
|
||||||
|
$(call Package/$(PKG_UCI_NAME)/Default)
|
||||||
|
TITLE+= (IPv6)
|
||||||
|
DEPENDS+= +$(BIRD1_IPV6_PKG)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV4_LUCI_NAME)
|
||||||
|
$(call Package/$(PKG_LUCI_NAME)/Default)
|
||||||
|
TITLE+= (IPv4)
|
||||||
|
DEPENDS+= +$(PKG_IPV4_UCI_NAME)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV6_LUCI_NAME)
|
||||||
|
$(call Package/$(PKG_LUCI_NAME)/Default)
|
||||||
|
TITLE+= (IPv6)
|
||||||
|
DEPENDS+= +$(PKG_IPV6_UCI_NAME)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV4_UCI_NAME)/conffiles
|
||||||
|
/etc/config/$(BIRD4)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV6_UCI_NAME)/conffiles
|
||||||
|
/etc/config/$(BIRD6)
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV4_UCI_NAME)/install
|
||||||
|
$(INSTALL_DIR) $(1)/etc/$(BIRD4)/init.d
|
||||||
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
|
$(INSTALL_DIR) $(1)/etc/$(BIRD4)/filters
|
||||||
|
$(INSTALL_DIR) $(1)/etc/$(BIRD4)/functions
|
||||||
|
$(INSTALL_BIN) ./$(PKG_IPV4_NAME)/src/init.d/$(BIRD4)* $(1)/etc/$(BIRD4)/init.d/
|
||||||
|
$(CP) ./$(PKG_IPV4_NAME)/src/uci-defaults/* $(1)/etc/$(BIRD4)/init.d/
|
||||||
|
$(INSTALL_CONF) ./$(PKG_IPV4_NAME)/src/config/$(BIRD4) $(1)/etc/config/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV6_UCI_NAME)/install
|
||||||
|
$(INSTALL_DIR) $(1)/etc/$(BIRD6)/init.d
|
||||||
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
|
$(INSTALL_DIR) $(1)/etc/$(BIRD6)/filters
|
||||||
|
$(INSTALL_DIR) $(1)/etc/$(BIRD6)/functions
|
||||||
|
$(INSTALL_BIN) ./$(PKG_IPV6_NAME)/src/init.d/$(BIRD6)* $(1)/etc/$(BIRD6)/init.d/
|
||||||
|
$(CP) ./$(PKG_IPV6_NAME)/src/uci-defaults/* $(1)/etc/$(BIRD6)/init.d/
|
||||||
|
$(INSTALL_CONF) ./$(PKG_IPV6_NAME)/src/config/$(BIRD6) $(1)/etc/config/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV4_UCI_NAME)/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
|
( . /etc/$(BIRD4)/init.d/bird-uci-install-init.d $(BIRD4) ) && rm -f /etc/$(BIRD4)/init.d/bird-uci-install-init.d
|
||||||
|
( . /etc/$(BIRD4)/init.d/99-relocate-filters $(BIRD4) ) && rm -f /etc/$(BIRD4)/init.d/99-relocate-filters
|
||||||
|
if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD4) /etc/sysupgrade.conf; then
|
||||||
|
echo /etc/config/$(BIRD4) >> /etc/sysupgrade.conf
|
||||||
|
echo /etc/$(BIRD4)/filters/ >> /etc/sysupgrade.conf
|
||||||
|
echo /etc/$(BIRD4)/functions/ >> /etc/sysupgrade.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV6_UCI_NAME)/postinst
|
||||||
|
#!/bin/sh
|
||||||
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
|
( . /etc/$(BIRD6)/init.d/bird-uci-install-init.d $(BIRD6) ) && rm -f /etc/$(BIRD6)/init.d/bird-uci-install-init.d
|
||||||
|
( . /etc/$(BIRD6)/init.d/99-relocate-filters $(BIRD6) ) && rm -f /etc/$(BIRD6)/init.d/99-relocate-filters
|
||||||
|
if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD6) /etc/sysupgrade.conf; then
|
||||||
|
echo /etc/config/$(BIRD6) >> /etc/sysupgrade.conf
|
||||||
|
echo /etc/$(BIRD6)/filters/ >> /etc/sysupgrade.conf
|
||||||
|
echo /etc/$(BIRD6)/functions/ >> /etc/sysupgrade.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,$(PKG_IPV4_UCI_NAME)))
|
||||||
|
$(eval $(call BuildPackage,$(PKG_IPV6_UCI_NAME)))
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV4_LUCI_NAME)/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD4)/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD4)/
|
||||||
|
$(CP) ./$(PKG_IPV4_NAME)/src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD4)/
|
||||||
|
$(CP) ./$(PKG_IPV4_NAME)/src/controller/* $(1)/usr/lib/lua/luci/controller/
|
||||||
|
$(CP) ./$(PKG_IPV4_NAME)/src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD4)/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_IPV6_LUCI_NAME)/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD6)/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD6)/
|
||||||
|
$(CP) ./$(PKG_IPV6_NAME)/src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD6)/
|
||||||
|
$(CP) ./$(PKG_IPV6_NAME)/src/controller/* $(1)/usr/lib/lua/luci/controller/
|
||||||
|
$(CP) ./$(PKG_IPV6_NAME)/src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD6)/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,$(PKG_IPV4_LUCI_NAME)))
|
||||||
|
$(eval $(call BuildPackage,$(PKG_IPV6_LUCI_NAME)))
|
|
@ -1,103 +0,0 @@
|
||||||
# Copyright (C) 2014-2017 Eloi Carbo <eloicaso@openmailbox.org>
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
include $(INCLUDE_DIR)/kernel.mk
|
|
||||||
|
|
||||||
BIRD := bird4
|
|
||||||
BIRD_PKG := bird1-ipv4
|
|
||||||
PKG_NAME := $(BIRD_PKG)-openwrt
|
|
||||||
PKG_VERSION := 0.3
|
|
||||||
PKG_RELEASE := 1
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
|
||||||
PKG_LICENSE := GPL-3.0+
|
|
||||||
uci := $(BIRD_PKG)-uci
|
|
||||||
luci := luci-app-$(BIRD_PKG)
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
endef
|
|
||||||
define Build/Compile
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(uci)
|
|
||||||
TITLE:=The BIRD UCI module (v1.6) (IPv4)
|
|
||||||
SECTION:=net
|
|
||||||
CATEGORY:=Network
|
|
||||||
SUBMENU:=Routing and Redirection
|
|
||||||
MAINTAINER:=Eloi Carbo <eloicaso@openmailbox.org>
|
|
||||||
URL:=https://github.com/eloicaso/bird-openwrt/
|
|
||||||
DEPENDS:=+$(BIRD_PKG) +libuci +uci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(uci)/description
|
|
||||||
$(BIRD_PKG) UCI integration module
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(uci)/conffiles
|
|
||||||
/etc/config/$(BIRD)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(uci)/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/$(BIRD)/init.d
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
|
||||||
$(INSTALL_DIR) $(1)/etc/$(BIRD)/filters
|
|
||||||
$(INSTALL_DIR) $(1)/etc/$(BIRD)/functions
|
|
||||||
$(INSTALL_BIN) ./src/init.d/$(BIRD)* $(1)/etc/$(BIRD)/init.d/
|
|
||||||
$(CP) ./src/uci-defaults/* $(1)/etc/$(BIRD)/init.d/
|
|
||||||
$(INSTALL_CONF) ./src/config/$(BIRD) $(1)/etc/config/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(uci)/postinst
|
|
||||||
#!/bin/sh
|
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
|
||||||
( . /etc/$(BIRD)/init.d/bird-uci-install-init.d $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/bird-uci-install-init.d
|
|
||||||
( . /etc/$(BIRD)/init.d/99-relocate-filters $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/99-relocate-filters
|
|
||||||
if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD) /etc/sysupgrade.conf; then
|
|
||||||
echo /etc/config/$(BIRD) >> /etc/sysupgrade.conf
|
|
||||||
echo /etc/$(BIRD)/filters/ >> /etc/sysupgrade.conf
|
|
||||||
echo /etc/$(BIRD)/functions/ >> /etc/sysupgrade.conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(uci)))
|
|
||||||
|
|
||||||
define Package/$(luci)
|
|
||||||
TITLE:=LuCI support for $(BIRD_PKG)
|
|
||||||
SECTION:=luci
|
|
||||||
CATEGORY:=LuCI
|
|
||||||
SUBMENU:=3. Applications
|
|
||||||
MAINTAINER:=Eloi Carbo <eloicaso@openmailbox.org>
|
|
||||||
URL:=https://github.com/eloicaso/bird-openwrt/
|
|
||||||
DEPENDS:=+$(BIRD_PKG)-uci +luci-base
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(luci)/description
|
|
||||||
$(BIRD) application for LuCI
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(luci)/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD)/
|
|
||||||
$(CP) ./src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
|
|
||||||
$(CP) ./src/controller/* $(1)/usr/lib/lua/luci/controller/
|
|
||||||
$(CP) ./src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD)/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(luci)))
|
|
|
@ -23,7 +23,7 @@ function index()
|
||||||
_("Bird4"), 0)
|
_("Bird4"), 0)
|
||||||
|
|
||||||
entry({"admin", "network", "bird4", "status"},
|
entry({"admin", "network", "bird4", "status"},
|
||||||
cbi("bird4/status"),
|
form("bird4/status"),
|
||||||
_("Status"), 0).leaf = true
|
_("Status"), 0).leaf = true
|
||||||
|
|
||||||
entry({"admin","network","bird4","log"},
|
entry({"admin","network","bird4","log"},
|
||||||
|
@ -43,10 +43,10 @@ function index()
|
||||||
_("BGP Protocol"), 4).leaf = true
|
_("BGP Protocol"), 4).leaf = true
|
||||||
|
|
||||||
entry({"admin","network","bird4","filters"},
|
entry({"admin","network","bird4","filters"},
|
||||||
cbi("bird4/filters"),
|
form("bird4/filters"),
|
||||||
_("Filters"), 5).leaf = true
|
_("Filters"), 5).leaf = true
|
||||||
|
|
||||||
entry({"admin","network","bird4","functions"},
|
entry({"admin","network","bird4","functions"},
|
||||||
cbi("bird4/functions"),
|
form("bird4/functions"),
|
||||||
_("Functions"), 6).leaf = true
|
_("Functions"), 6).leaf = true
|
||||||
end
|
end
|
||||||
|
|
|
@ -56,12 +56,15 @@ get() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function: get_bool $1 $2
|
# Function: get_a_bool $1 $2
|
||||||
# $1 boolean. $2 string
|
# $1 boolean. $2 string
|
||||||
# This function uses the external UCI function "config_get_bool $result $section $option" to obtain a boolean value from UCI config file.
|
# This function uses the external UCI function "config_get_bool $result $section $option" to obtain a boolean value from UCI config file.
|
||||||
# To use this function, use the same name of the UCI option for the variable $1.
|
# To use this function, use the same name of the UCI option for the variable $1.
|
||||||
# Example: UCI (option use_ipv6 '1'); local use_ipv6; get use_ipv6 $section
|
# Example: UCI (option use_ipv6 '1'); local use_ipv6; get use_ipv6 $section
|
||||||
get_bool() {
|
# Note: this function was originally called get_bool(), but it collided with
|
||||||
|
# the get_bool() function provided by /lib/functions.sh. Read more at
|
||||||
|
# https://github.com/openwrt/routing/issues/920.
|
||||||
|
get_a_bool() {
|
||||||
config_get_bool $1 $2 $1
|
config_get_bool $1 $2 $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +204,7 @@ prepare_kernel() {
|
||||||
local disabled; local table; local kernel_table; local import; local export
|
local disabled; local table; local kernel_table; local import; local export
|
||||||
local scan_time; local persist; local learn
|
local scan_time; local persist; local learn
|
||||||
|
|
||||||
get_bool disabled ${section}
|
get_a_bool disabled ${section}
|
||||||
get table ${section}
|
get table ${section}
|
||||||
get import ${section}
|
get import ${section}
|
||||||
get export ${section}
|
get export ${section}
|
||||||
|
@ -328,7 +331,7 @@ prepare_bgp_template() {
|
||||||
local import_limit; local import_limit_action; local export_limit; local export_limit_action
|
local import_limit; local import_limit_action; local export_limit; local export_limit_action
|
||||||
local receive_limit; local receive_limit_action; local igp_table
|
local receive_limit; local receive_limit_action; local igp_table
|
||||||
|
|
||||||
get_bool disabled ${section}
|
get_a_bool disabled ${section}
|
||||||
get table ${section}
|
get table ${section}
|
||||||
get import ${section}
|
get import ${section}
|
||||||
get export ${section}
|
get export ${section}
|
||||||
|
@ -338,8 +341,8 @@ prepare_bgp_template() {
|
||||||
get neighbor_address ${section}
|
get neighbor_address ${section}
|
||||||
get neighbor_as ${section}
|
get neighbor_as ${section}
|
||||||
|
|
||||||
get_bool next_hop_self ${section}
|
get_a_bool next_hop_self ${section}
|
||||||
get_bool next_hop_keep ${section}
|
get_a_bool next_hop_keep ${section}
|
||||||
get rr_client ${section}
|
get rr_client ${section}
|
||||||
get rr_cluster_id ${section}
|
get rr_cluster_id ${section}
|
||||||
|
|
||||||
|
@ -417,8 +420,8 @@ prepare_bgp() {
|
||||||
|
|
||||||
get receive_limit ${section}
|
get receive_limit ${section}
|
||||||
get receive_limit_action ${section}
|
get receive_limit_action ${section}
|
||||||
get_bool next_hop_self ${section}
|
get_a_bool next_hop_self ${section}
|
||||||
get_bool next_hop_keep ${section}
|
get_a_bool next_hop_keep ${section}
|
||||||
get rr_client ${section}
|
get rr_client ${section}
|
||||||
get rr_cluster_id ${section}
|
get rr_cluster_id ${section}
|
||||||
|
|
||||||
|
|
|
@ -1,103 +0,0 @@
|
||||||
# Copyright (C) 2014-2017 Eloi Carbo <eloicaso@openmailbox.org>
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
include $(INCLUDE_DIR)/kernel.mk
|
|
||||||
|
|
||||||
BIRD := bird6
|
|
||||||
BIRD_PKG := bird1-ipv6
|
|
||||||
PKG_NAME := $(BIRD_PKG)-openwrt
|
|
||||||
PKG_VERSION := 0.3
|
|
||||||
PKG_RELEASE := 1
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
|
||||||
PKG_LICENSE := GPL-3.0+
|
|
||||||
uci := $(BIRD_PKG)-uci
|
|
||||||
luci := luci-app-$(BIRD_PKG)
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
endef
|
|
||||||
define Build/Compile
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(uci)
|
|
||||||
TITLE:=The BIRD UCI module (v1.6) (IPv6)
|
|
||||||
SECTION:=net
|
|
||||||
CATEGORY:=Network
|
|
||||||
SUBMENU:=Routing and Redirection
|
|
||||||
MAINTAINER:=Eloi Carbo <eloicaso@openmailbox.org>
|
|
||||||
URL:=https://github.com/eloicaso/bird-openwrt/
|
|
||||||
DEPENDS:=+$(BIRD_PKG) +libuci +uci
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(uci)/description
|
|
||||||
$(BIRD_PKG) UCI integration module
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(uci)/conffiles
|
|
||||||
/etc/config/$(BIRD)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(uci)/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/$(BIRD)/init.d
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
|
||||||
$(INSTALL_DIR) $(1)/etc/$(BIRD)/filters
|
|
||||||
$(INSTALL_DIR) $(1)/etc/$(BIRD)/functions
|
|
||||||
$(INSTALL_BIN) ./src/init.d/$(BIRD)* $(1)/etc/$(BIRD)/init.d/
|
|
||||||
$(CP) ./src/uci-defaults/* $(1)/etc/$(BIRD)/init.d/
|
|
||||||
$(INSTALL_CONF) ./src/config/$(BIRD) $(1)/etc/config/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(uci)/postinst
|
|
||||||
#!/bin/sh
|
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
|
||||||
( . /etc/$(BIRD)/init.d/bird-uci-install-init.d $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/bird-uci-install-init.d
|
|
||||||
( . /etc/$(BIRD)/init.d/99-relocate-filters $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/99-relocate-filters
|
|
||||||
if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD) /etc/sysupgrade.conf; then
|
|
||||||
echo /etc/config/$(BIRD) >> /etc/sysupgrade.conf
|
|
||||||
echo /etc/$(BIRD)/filters/ >> /etc/sysupgrade.conf
|
|
||||||
echo /etc/$(BIRD)/functions/ >> /etc/sysupgrade.conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(uci)))
|
|
||||||
|
|
||||||
define Package/$(luci)
|
|
||||||
TITLE:=LuCI support for $(BIRD_PKG)
|
|
||||||
SECTION:=luci
|
|
||||||
CATEGORY:=LuCI
|
|
||||||
SUBMENU:=3. Applications
|
|
||||||
MAINTAINER:=Eloi Carbo <eloicaso@openmailbox.org>
|
|
||||||
URL:=https://github.com/eloicaso/bird-openwrt/
|
|
||||||
DEPENDS:=+$(BIRD_PKG)-uci +luci-base
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(luci)/description
|
|
||||||
$(BIRD) application for LuCI
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/$(luci)/install
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
|
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD)/
|
|
||||||
$(CP) ./src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
|
|
||||||
$(CP) ./src/controller/* $(1)/usr/lib/lua/luci/controller/
|
|
||||||
$(CP) ./src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD)/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(luci)))
|
|
|
@ -23,7 +23,7 @@ function index()
|
||||||
_("Bird6"), 0)
|
_("Bird6"), 0)
|
||||||
|
|
||||||
entry({"admin", "network", "bird6", "status"},
|
entry({"admin", "network", "bird6", "status"},
|
||||||
cbi("bird6/status"),
|
form("bird6/status"),
|
||||||
_("Status"), 0).leaf = true
|
_("Status"), 0).leaf = true
|
||||||
|
|
||||||
entry({"admin","network","bird6","log"},
|
entry({"admin","network","bird6","log"},
|
||||||
|
@ -43,10 +43,10 @@ function index()
|
||||||
_("BGP Protocol"), 4).leaf = true
|
_("BGP Protocol"), 4).leaf = true
|
||||||
|
|
||||||
entry({"admin","network","bird6","filters"},
|
entry({"admin","network","bird6","filters"},
|
||||||
cbi("bird6/filters"),
|
form("bird6/filters"),
|
||||||
_("Filters"), 5).leaf = true
|
_("Filters"), 5).leaf = true
|
||||||
|
|
||||||
entry({"admin","network","bird6","functions"},
|
entry({"admin","network","bird6","functions"},
|
||||||
cbi("bird6/functions"),
|
form("bird6/functions"),
|
||||||
_("Functions"), 6).leaf = true
|
_("Functions"), 6).leaf = true
|
||||||
end
|
end
|
||||||
|
|
|
@ -57,12 +57,15 @@ get() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function: get_bool $1 $2
|
# Function: get_a_bool $1 $2
|
||||||
# $1 boolean. $2 string
|
# $1 boolean. $2 string
|
||||||
# This function uses the external UCI function "config_get_bool $result $section $option" to obtain a boolean value from UCI config file.
|
# This function uses the external UCI function "config_get_bool $result $section $option" to obtain a boolean value from UCI config file.
|
||||||
# To use this function, use the same name of the UCI option for the variable $1.
|
# To use this function, use the same name of the UCI option for the variable $1.
|
||||||
# Example: UCI (option use_ipv6 '1'); local use_ipv6; get use_ipv6 $section
|
# Example: UCI (option use_ipv6 '1'); local use_ipv6; get use_ipv6 $section
|
||||||
get_bool() {
|
# Note: this function was originally called get_bool(), but it collided with
|
||||||
|
# the get_bool() function provided by /lib/functions.sh. Read more at
|
||||||
|
# https://github.com/openwrt/routing/issues/920.
|
||||||
|
get_a_bool() {
|
||||||
config_get_bool $1 $2 $1
|
config_get_bool $1 $2 $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +198,7 @@ prepare_kernel() {
|
||||||
local disabled; local table; local kernel_table; local import; local export
|
local disabled; local table; local kernel_table; local import; local export
|
||||||
local scan_time; local persist; local learn
|
local scan_time; local persist; local learn
|
||||||
|
|
||||||
get_bool disabled ${section}
|
get_a_bool disabled ${section}
|
||||||
get table ${section}
|
get table ${section}
|
||||||
get import ${section}
|
get import ${section}
|
||||||
get export ${section}
|
get export ${section}
|
||||||
|
@ -322,9 +325,9 @@ prepare_bgp_template() {
|
||||||
local import_limit; local import_limit_action; local export_limit; local export_limit_action
|
local import_limit; local import_limit_action; local export_limit; local export_limit_action
|
||||||
local receive_limit; local receive_limit_action; local igp_table
|
local receive_limit; local receive_limit_action; local igp_table
|
||||||
|
|
||||||
get_bool disabled ${section}
|
get_a_bool disabled ${section}
|
||||||
get_bool next_hop_self ${section}
|
get_a_bool next_hop_self ${section}
|
||||||
get_bool next_hop_keep ${section}
|
get_a_bool next_hop_keep ${section}
|
||||||
get table ${section}
|
get table ${section}
|
||||||
get import ${section}
|
get import ${section}
|
||||||
get export ${section}
|
get export ${section}
|
||||||
|
|
Loading…
Reference in a new issue