payload: use ethertype in hexadecimal for meta protocol
Pablo Neira Ayuso
maintainerRFC PATCH 1/1 payload: use ethertype in hexadecimal for meta protocol
This is a temporary workaround to avoid parsing problems since ip and arp are misinterpreted by the parser. It also uses ipv6 which is different from ip6 and it seems inconsistent to me.
---
A possible alternative to this patch could be to use something
like: ether-arp ether-ip ether-ipv6 ether-vlan, as these represent ethernet protocol types.
src/payload.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
src/payload.c +3 -14
@@ -978,16 +978,6 @@ const struct datatype etheraddr_type = { .basetype = &lladdr_type, }; -static const struct symbol_table ethertype_tbl = { - .symbols = { -SYMBOL ("ip" ,ETH_P_IP ), -SYMBOL ("arp" ,ETH_P_ARP ), -SYMBOL ("ipv6" ,ETH_P_IPV6 ), -SYMBOL ("vlan" ,ETH_P_8021Q ), -SYMBOL_LIST_END - }, -}; -static struct error_record *ethertype_parse (const struct expr *sym,struct expr **res) {
@@ -996,14 +986,13 @@ static struct error_record *ethertype_parse(const struct expr *sym, erec = sym->dtype->basetype->parse (sym, res);if (erec !=NULL )return erec; -if (*res) -return NULL ; -return symbolic_constant_parse (sym, ðertype_tbl, res); + +return NULL ; }static void ethertype_print (const struct expr *expr) { -return symbolic_constant_print (ðertype_tbl, expr); +expr_basetype (expr)->const struct datatype ethertype_type = {
Signature · 1 line
1.7.10.4
Quoted 3 lines · Pablo Neira Ayuso
This is a temporary workaround to avoid parsing problems since ip and arp are misinterpreted by the parser. It also uses ipv6 which is different from ip6 and it seems inconsistent to me.
Why not fix it the way we did for TCP/UDP/...?
I agree about the inconsistencies wrt. ipv6 vs. ip6, we should change all occurences to one of both. Don't really care which one, but I guess ipv6 is "more correct".
Quoted 54 lines
Signed-off-by Pablo Neira Ayuso <[email protected]>---
A possible alternative to this patch could be to use something
like: ether-arp ether-ip ether-ipv6 ether-vlan, as these represent ethernet protocol types.src/payload.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)src/payload.c +3
-14@@ -978,16 +978,6 @@ const struct datatype etheraddr_type = { .basetype = &lladdr_type, }; -static const struct symbol_table ethertype_tbl = { - .symbols = { -SYMBOL ("ip" ,ETH_P_IP ), -SYMBOL ("arp" ,ETH_P_ARP ), -SYMBOL ("ipv6" ,ETH_P_IPV6 ), -SYMBOL ("vlan" ,ETH_P_8021Q ), -SYMBOL_LIST_END - }, -}; -static struct error_record *ethertype_parse (const struct expr *sym,struct expr **res) {@@ -996,14 +986,13 @@ static struct error_record *ethertype_parse(const struct expr *sym, erec = sym->dtype->basetype->parse (sym, res);if (erec !=NULL )return erec; -if (*res) -return NULL ; -return symbolic_constant_parse (sym, ðertype_tbl, res); + +return NULL ; }static void ethertype_print (const struct expr *expr) { -return symbolic_constant_print (ðertype_tbl, expr); +expr_basetype (expr)->const struct datatype ethertype_type = {Signature · 1 line
1.7.10.4