02_network 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #
  2. # Copyright (C) 2012-2015 OpenWrt.org
  3. #
  4. . /lib/functions/uci-defaults.sh
  5. . /lib/functions/system.sh
  6. kirkwood_setup_interfaces()
  7. {
  8. local board="$1"
  9. case "$board" in
  10. checkpoint,l-50)
  11. ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8 dmz" "eth0"
  12. ;;
  13. cisco,on100)
  14. ucidef_set_interface_lan "eth0 eth1"
  15. ;;
  16. cloudengines,pogoe02|\
  17. cloudengines,pogoplugv4|\
  18. ctera,c200-v1|\
  19. globalscale,sheevaplug|\
  20. iom,iconnect-1.1|\
  21. iom,ix2-200|\
  22. iptime,nas1|\
  23. netgear,readynas-duo-v2|\
  24. raidsonic,ib-nas62x0|\
  25. seagate,blackarmor-nas220|\
  26. seagate,dockstar|\
  27. seagate,goflexhome|\
  28. seagate,goflexnet|\
  29. zyxel,nsa310b|\
  30. zyxel,nsa310s|\
  31. zyxel,nsa325)
  32. ucidef_set_interface_lan "eth0" "dhcp"
  33. ;;
  34. endian,4i-edge-200)
  35. ucidef_set_interface_lan "port1 port2 port3 port4 eth1"
  36. ;;
  37. iom,ix4-200d)
  38. ucidef_set_interface_lan "eth0 eth1" "dhcp"
  39. ;;
  40. linksys,e4200-v2|\
  41. linksys,ea3500|\
  42. linksys,ea4500)
  43. ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
  44. ;;
  45. *)
  46. ucidef_set_interface_lan "eth0"
  47. ;;
  48. esac
  49. }
  50. kirkwood_setup_macs()
  51. {
  52. local board="$1"
  53. local lan_mac=""
  54. local wan_mac=""
  55. local label_mac=""
  56. case "$board" in
  57. iptime,nas1)
  58. lan_mac=$(mtd_get_mac_binary u-boot 0x3ffa8)
  59. label_mac=$lan_mac
  60. ;;
  61. linksys,e4200-v2|\
  62. linksys,ea3500|\
  63. linksys,ea4500)
  64. wan_mac=$(mtd_get_mac_ascii u_env eth1addr)
  65. ;;
  66. zyxel,nsa310b|\
  67. zyxel,nsa325)
  68. lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
  69. ;;
  70. esac
  71. [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
  72. [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
  73. [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
  74. }
  75. board_config_update
  76. board=$(board_name)
  77. kirkwood_setup_interfaces $board
  78. kirkwood_setup_macs $board
  79. board_config_flush
  80. exit 0