02_network 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2015 The Linux Foundation. All rights reserved.
  4. # Copyright (c) 2011-2015 OpenWrt.org
  5. #
  6. . /lib/functions/uci-defaults.sh
  7. . /lib/functions/system.sh
  8. board_config_update
  9. board=$(board_name)
  10. case "$board" in
  11. ap148 |\
  12. c2600 |\
  13. d7800 |\
  14. r7500 |\
  15. r7500v2 |\
  16. r7800 |\
  17. vr2600v)
  18. ucidef_add_switch "switch0" \
  19. "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
  20. ;;
  21. db149)
  22. ucidef_set_interface_lan "eth1 eth2 eth3"
  23. ucidef_add_switch "switch0" \
  24. "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
  25. ;;
  26. ea8500)
  27. hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
  28. ucidef_add_switch "switch0" \
  29. "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
  30. ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
  31. ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
  32. ;;
  33. fritz4040)
  34. ucidef_set_interfaces_lan_wan "eth0" "eth1"
  35. ucidef_add_switch "switch0" \
  36. "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
  37. ;;
  38. nbg6817)
  39. hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
  40. ucidef_add_switch "switch0" \
  41. "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
  42. ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
  43. ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 1)"
  44. ;;
  45. *)
  46. echo "Unsupported hardware. Network interfaces not intialized"
  47. ;;
  48. esac
  49. board_config_flush
  50. exit 0