Packages/luci-app-syncdial/root/etc/hotplug.d/iface/01-mvifcreate
2024-12-04 10:15:35 +08:00

17 lines
622 B
Bash
Executable File

#!/bin/sh
[ "$(uci get syncdial.config.enabled)" = "1" ] && \
[ "$(uci get syncdial.config.old_frame)" = "1" ] && \
[ "$DEVICE" = "$(uci get network.wan.device)" ] && \
[ "$ACTION" = "ifup" ] && {
device=$(uci get network.wan.device)
wannum=$(uci get syncdial.config.wannum)
for i in $(seq 1 $wannum)
do
[ -d /sys/class/net/macvlan$i ] || {
ip link add link $device name macvlan$i type macvlan
ifconfig macvlan$i hw ether $(echo $(cat /sys/class/net/$device/address|awk -F ":" '{print $1":"$2":"$3":"$4":"$5":" }')$(echo "" | awk -F ":" '{printf("%X\n", 16+i);}' i=$i))
ifconfig macvlan$i up
}
done
}