Age | Commit message (Collapse) | Author | Files | Lines |
|
Add support for MPLS header creating with fields:
Label, TClass, Bottom-Stack, TTL
By default S-field is set to 1 (last label), but resets to 0
if lower MPLS header is added.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
After commit 88b359d2aa7e ("trafgen: proto: Simplify getting lower
protocol after init") proto_current_header() is no longer used outside
trafgen_proto.c, so make it static.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add generation of VLAN header with supported fields:
TPID, DEI/CFI, PCP, VID
Changed struct proto_field.offset uint16_t -> int16_t to make
TPID offset -2 to point to ether type.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add set_next_proto callback to proto_hdr struct to allow lower
protocol set next protocol id by enum proto_id.
Extended proto_lower_default_add(...) function to take upper protocol
to delegate it's id to lower protocol to set next protocol field.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Change proto_header_init(...) and proto_lower_default_add(...)
functions to return struct proto_hdr * to do not call
proto_current_header(...) after, so it makes more sense to get struct
proto_hdr * right after initializing protocol by id.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
It's not changed inside the function, so mark it as const. Also adjust
the header guards.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add helper which fills a device's ipv4 addr to the specified protocol field.
It will be used by protocols like ARP, IPv4, etc.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add helper function to set device's MAC address to protocol field which may
be used by Ethernet & ARP protocol header generation functions.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|
|
Add new trafgen_proto.c module with basic protocol header fields
generation logic. This will allow to support protocol specific keywords
in the trafgen configuration language.
Each protocol must implement struct proto_hdr and register it to the
global proto list.
Protocol headers consist of a set of fields, and each field must be
described via struct proto_field by specifying unique id, length and
offset (relative to the header start). Fields smaller than 8 bits can be
described via left shift & mask.
The following callbacks are invoked to perform special actions to build
the header during parsing:
1) header_init - required fields must be added to the packet and
initialized with default values.
2) header_finish - it is invoked when header is specified, all user
specified fields are set.
3) packet_finish - callback is invoked from upper to lower header
to calculate fields depending on upper layers such as total
length or checksum.
The protocol generation API provides convenience protocol field
setters/getters to to be used in the parser while crafting the packet.
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
[tk: wordsmithing on commit message, minor variable type changes]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
|