4 compadd "$@" - $(dladm show-link -p -o link)
8 compadd "$@" - $(dladm show-phys -p -o device)
12 compadd "$@" - $(dladm show-aggr -p -o link)
16 compadd "$@" - $(dladm show-aggr -p -x -o ports)
20 compadd "$@" - $(dladm show-vlan -p -o link)
24 compadd "$@" - $(dladm show-wifi -p -o link)
28 compadd "$@" - ${(f)"$(dladm scan-wifi -p -o essid)"}
32 compadd "$@" - ${(f)"$(dladm show-secobj -p -o object)"}
36 compadd "$@" - $(dladm show-ether -p -o link)
40 # TODO: complete property values, when available
41 compadd "$@" - $(dladm show-linkprop -c -o property)
45 compadd "$@" - $(dladm show-vnic -p -o link)
49 compadd "$@" - $(dladm show-etherstub)
53 local context state line expl
55 local -a subcmds rw_properties rw_propnames ro_properties
56 local -a link_properties link_stats_properties
57 local -a aggr_properties aggr_lacp_properties aggr_ext_properties
58 local -a vlan_properties wifi_properties wifi_connect_properties
59 local -a ether_properties linkprop_properties secobj_properties
61 # TODO: some subcommands can take multiple comma-separated targets
62 # TODO: some option sets may be different based on other commandline flags
63 # TODO: some subcommands may take different arguments based on options
66 "show-ether" "show-usage"
67 {"rename","show"}"-link"
68 {"add","create","delete","modify","remove","show"}"-aggr"
69 {"connect","disconnect","scan","show"}"-wifi"
70 {"reset","set","show"}"-linkprop"
71 {"create","delete","show"}"-secobj"
72 {"create","delete","show"}"-vlan"
73 {"delete","show"}"-phys"
74 {"create","delete","show"}"-vnic"
75 {"create","delete","show"}"-etherstub"
78 if [[ $service == "dladm" ]]; then
79 _arguments -C -A "-*" \
81 '*::command:->subcmd' && return 0
83 if (( CURRENT == 1 )); then
84 _wanted commands expl "dladm subcommand" compadd -a subcmds
88 curcontext="${curcontext%:*}=$service:"
91 link_properties=( "link" "class" "mtu" "state" "over" )
92 link_stats_properties=( "link" "ipackets" "rbytes" "ierrors" "opackets" "obytes" "oerrors" )
94 aggr_properties=( "link" "policy" "addrpolicy" "lacpactivity" "lacptimer" "flags" )
95 aggr_lacp_properties=( "link" "port" "aggregatable" "sync" "coll" "dist" "defaulted" "expired" )
96 aggr_ext_properties=( "link" "port" "speed" "duplex" "state" "address" "portstate" )
98 vlan_properties=( "link" "vid" "over" "flags" )
100 wifi_connect_properties=( "link" "essid" "bssid" "sec" "mode" "strength" "speed" "bsstype" )
101 wifi_properties=( $wifi_connect_properties "status" "auth" )
103 ether_properties=( "link" "ptype" "state" "auto" "speed-duplex" "pause" "rem_fault" )
105 linkprop_properties=( "link" "property" "value" "default" "possible" )
107 secobj_properties=( "object" "class" )
109 vnic_properties=( "link" "over" "speed" "macaddr" "macaddrtype" )
114 '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
115 '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
117 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $link_properties' \
119 '(-s --statistics)'{-s,--statistics}'[Display link statistics]' \
120 '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
121 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $link_stats_properties' \
122 ':link name:_dladm_links' \
127 '-R[Root directory]:directory:_path_files -/' \
128 ':old link name:_dladm_links' \
134 '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
135 '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
136 '(-s --statistics)'{-s,--statistics}'[Display link statistics]' \
137 '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
138 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" link media state speed duplex device' \
139 ':physical link name:_dladm_devs'
144 ':physical link name:_dladm_devs'
149 '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
150 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
151 '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
152 '(-P --policy)'{-P,--policy}'[Port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
153 '(-L --lacp-mode)'{-L,--lacp-mode}'[LACP mode]:lacp mode:(off active passive)' \
154 '(-T --lacp-timer)'{-T,--lacp-timer}'[LACP timer]:lacp timer:(short long)' \
155 '(-u --unicast)'{-u,--unicast}'[Unicast address]:unicast address:' \
156 ':aggregate link name:'
161 '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
162 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
163 '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
164 '(-P --policy)'{-P,--policy}'[Port selection policy]:policy:_values -s , "policy" L2 L3 L4' \
165 '(-L --lacp-mode)'{-L,--lacp-mode}'[LACP mode]:lacp mode:(off active passive)' \
166 '(-T --lacp-timer)'{-T,--lacp-timer}'[LACP timer]:lacp timer:(short long)' \
167 '(-u --unicast)'{-u,--unicast}'[Unicast address]:unicast address:' \
168 ':aggregate link name:_dladm_aggrs'
173 '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
174 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
175 ':aggregate link name:_dladm_aggrs'
180 '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
181 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
182 '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
183 ':aggregate link name:_dladm_aggrs'
188 '(-t --temporary)'{-t,--temporary}'[Aggregation should be temporary]' \
189 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
190 '(-l --link)'{-l,--link}'[Component link]:link:_dladm_aggr_ports' \
191 ':aggregate link name:_dladm_aggrs'
196 '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
197 '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
198 '(-s --statistics)'{-s,--statistics}'[Display link statistics]' \
199 '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
200 ':aggregate link name:_dladm_links' \
202 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $aggr_properties' \
204 '(-L --lacp)'{-L,--lacp}'[LACP information]' \
205 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $aggr_lacp_properties' \
207 '(-x --extended)'{-x,--extended}'[Extended information]' \
208 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $aggr_ext_properties' \
213 '(-t --temporary)'{-t,--temporary}'[VLAN should be temporary]' \
214 '(-f --force)'{-f,--force}'[Force VLAN creation]' \
215 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
216 '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
223 '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
224 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
225 ':VLAN link name:_dladm_vlans'
230 '(-P --persistent)'{-P,--persistent}'[Display persistent link configuration]' \
231 '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
232 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $vlan_properties' \
233 ':VLAN link name:_dladm_vlans'
238 '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
239 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $wifi_connect_properties' \
240 ':wireless link name:_dladm_wifi_links'
245 '(-e --essid)'{-e,--essid}'[ESSID name]:network:_dladm_wifi_nets' \
246 '(-b --bsstype)'{-b,--bsstype}'[BSS type]:' \
247 '(-m --mode)'{-m,--mode}'[802.11 mode]:mode:(a b g)' \
248 '(-k --key)'{-k,--key}'[Key name]:key:_dladm_secobjs' \
249 '(-s --sec)'{-s,--sec}'[Security mode]:(none wep wpa)' \
250 '(-a --auth)'{-a,--auth}'[Authentication mode]:mode:(open shared)' \
251 '(-c --create-ibss)'{-c,--create-ibss}'[Create an ad-hoc network]' \
252 '(-T --timeout)'{-T,--timeout}'[Association timeout]:(forever)' \
253 ':wireless link name:_dladm_wifi_links'
259 '(-a --all-links)'{-a,--all-links}'[All links]' \
261 ':wireless link name:_dladm_wifi_links'
266 '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
267 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $wifi_properties' \
268 ':wireless link name:_dladm_wifi_links'
273 '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
274 '(-x --extended)'{-x,--extended}'[Extended output]' \
275 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $ether_properties' \
276 ':ethernet link name:_dladm_ethers'
281 '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
282 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
283 '(-p --prop)'{-p,--prop}'[Properties]:property:_dladm_linkprops' \
284 ':link name:_dladm_links'
289 '(-t --temporary)'{-t,--temporary}'[Change should be temporary]' \
290 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
291 '(-p --prop)'{-p,--prop}'[Properties]:property:_dladm_linkprops' \
292 ':link name:_dladm_links'
297 '(-P --persistent)'{-P,--persistent}'[Display persistent link properties]' \
298 '(-c --parseable)'{-c,--parseable}'[Parseable output]' \
299 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $linkprop_properties' \
300 '(-p --prop)'{-p,--prop}'[Properties]:property:_dladm_linkprops' \
301 ':link name:_dladm_links'
306 '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
307 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
308 '(-c --class)'{-c,--class}'[Class]:class:(wep wpa)' \
309 '(-f --file)'{-f,--file}'[File containing object value]:file:_path_files' \
315 '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
316 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
317 ':object name:_dladm_secobjs'
322 '(-P --persistent)'{-P,--persistent}'[Display persistent object information]' \
323 '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
324 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $secobj_properties' \
325 ':object name:_dladm_secobjs'
329 # TODO: MAC address completion could be richer
331 '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
332 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
333 '(-l --link)'{-l,--link}'[Component link]:link:_dladm_links' \
334 '(-m --mac-address)'{-m,--mac-address}'[MAC address]:address:(factory random auto)' \
336 '(-p --prop)'{-p,--prop}'[Property values]:value:' \
342 '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
343 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
344 ':VNIC name:_dladm_vnics'
349 '(-P --persistent)'{-P,--persistent}'[Display persistent object information]' \
350 '(-p --parseable)'{-p,--parseable}'[Parseable output]' \
351 '(-o --output)'{-o,--output}'[Properties to display]:property:_values -s , "property" $vnic_properties' \
352 '(-l --link)'{-l,--link}'[Limit to VNICs on link]:link:_dladm_links' \
353 '(-s --statistics)'{-s,--statistics}'[Display VNIC statistics]' \
354 '(-i --interval)'{-i,--interval}'[Specify an interval]:interval:' \
355 ':VNIC name:_dladm_vnics'
360 '(-t --temporary)'{-t,--temporary}'[Creation should be temporary]' \
361 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
367 '(-t --temporary)'{-t,--temporary}'[Deletion should be temporary]' \
368 '(-R --root)'{-R,--root}'[Root directory]:directory:_path_files -/' \
369 ':etherstub name:_dladm_etherstubs'
374 ':etherstub name:_dladm_etherstubs'
379 '(-f --file)'{-f,--file}'[Read records from file]:_path_files' \
380 '(-F --format)'{-f,--format}'[Plotfile format]:(gnuplot)' \
381 '(-p --plot)'{-p,--plot}'[Write plot to file]:' \
382 '(-e --start)'{-e,--start}'[Start time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
383 '(-s --stop)'{-s,--stop}'[Stop time]:date/time (MM/DD/YYYY,hh\:mm\:ss)' \
384 ':link name:_dladm_links'
388 _message "unknown dladm subcommand: $service"