237 lines
8.0 KiB
Groff
237 lines
8.0 KiB
Groff
|
.TH IPSEND 5
|
||
|
.SH NAME
|
||
|
ipsend \- IP packet description language
|
||
|
.SH DESCRIPTION
|
||
|
The \fBipsend\fP program expects, with the \fB-L\fP option, input to be a
|
||
|
text file which fits the grammar described below. The purpose of this
|
||
|
grammar is to allow IP packets to be described in an arbitary way which
|
||
|
also allows encapsulation to be so done to an arbitary level.
|
||
|
.SH GRAMMAR
|
||
|
.LP
|
||
|
.nf
|
||
|
line ::= iface | arp | send | defrouter | ipv4line .
|
||
|
|
||
|
iface ::= ifhdr "{" ifaceopts "}" .
|
||
|
ifhdr ::= "interface" | "iface" .
|
||
|
ifaceopts ::= "ifname" name | "mtu" mtu | "v4addr" ipaddr | "eaddr" eaddr .
|
||
|
|
||
|
send ::= "send" ";" | "send" "{" sendbodyopts "}" .
|
||
|
sendbodyopts ::= sendbody [ sendbodyopts ] .
|
||
|
sendbody ::= "ifname" name | "via" ipaddr .
|
||
|
|
||
|
defrouter ::= "router" ipaddr .
|
||
|
|
||
|
arp ::= "arp" "{" arpbodyopts "}" .
|
||
|
arpbodyopts ::= arpbody [ arpbodyopts ] .
|
||
|
arpbody ::= "v4addr" ipaddr | "eaddr" eaddr .
|
||
|
|
||
|
ipv4line ::= "ipv4" "{" ipv4bodyopts "}" .
|
||
|
ipv4bodyopts ::= ipv4body [ ipv4bodyopts ] .
|
||
|
ipv4body ::= "proto" protocol | "src" ipaddr | "dst" ipaddr |
|
||
|
"off" number | "v" number | "hl" number| "id" number |
|
||
|
"ttl" number | "tos" number | "sum" number | "len" number |
|
||
|
"opt" "{" ipv4optlist "}" | tcpline | udpline | icmpline |
|
||
|
ipv4line .
|
||
|
ipv4optlist ::= ipv4option [ ipv4optlist ] .
|
||
|
ipv4optlist = "nop" | "rr" | "zsu" | "mtup" | "mtur" | "encode" | "ts" |
|
||
|
"tr" | "sec" | "lsrr" | "e-sec" | "cipso" | "satid" |
|
||
|
"ssrr" | "addext" | "visa" | "imitd" | "eip" | "finn" |
|
||
|
"secclass" ipv4secclass.
|
||
|
ipv4secclass := "unclass" | "confid" | "reserv-1" | "reserv-2" |
|
||
|
"reserv-3" | "reserv-4" | "secret" | "topsecret" .
|
||
|
|
||
|
tcpline ::= "tcp" "{" tcpbodyopts "}" .
|
||
|
tcpbodyopts ::= tcpbody [ tcpbodyopts ] .
|
||
|
tcpbody ::= "sport" port | "dport" port | "seq" number | "ack" number |
|
||
|
"off" number | "urp" number | "win" number | "sum" number |
|
||
|
"flags" tcpflags | data .
|
||
|
|
||
|
udpline ::= "udp" "{" udpbodyopts "}" .
|
||
|
udpbodyopts ::= udpbody [ udpbodyopts ] .
|
||
|
udpbody ::= "sport" port | "dport" port | "len" number | "sum" number |
|
||
|
data .
|
||
|
|
||
|
icmpline ::= "icmp" "{" icmpbodyopts "}" .
|
||
|
icmpbodyopts ::= icmpbody [ icmpbodyopts ] .
|
||
|
icmpbody ::= "type" icmptype [ typeopts ] [ "code" icmpcode ] .
|
||
|
icmptype ::= "net-unr" | "host-unr" | "proto-unr" | "port-unr" |
|
||
|
"needfrag" | "srcfail" | "net-unk" | "host-unk" | "isolate" |
|
||
|
"net-prohib" | "host-prohib" | "net-tos" | "host-tos" .
|
||
|
.fi
|
||
|
.SH COMMANDS
|
||
|
.PP
|
||
|
Before sending any packets or defining any packets, it is necessary to
|
||
|
describe the interface(s) which will be used to send packets out.
|
||
|
.TP
|
||
|
.B interface
|
||
|
is used to describe a network interface. The description included need
|
||
|
not match the actual configuration currently employed by the operating
|
||
|
system.
|
||
|
.TP
|
||
|
.B send
|
||
|
is used to actually send out a packet across the network. If the
|
||
|
destination is not specified, it will attempt to send the packet
|
||
|
directly out on the network to the destination without routing it.
|
||
|
.TP
|
||
|
.B router
|
||
|
configures the default router for ipsend, as distinct from the default
|
||
|
route installed in the kernel.
|
||
|
.TP
|
||
|
.B ipv4
|
||
|
is used to describe an IP (version 4) packet. IP header fields can be
|
||
|
specified, including options, followed by a data section which may contain
|
||
|
further protocol headers.
|
||
|
.SH IPV4
|
||
|
.TP
|
||
|
.B hl <number>
|
||
|
manually specifies the IP header length (automatically adjusts with the
|
||
|
presence of IP options and defaults to 5);
|
||
|
.TP
|
||
|
.B v <number>
|
||
|
set the IP version. Default is 4.
|
||
|
.TP
|
||
|
.B tos <number>
|
||
|
set the type of service (TOS) field in the IP header. Default is 0.
|
||
|
.TP
|
||
|
.B len <number>
|
||
|
manually specifies the length of the IP packet. The length will automatically
|
||
|
be adjusted to accomodate data or further protocol headers.
|
||
|
.TP
|
||
|
.B off <number>
|
||
|
sets the fragment offset field of the IP packet. Default is 0.
|
||
|
.TP
|
||
|
.B ttl <number>
|
||
|
sets the time to live (TTL) field of the IP header. Default is 60.
|
||
|
.TP
|
||
|
.B proto <protocol>
|
||
|
sets the protocol field of the IP header. The protocol can either be a
|
||
|
number or a name found in \fB/etc/protocols\fP.
|
||
|
.TP
|
||
|
.B sum
|
||
|
manually specifies the checksum for the IP header. If left unset (0), it
|
||
|
will be calculated prior to being sent.
|
||
|
.TP
|
||
|
.B src
|
||
|
manually specifies the source address of the IP header. If left unset, it
|
||
|
will default to the host's IP address.
|
||
|
.TP
|
||
|
.B dst
|
||
|
sets the destination of the IP packet. The default is 0.0.0.0.
|
||
|
.TP
|
||
|
.B opt
|
||
|
is used to include IP options in the IP header.
|
||
|
.TP
|
||
|
.B tcp
|
||
|
is used to indicate the a TCP protocol header is to follow. See the \fBTCP\fP
|
||
|
section for TCP header options.
|
||
|
.TP
|
||
|
.B udp
|
||
|
is used to indicate the a UDP protocol header is to follow. See the \fBUDP\fP
|
||
|
section for UDP header options.
|
||
|
.TP
|
||
|
.B icmp
|
||
|
is used to indicate the a ICMP protocol header is to follow. See the
|
||
|
\fBICMP\fP section for ICMP header options.
|
||
|
.TP
|
||
|
.B data
|
||
|
is used to indicate that raw data is to be included in the IP packet. See the
|
||
|
\fBDATA\fP section for details on options available.
|
||
|
.SH TCP
|
||
|
.TP
|
||
|
.B sport <port>
|
||
|
sets the source port to the number/name given. Default is 0.
|
||
|
.TP
|
||
|
.B dport <port>
|
||
|
sets the destination port to the number/name given. Default is 0.
|
||
|
.TP
|
||
|
.B seq <number>
|
||
|
sets the sequence number to the number specified. Default is 0.
|
||
|
.TP
|
||
|
.B ack <number>
|
||
|
sets the acknowledge number to the number specified. Default is 0.
|
||
|
.TP
|
||
|
.B off <number>
|
||
|
sets the offset value for the start of data to the number specified. This
|
||
|
implies the size of the TCP header. It is automatically adjusted if TCP
|
||
|
options are included and defaults to 5.
|
||
|
.TP
|
||
|
.B urp <number>
|
||
|
sets the value of the urgent data pointer to the number specified. Default
|
||
|
is 0.
|
||
|
.TP
|
||
|
.B win <number>
|
||
|
sets the size of the TCP window to the number specified. Default is 4096.
|
||
|
.TP
|
||
|
.B sum <number>
|
||
|
manually specifies the checksum for the TCP pseudo-header and data. If left
|
||
|
unset, it defaults to 0 and is automatically calculated.
|
||
|
.TP
|
||
|
.B flags <tcp-flags>
|
||
|
sets the TCP flags field to match the flags specified. Valid flags are
|
||
|
"S" (SYN), "A" (ACK), "R" (RST), "F" (FIN), "U" (URG), "P" (PUSH).
|
||
|
.TP
|
||
|
.B opt
|
||
|
indicates that TCP header options follow. As TCP options are added to the
|
||
|
TCP header, the \fBoff\fP field is updated to match.
|
||
|
.TP
|
||
|
.B data
|
||
|
indicates that a data section is to follow and is to be included as raw
|
||
|
data, being appended to the header.
|
||
|
.SH UDP
|
||
|
.TP
|
||
|
.B sport <port>
|
||
|
sets the source port to the number/name given. Default is 0.
|
||
|
.TP
|
||
|
.B dport <port>
|
||
|
sets the destination port to the number/name given. Default is 0.
|
||
|
.TP
|
||
|
.B len <number>
|
||
|
manually specifies the length of the UDP header and data. If left unset,
|
||
|
it is automatically adjusted to match the header presence and any data if
|
||
|
present.
|
||
|
.TP
|
||
|
.B sum <number>
|
||
|
manually specifies the checksum for the UDP pseudo-header and data. If left
|
||
|
unset, it defaults to 0 and is automatically calculated.
|
||
|
.TP
|
||
|
.B data
|
||
|
indicates that a data section is to follow and is to be included as raw
|
||
|
data, being appended to the header.
|
||
|
.SH ICMP
|
||
|
.TP
|
||
|
.B type <icmptype>
|
||
|
sets the ICMP type according the to the icmptype tag. This may either be
|
||
|
a number or one of the recognised tags (see the ICMP TYPES section for a
|
||
|
list of names recognised).
|
||
|
.TP
|
||
|
.B code <icmpcode>
|
||
|
sets the ICMP code.
|
||
|
.TP
|
||
|
.B data
|
||
|
indicates that a data section is to follow and is to be included as raw
|
||
|
data, being appended to the header.
|
||
|
.SH DATA
|
||
|
Each of the following extend the packet in a different way. \fBLen\fP just
|
||
|
increases the length (without adding any content), \fBvalue\fP uses a string
|
||
|
and \fBfile\fP a file.
|
||
|
.TP
|
||
|
.B len <number>
|
||
|
extend the length of the packet by \fBnumber\fP bytes (without filling those
|
||
|
bytes with any particular data).
|
||
|
.TP
|
||
|
.B value <string>
|
||
|
indicates that the string provided should be added to the current packet as
|
||
|
data. A string may be a consecutive list of characters and numbers (with
|
||
|
no white spaces) or bounded by "'s (may not contain them, even if \\'d).
|
||
|
The \\ charcater is recognised with the appropriate C escaped values, including
|
||
|
octal numbers.
|
||
|
.TP
|
||
|
.B file <filename>
|
||
|
reads data in from the specified file and appends it to the current packet.
|
||
|
If the new total length would exceed 64k, an error will be reported.
|
||
|
.SH FILES
|
||
|
/etc/protocols
|
||
|
/etc/services
|
||
|
/etc/hosts
|
||
|
.SH SEE ALSO
|