Skip to content

Commit

Permalink
0.1.4-4
Browse files Browse the repository at this point in the history
  • Loading branch information
muink committed Nov 25, 2024
1 parent 4db6f8e commit 80d15f2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=einat-ebpf
PKG_VERSION:=0.1.4
PKG_RELEASE:=3
PKG_RELEASE:=4

ifneq ($(shell echo $(PKG_RELEASE) | grep -E '^[0-9]+$$'),)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
Expand Down
3 changes: 3 additions & 0 deletions files/einat.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ config einat 'config'
option hairpin_enabled '0'
list hairpinif 'lo'
list hairpinif 'br-lan'
list internal_subnets '192.168.0.0/16'
list internal_subnets '172.16.0.0/12'
list internal_subnets '10.0.0.0/8'

13 changes: 12 additions & 1 deletion files/einat.init
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ validate_section_config() {
uci_load_validate "$CONF" "$CONFIGSECTION" "$1" "$2" \
'enabled:bool:0' \
'bpf_log_level:range(0, 5):0' \
'bpf_loader:or("aya", "libbpf")' \
'nat44:bool:1' \
'nat66:bool:0' \
'ifname:network' \
'ports:portrange:20000-29999' \
'internal_ifaces:list(network)' \
'internal_subnets:list(cidr)' \
'hairpin_enabled:bool:0' \
'hairpinif:list(network)'
}
Expand All @@ -48,11 +51,19 @@ einat_instance() {
procd_open_instance "$CONF"
procd_set_param command "$PROG" \
--bpf-log "$bpf_log_level" \
${bpf_loader:+--bpf-loader "$bpf_loader"} \
-i "$ifname" \
--ports "$ports"

[ "$nat44" = 1 ] && procd_append_param command --nat44
#[ "$nat66" = 1 ] && procd_append_param command --nat66

local subnets internal_iface
for internal_iface in $internal_ifaces; do
network_get_subnets subnets $internal_iface
internal_subnets="${subnets:+$subnets }$internal_subnets"
done
[ -z "$internal_subnets" ] || procd_append_param command --internal $internal_subnets

procd_append_param netdev "$ifname"

Expand Down Expand Up @@ -126,7 +137,7 @@ launcher() {

# review
[ -n "$EINAT_DEBUG" ] && {
local v ucivv="enabled bpf_log_level nat44 nat66 ifname ports hairpin_enabled hairpinif"
local v ucivv="enabled bpf_log_level bpf_loader nat44 nat66 ifname ports internal_ifaces internal_subnets hairpin_enabled hairpinif"
for v in $ucivv; do eval "echo $1 $v=\'\$$v\'"; done # ash not support ${!v}
}
[ "$error" -gt 0 ] && return 1
Expand Down

0 comments on commit 80d15f2

Please sign in to comment.