openwrt/package/network/services/bridger/files/bridger.init
Felix Fietkau 786e3dec01 bridger: update to Git HEAD (2024-04-22)
ec8c620fd5f4 split bridge-local disable into rx and tx
40b1c5b6be4e flow: do not attempt to offload bridge-local flows

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-04-22 11:02:52 +02:00

50 lines
900 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (c) 2021 OpenWrt.org
START=19
USE_PROCD=1
PROG=/usr/sbin/bridger
get_defaults() {
cfg="$1"
config_get blacklist "$cfg" blacklist
json_add_array blacklist
for i in $blacklist; do
json_add_string "" "$i"
done
json_close_array
config_get_bool bridge_local_tx "$cfg" bridge_local_tx 1
json_add_boolean bridge_local_tx "$bridge_local_tx"
config_get_bool bridge_local_rx "$cfg" bridge_local_rx 0
json_add_boolean bridge_local_rx "$bridge_local_rx"
}
reload_service() {
config_load bridger
json_init
config_foreach get_defaults defaults
ubus call bridger set_config "$(json_dump)"
}
service_triggers() {
procd_add_reload_trigger bridger
}
start_service() {
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn
procd_close_instance
}
service_started() {
ubus -t 10 wait_for bridger
[ $? = 0 ] && reload_service
}