2
0

02_network 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #
  2. # Copyright (c) 2015 The Linux Foundation. All rights reserved.
  3. # Copyright (c) 2011-2015 OpenWrt.org
  4. #
  5. . /lib/functions/uci-defaults.sh
  6. . /lib/functions/system.sh
  7. board_config_update
  8. board=$(board_name)
  9. case "$board" in
  10. askey,rt4230w-rev6 |\
  11. asrock,g10 |\
  12. nec,wg2600hp)
  13. ucidef_add_switch "switch0" \
  14. "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0"
  15. ;;
  16. buffalo,wxr-2533dhp |\
  17. compex,wpq864 |\
  18. netgear,d7800 |\
  19. netgear,r7500 |\
  20. netgear,r7500v2 |\
  21. qcom,ipq8064-ap148 |\
  22. tplink,vr2600v)
  23. ucidef_add_switch "switch0" \
  24. "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
  25. ;;
  26. edgecore,ecw5410)
  27. ucidef_set_interfaces_lan_wan "eth1" "eth0"
  28. ucidef_set_interface_macaddr "lan" "$(mtd_get_mac_binary "0:art" 0x6)"
  29. ucidef_set_interface_macaddr "wan" "$(mtd_get_mac_binary "0:art" 0x0)"
  30. ;;
  31. linksys,ea7500-v1)
  32. hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
  33. ucidef_add_switch "switch0" \
  34. "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
  35. ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
  36. ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
  37. ;;
  38. linksys,ea8500)
  39. hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
  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" "$hw_mac_addr"
  44. ;;
  45. nec,wg2600hp3)
  46. ucidef_add_switch "switch0" \
  47. "2:lan" "3:lan" "4:lan" "5:lan" "0@eth1" "1:wan" "6@eth0"
  48. ;;
  49. netgear,r7800 |\
  50. netgear,xr500 |\
  51. tplink,c2600)
  52. ucidef_add_switch "switch0" \
  53. "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
  54. ;;
  55. qcom,ipq8064-ap161)
  56. ucidef_set_interface_lan "eth1 eth2"
  57. ucidef_add_switch "switch0" \
  58. "0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
  59. ;;
  60. qcom,ipq8064-db149)
  61. ucidef_set_interface_lan "eth1 eth2 eth3"
  62. ucidef_add_switch "switch0" \
  63. "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
  64. ;;
  65. tplink,ad7200)
  66. ucidef_add_switch "switch0" \
  67. "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
  68. ;;
  69. ubnt,unifi-ac-hd)
  70. ucidef_set_interface_lan "eth0 eth1"
  71. ;;
  72. zyxel,nbg6817)
  73. hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
  74. ucidef_add_switch "switch0" \
  75. "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
  76. ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
  77. ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
  78. ;;
  79. *)
  80. echo "Unsupported hardware. Network interfaces not intialized"
  81. ;;
  82. esac
  83. board_config_flush
  84. exit 0