next up previous contents
Next: Packet dequeuing Up: Configuration Previous: Termination   Contents


Packet enqueuing

Syntax:
send $[$device$]$ $[[$default$]$attribute=value $\ldots]$ value $\ldots$
Example:
send 0x04 0x00 ns: 258 0x03
Effect:
Enqueues the specified byte sequence. tcsim assumes all packets to be IPv4, without link-layer header. tcsim automatically sets the length field if the byte sequence appears indeed to be an IPv4 packet.6.2

The device name can be omitted if only a single device exists in the system when the send command is executed.

The attributes set meta-data in the packet. The following attributes are supported:

Attribute Default Description
nfmark 0 the network filter mark value
    (used by the fw classifier)
priority 0 priority value the ``real'' kernel derives from
    the TOS byte or some socket options
protocol ETH_P_IP protocol number obtained from link layer
tc_index 0 shared traffic control decision

Attributes can be set with two priorities: ``default'', which is indicated by the keyword default before the assignment, and ``normal'', which is indicated by the absence of that keyword. Setting an attribute with ``default'' priority doesn't change that attribute if it has previously been set with ``normal'' priority. In all other cases, the attribute is changed. Setting attributes with ``default'' priority is mainly used in macros, e.g. in IP_PCK and IP6_PCK.

All attributes have a global default value and the default priority ``default''. This can be changed with the attribute command described in section 6.2.2.

Note: the attributes nfmark, priority, and tc_index are usually reset to their global default values when crossing links.6.3 They are preserved when invoking tcsim with the -p option. (Use with caution: it's very easy to forget setting e.g. skb->tc_index, and things will still appear to work, because the value set at a previous host is re-used, which would of course not happen in real life.)

Values are arithmetic or bit expressions, IPv4 addresses in dotted quad notation (e.g. 10.0.0.1), IPv6 addresses in any of the formats described in [RFC2373] or variables ($var). Numeric constants can be given as decimal, hexadecimal, or binary (0b$\ldots$) numbers. Also a Perl-like repetition operator x is available.

By default, values are treated as bytes (Exception: dotted quads are treated as four bytes in network byte order.) A value can optionally be prefixed by a type:

Prefix Type
b: byte (8 bits)
ns: network short (16 bits)
hs: host short (16 bits)
nl: network long (32 bits)
hl: host long (32 bits)
ipv4: IPv4 address (32 bits)
ipv6: IPv6 address (128 bits)

tcsim reports an error if a value is too large for the specified size.

Example: ns: 258 is equivalent to 0x01 0x02.

Note that, when using a variable containing a value larger than a byte, the type needs to be specified.


next up previous contents
Next: Packet dequeuing Up: Configuration Previous: Termination   Contents
Martin A. Brown 2003-11-06