summaryrefslogtreecommitdiffstats
path: root/src/payload.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2013-04-15 16:16:04 +0200
committerPatrick McHardy <kaber@trash.net>2013-04-18 15:28:13 +0200
commita711ab22a58504e52c33f5fd939643002d7e6a81 (patch)
tree1ca81a9f77b5ffef348e49964f68cafbd1023317 /src/payload.c
parent2d148c5311cc4fa5d2f7b0c439dd051abcafa9ab (diff)
types: add ethernet address type
Add a new type for ethernet addresses. This is needed since for concatenations we need fixed sized data types, the generic link layer address doesn't have a fixed length. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/payload.c')
-rw-r--r--src/payload.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/payload.c b/src/payload.c
index 611697ec..bcbc0d43 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -911,6 +911,15 @@ const struct payload_desc payload_vlan = {
* Ethernet
*/
+const struct datatype etheraddr_type = {
+ .type = TYPE_ETHERADDR,
+ .name = "etheraddr",
+ .desc = "Ethernet address",
+ .byteorder = BYTEORDER_HOST_ENDIAN,
+ .size = ETH_ALEN * BITS_PER_BYTE,
+ .basetype = &lladdr_type,
+};
+
static const struct symbol_table ethertype_tbl = {
.symbols = {
SYMBOL("ip", ETH_P_IP),
@@ -936,7 +945,7 @@ const struct datatype ethertype_type = {
#define ETHHDR_TYPE(__name, __member) \
ETHHDR_TEMPLATE(__name, &ethertype_type, __member)
#define ETHHDR_ADDR(__name, __member) \
- ETHHDR_TEMPLATE(__name, &lladdr_type, __member)
+ ETHHDR_TEMPLATE(__name, &etheraddr_type, __member)
const struct payload_desc payload_eth = {
.name = "eth",