ucentral: development update

* add support for xBPF driven data planes

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-07-25 09:02:05 +02:00
parent 4003c367ee
commit 4330055959
8 changed files with 188 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ucentral-dataplane
PKG_RELEASE:=1
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
include $(INCLUDE_DIR)/package.mk
define Package/ucentral-dataplane
SECTION:=ucentral
CATEGORY:=uCentral
TITLE:=uCentral xBPF loader
DEPENDS:=+tc-full +kmod-ifb @!TARGET_ipq807x
endef
define Package/ucentral-dataplane/description
Allow loading cBPF and eBPF programs
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Compile/Default
endef
Build/Compile = $(Build/Compile/Default)
define Package/ucentral-dataplane/install
$(CP) ./files/* $(1)
endef
$(eval $(call BuildPackage,ucentral-dataplane))

View File

@@ -0,0 +1,6 @@
#config program 'example'
# option type 'ingress'
# option program '/tmp/ucentral/~1services~1data_plane/ingress_0'
#config interface 'up0v0'
# list program 'example'

View File

@@ -0,0 +1,10 @@
[ "$ACTION" == 'ifup' ] || exit 0
dev=$(ubus call network.interface.$INTERFACE status | jsonfilter -e '@.l3_device')
program=$(uci get dataplane.$INTERFACE.program)
tc qdisc del dev $dev handle ffff: ingress
tc qdisc add dev $dev handle ffff: ingress
for p in $program; do
path=$(uci get dataplane.$p.program)
[ -f "$path" ] || continue
tc filter add dev $dev parent ffff: bpf obj $path verbose direct-action
done

View File

@@ -0,0 +1,19 @@
#!/bin/sh /etc/rc.common
START=19
USE_PROCD=1
PROG=/usr/libexec/dataplane.sh
reload_service() {
restart
}
service_triggers() {
procd_add_reload_trigger dataplane
}
start_service() {
procd_open_instance
procd_set_param command "$PROG"
procd_close_instance
}

View File

@@ -0,0 +1,11 @@
#!/bin/sh
. /lib/functions.sh
load() {
INTERFACE=$1 ACTION=ifup . /etc/hotplug.d/iface/80-dataplane
}
config_load dataplane
config_foreach load interface

View File

@@ -6,7 +6,7 @@ PKG_RELEASE:=1
PKG_SOURCE_URL=https://github.com/blogic/ucentral-schema.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-02-15
PKG_SOURCE_VERSION:=1022c4a364298bfadfc0a1bfaeaa16b3a4792efb
PKG_SOURCE_VERSION:=15ffad87068ce3ef304d6b4cb2f9d6acf5775139
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=BSD-3-Clause

File diff suppressed because one or more lines are too long

View File

@@ -30,11 +30,11 @@ packages:
- ratelimit
- rtty-openssl
- sqm-scripts
- tc-full
- tcpdump
- tip-defaults
- tmate
- ucentral-client
- ucentral-dataplane
- ucentral-event
- ucentral-schema
- ucentral-wifi