efsu(1) | Qualcomm Atheros Open Powerline Toolkit | efsu(1) |
efsu - Ethernet Frame Send Utility
efsu [options] file [file] [...]
efsu [options] [<stdin]
Sends custom Ethernet frames over a specific host Ethernet interface.
A frame is specified as a text stream of hexadecimal octets read from one or more frame description files or from stdin. Each octet is converted to a binary byte, buffered and transmitted over the network on the specified host interface. The program assumes that frames are valid and will transmit whatever you specify, right or wrong. The program only checks minimum and maximum frame length.
Frame descriptions are stored as plain text files. Multiple frames may be specified in one file by separating them with a semicolon. All descriptions in a file are read and sent immediately but multiple files may be specified on the command line and options allow pauses between files, command line repetition and pauses between command line iterations.
A frame descriptions is a continuous stream of hexadecimal digits. Intervening text, punctuation, white space and comments are discarded. Hex characters inside script-style, C-style or C++-style comments are ignored. Script-style comments include all characters between a hash ('#') and the next newline or EOF. C-style and C++-style comments follow normal language rules. Comments may be used to document frame descriptions or hide frame segments. In the end, there must be an even number of hex digits that represent 60 to 1518 octets;
One way to create a frame description file is to cut-and-paste output from a packet sniffer program and discard the line numbers and ASCII text columns. You can then break out selected frame segments onto new lines and insert comments.
For example, a simple file might look like:
#!/usr/local/bin/efsu -ieth0
# file: abc.hex
# =====================================
# this is an example frame description;
# -------------------------------------
00 B0 52 00 00 01
// 00 B0 52 BE DE 73
00 E0 45 DA DA 07
88 E1
/* content */
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00000000 0000 00 /* control byte */ 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
The bang path permits direct execution of the file if 1) efsu is installed in the bang path directory, 2) the description file has execute permissions and 3) the user has execute privileges for that file. The script-style, C++-style and C-style comments are ignored along with any white space. Only the hexadecimal octets are read and sent. Since the number of octets exceeds 60 and the number of digits is even, efsu will report no errors and send the packet. There is no guarantee that this packet is valid.
Assuming the above file is named abc.hex, we can transmit the file over the network as an Ethernet frame with the next command. A hexadecimal dump of the transmitted frame appears on the console because option -v is present.
# efsu abc.hex -v
00000000 00 B0 52 00 00 01 00 E0 45 DA DA 07 88 E1 00 00 ..R.....E.......
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000040 00 00 00 00 00 00 ......
Since every host interface has a different hardware address, one can replace the source address of transmitted frames with the actual host interface address using option -h. Observe that the source address above has been replaced with that of the local host interface used to transmit the frame.
# efsu abc.hex -vh
00000000 00 B0 52 00 00 01 00 0F EA 10 D5 1C 88 E1 00 00
..R.............
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000040 00 00 00 00 00 00 ......
You can also direct the frame to another device using option -d. Observe that the destination address above has been replaced with the one specified on the command line.
# efsu abc.hex -vhd 00b052beef01
00000000 00 B0 52 BE EF 01 00 0F EA 10 D5 1C 88 E1 00 00
..R.............
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000040 00 00 00 00 00 00 ......
amp(1), hpav(1)
Charles Maier
November 2013 | open-plc-utils-0.0.3 |