ping.xml 4.8 KB

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