02_network 872 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. . /lib/functions/uci-defaults.sh
  3. . /lib/functions.sh
  4. . /lib/functions/system.sh
  5. board_config_update
  6. board=$(board_name)
  7. wg_set_opt_interface() {
  8. local device="$1"
  9. local offset="$2"
  10. ucidef_set_interface "$device" device "$device" protocol static ipaddr "10.0.${offset}.1" netmask 255.255.255.0
  11. }
  12. case "$board" in
  13. watchguard,firebox-m300)
  14. ucidef_set_interfaces_lan_wan "eth1" "eth0"
  15. wg_set_opt_interface "eth2" "2"
  16. sweth_mac_offset=0x186d
  17. for sweth in /sys/class/net/sweth*; do
  18. device="$(basename "$sweth")"
  19. mac="$(mtd_get_mac_text wg_cfg0 "$sweth_mac_offset")"
  20. switchports="$switchports $device"
  21. ucidef_set_network_device_mac "$device" "$mac"
  22. wg_set_opt_interface "$device" "${device#sweth}"
  23. sweth_mac_offset=$(printf "0x%X\n" $(( $sweth_mac_offset + 0x14)))
  24. done
  25. ;;
  26. esac
  27. board_config_flush
  28. exit 0