Skip to content

Commit

Permalink
Add package gluon-radv-filterd
Browse files Browse the repository at this point in the history
This package drops all incoming router advertisements except for the
default router with the best metric according to B.A.T.M.A.N. advanced.

Note that advertisements originating from the node itself (for example
via gluon-radvd) are not affected.
  • Loading branch information
jplitza committed Jul 30, 2016
1 parent 3d3eb24 commit c6dcbe2
Show file tree
Hide file tree
Showing 6 changed files with 592 additions and 0 deletions.
41 changes: 41 additions & 0 deletions package/gluon-radv-filterd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=gluon-radv-filterd
PKG_VERSION:=1
PKG_RELEASE:=1

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

define Package/gluon-radv-filterd
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Filter IPv6 router advertisements
DEPENDS:=+gluon-ebtables
endef

define Package/gluon-radv-filterd/description
Gluon community wifi mesh firmware framework: filter IPv6 router advertisements
endef

define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Build/Configure
endef

define Build/Compile
CFLAGS="$(TARGET_CFLAGS)" CPPFLAGS="$(TARGET_CPPFLAGS)" $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS)
endef

define Package/gluon-radv-filterd/install
$(CP) ./files/* $(1)/

$(INSTALL_DIR) $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/gluon-radv-filterd $(1)/usr/sbin/
endef

$(eval $(call BuildPackage,gluon-radv-filterd))
17 changes: 17 additions & 0 deletions package/gluon-radv-filterd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
gluon-radv-filterd
==================
This package drops all incoming router advertisements except for the
default router with the best metric according to B.A.T.M.A.N. advanced.

Note that advertisements originating from the node itself (for example
via gluon-radvd) are not affected and considered at all.

"Local" routers
---------------
The package has functionality to assign "local" routers, i.e. those connected
via cable or WLAN instead of via the mesh (technically: appearing in the
`transtable_local`), a fake TQ of 512 so that they are always preferred.
However, if used together with the `gluon-ebtables-filter-ra-dhcp` package,
these router advertisements are filtered anyway and reach neither the node nor
any other client. You currently have to disable the package or insert custom
ebtables rules in order to use local routers.
14 changes: 14 additions & 0 deletions package/gluon-radv-filterd/files/etc/init.d/gluon-radv-filterd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh /etc/rc.common

USE_PROCD=1
START=50
DAEMON=/usr/sbin/gluon-radv-filterd

start_service() {
procd_open_instance
procd_set_param command $DAEMON -i br-client -c RADV_FILTER
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
procd_set_param netdev br-client
procd_set_param stderr 1
procd_close_instance
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
chain('RADV_FILTER', 'DROP')
rule 'FORWARD -p IPv6 -i bat0 --ip6-protocol ipv6-icmp --ip6-icmp-type router-advertisement -j RADV_FILTER'
rule 'RADV_FILTER -j ACCEPT'
4 changes: 4 additions & 0 deletions package/gluon-radv-filterd/src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all: gluon-radv-filterd

gluon-radv-filterd: gluon-radv-filterd.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o $@ $^ $(LDLIBS)
Loading

0 comments on commit c6dcbe2

Please sign in to comment.