ping.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <CLISH_MODULE xmlns="http://clish.sourceforge.net/XMLSchema"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://clish.sourceforge.net/XMLSchema
  5. http://clish.sourceforge.net/XMLSchema/clish.xsd">
  6. <!--=======================================================-->
  7. <VIEW name="ping-view"
  8. prompt="${SYSTEM_NAME}# ">
  9. <!-- commands set: ping, ping6, arping, traceroute, traceroute6 -->
  10. <!-- ping, ping6, arping -->
  11. <COMMAND name="ping"
  12. help="Send messages to network hosts"
  13. lock="false"
  14. interrupt="true">
  15. <PARAM name="proto"
  16. help="Protocol to use for the ping"
  17. optional="true"
  18. mode="switch"
  19. ptype="SUBCOMMAND">
  20. <PARAM name="ip"
  21. help="Send ICMP IPv4 messages to network hosts (default)"
  22. mode="subcommand"
  23. ptype="SUBCOMMAND"/>
  24. <PARAM name="ipv6"
  25. help="Send ICMP IPv6 messages to network hosts"
  26. mode="subcommand"
  27. ptype="SUBCOMMAND"/>
  28. <PARAM name="arp"
  29. help="Send ARP requests to a neighbour host"
  30. mode="subcommand"
  31. ptype="SUBCOMMAND"/>
  32. </PARAM>
  33. <PARAM name="dst"
  34. help="Hostname or IP-address to ping"
  35. ptype="STRING"/>
  36. <PARAM name="source"
  37. help="Source IP-address (ip) or interface (ip and arp)"
  38. optional="true"
  39. mode="subcommand"
  40. ptype="SUBCOMMAND">
  41. <PARAM name="src"
  42. help="Source IP-address (ip) or interface name (ip and arp)"
  43. ptype="STRING"/>
  44. </PARAM>
  45. <PARAM name="repeat"
  46. help="Requests to send count, default is 5"
  47. optional="true"
  48. mode="subcommand"
  49. ptype="SUBCOMMAND">
  50. <PARAM name="count"
  51. help="Requests count"
  52. ptype="UINT"/>
  53. </PARAM>
  54. <PARAM name="resolve"
  55. test='"${proto}"!="arp"'
  56. help="Resolve names"
  57. optional="true"
  58. mode="subcommand"
  59. ptype="SUBCOMMAND"/>
  60. <PARAM name="broadcast"
  61. test='"${proto}"!="arp"'
  62. help="Ping broadcast address"
  63. optional="true"
  64. mode="subcommand"
  65. ptype="SUBCOMMAND"/>
  66. <PARAM name="size"
  67. test='"${proto}"!="arp"'
  68. help="Packet size"
  69. optional="true"
  70. mode="subcommand"
  71. ptype="SUBCOMMAND">
  72. <PARAM name="psize"
  73. help="Number of data bytes to send"
  74. ptype="UINT"/>
  75. </PARAM>
  76. <PARAM name="interval"
  77. test='"${proto}"!="arp"'
  78. help="The time interval between packets, default is 1"
  79. optional="true"
  80. mode="subcommand"
  81. ptype="SUBCOMMAND">
  82. <PARAM name="period"
  83. help="Interval between packets"
  84. ptype="STRING"/>
  85. </PARAM>
  86. <PARAM name="flood"
  87. test='"${proto}"!="arp"'
  88. help="Flood ping"
  89. optional="true"
  90. mode="subcommand"
  91. ptype="SUBCOMMAND"/>
  92. <PARAM name="duplicate-detect"
  93. test='"${proto}"="arp"'
  94. help="Duplicate address detection mode"
  95. optional="true"
  96. mode="subcommand"
  97. ptype="SUBCOMMAND"/>
  98. <ACTION>
  99. case "${proto}" in
  100. "ipv6")
  101. cmd="ping6"
  102. ;;
  103. "arp")
  104. cmd="arping"
  105. ;;
  106. *)
  107. cmd="ping"
  108. ;;
  109. esac
  110. if test "${proto}" != "arp"; then
  111. # Resolve names
  112. if test -z "${resolve}"; then
  113. cmd=$cmd" -n"
  114. fi
  115. # Ping broadcast
  116. cmd=$cmd"`expr substr '${ -b :broadcast}' 1 3`"
  117. # Packet size
  118. cmd=$cmd"${ -s :psize}"
  119. # Interval between packets
  120. if test -n "${period}"; then
  121. cmd=$cmd"${ -i :period}"
  122. else
  123. cmd=$cmd" -i 1"
  124. fi
  125. # Flood ping
  126. cmd=$cmd"`expr substr '${ -f :flood}' 1 3`"
  127. else
  128. # Detect MAC duplicate
  129. cmd=$cmd"`expr substr '${ -D :duplicate-detect}' 1 3`"
  130. fi
  131. # Interface or address
  132. cmd=$cmd"${ -I :src}"
  133. # Request count
  134. if test -z "${count}"; then
  135. cmd=$cmd" -c 5"
  136. else
  137. cmd=$cmd"${ -c :count}"
  138. fi
  139. #
  140. cmd=$cmd" ${dst}"
  141. $cmd
  142. </ACTION>
  143. </COMMAND>
  144. <!-- traceroute, traceroute6 -->
  145. <COMMAND name="traceroute"
  146. help="Print the route packets trace to network host"
  147. lock="false"
  148. interrupt="true">
  149. <PARAM name="proto"
  150. help="Protocol to use"
  151. optional="true"
  152. mode="switch"
  153. ptype="SUBCOMMAND">
  154. <PARAM name="ip"
  155. help="IPv4"
  156. mode="subcommand"
  157. ptype="SUBCOMMAND"/>
  158. <PARAM name="ipv6"
  159. help="IPv6"
  160. mode="subcommand"
  161. ptype="SUBCOMMAND"/>
  162. </PARAM>
  163. <PARAM name="dst"
  164. help="Hostname or IP-address to trace the route"
  165. ptype="STRING"/>
  166. <PARAM name="resolve"
  167. help="Resolve names"
  168. ptype="SUBCOMMAND"
  169. mode="subcommand"
  170. optional="true"/>
  171. <PARAM name="source"
  172. help="Source IP-address"
  173. optional="true"
  174. mode="subcommand"
  175. ptype="SUBCOMMAND">
  176. <PARAM name="src"
  177. help="IP-address"
  178. ptype="STRING"/>
  179. </PARAM>
  180. <PARAM name="interface"
  181. help="Source interface"
  182. optional="true"
  183. mode="subcommand"
  184. ptype="SUBCOMMAND">
  185. <PARAM name="if"
  186. help="Interface name"
  187. ptype="STRING"/>
  188. </PARAM>
  189. <ACTION>
  190. if test -n "${ipv6}"; then
  191. cmd="traceroute6"
  192. else
  193. cmd="traceroute"
  194. fi
  195. #Resolve names
  196. if test -z "${resolve}"; then
  197. cmd=$cmd" -n"
  198. fi
  199. # Source address
  200. cmd=$cmd"${ -s :src}"
  201. # Source interface
  202. cmd=$cmd"${ -i :if}"
  203. #
  204. cmd=$cmd" ${dst}"
  205. $cmd
  206. </ACTION>
  207. </COMMAND>
  208. </VIEW>
  209. </CLISH_MODULE>