Browse Source

Merge pull request #16628 from mwarning/uradvd

uradvd: add new package
lilik-openwrt-22.03
Matthias Schiffer 3 years ago
committed by GitHub
parent
commit
0ffd7002df
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 120 additions and 0 deletions
  1. +37
    -0
      net/uradvd/Makefile
  2. +11
    -0
      net/uradvd/files/uradvd.config
  3. +72
    -0
      net/uradvd/files/uradvd.init

+ 37
- 0
net/uradvd/Makefile View File

@ -0,0 +1,37 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=uradvd
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/freifunk-gluon/uradvd.git
PKG_SOURCE_DATE:=2021-09-14
PKG_SOURCE_VERSION:=9b0da60e27c67305d251b10163e388191d566d7a
PKG_MIRROR_HASH=c3c9cb5d3a7b30503bff64541bbcaffa84b33e0de39560a5efae077df4e9b134
PKG_MAINTAINER:=Moritz Warning <moritzwarning@web.de>
PKG_LICENSE:=BSD-2-Clause
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/uradvd
SECTION:=net
CATEGORY:=Network
TITLE:=A tiny radvd
endef
define Package/uradvd/description
Advertise an IPv6 prefix/route via SLAAC.
endef
define Package/uradvd/install
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_DATA) ./files/uradvd.config $(1)/etc/config/
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) ./files/uradvd.init $(1)/etc/init.d/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uradvd $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,uradvd))

+ 11
- 0
net/uradvd/files/uradvd.config View File

@ -0,0 +1,11 @@
config interface
option enabled '0'
# send router advertisment over this device
# alternative: option device 'lan'
option ifname 'br-lan'
# lifetime of the default route (in seconds)
option default_lifetime '0'
list prefix_on_link '300::/64'
list prefix_off_link '200::/64'
list dns '2001:4860:4860::8888'

+ 72
- 0
net/uradvd/files/uradvd.init View File

@ -0,0 +1,72 @@
#!/bin/sh /etc/rc.common
START=50
USE_PROCD=1
ARGS=""
append_prefix_off_link() {
ARGS="$ARGS -a $1"
}
append_prefix_on_link() {
ARGS="$ARGS -p $1"
}
append_dns() {
ARGS="$ARGS --rdnss $1"
}
start_instance() {
local cfg="$1" enabled device ifname default_lifetime
ARGS=""
config_get_bool enabled $cfg 'enabled' 1
config_get device $cfg 'device'
config_get ifname $cfg 'ifname'
config_get default_lifetime $cfg 'default_lifetime'
if [ "$enabled" != "1" ]; then
exit 0
fi
if [ -n "$device" ] && [ -n "$ifname" ]; then
echo "either set device or ifname" >&2
exit 1
fi
if [ -z "$device" ] && [ -z "$ifname" ]; then
echo "either set device or ifname" >&2
exit 1
fi
if [ -z "$ifname" ]; then
network_get_device 'ifname' "$ifname"
fi
if [ -z "$ifname" ]; then
echo "no valid device or ifname set" >&2
exit 1
fi
if [ -n "$default_lifetime" ]; then
ARGS="$ARGS --default-lifetime $default_lifetime"
fi
ARGS="$ARGS -i $ifname"
config_list_foreach $cfg 'prefix_off_link' append_prefix_off_link
config_list_foreach $cfg 'prefix_on_link' append_prefix_on_link
config_list_foreach $cfg "dns" append_dns
procd_open_instance
procd_set_param command /usr/sbin/uradvd $ARGS
procd_set_param respawn
procd_close_instance
}
start_service() {
config_load uradvd
config_foreach start_instance interface
}

Loading…
Cancel
Save