From 4b2834b7e2334e30352fc1126577df217f351cd5 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 19 Aug 2014 00:21:59 +0100 Subject: proto: fix byteorder of ETH_P_* values The ethernet header type is in big endian byte order, the ETH_P_* values are in host byte order however. Fix this using __constant_htons(). Signed-off-by: Patrick McHardy --- src/proto.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/proto.c') diff --git a/src/proto.c b/src/proto.c index e5f49cb2..15a456a7 100644 --- a/src/proto.c +++ b/src/proto.c @@ -712,10 +712,10 @@ const struct proto_desc proto_vlan = { .base = PROTO_BASE_LL_HDR, .protocol_key = VLANHDR_TYPE, .protocols = { - PROTO_LINK(ETH_P_IP, &proto_ip), - PROTO_LINK(ETH_P_ARP, &proto_arp), - PROTO_LINK(ETH_P_IPV6, &proto_ip6), - PROTO_LINK(ETH_P_8021Q, &proto_vlan), + PROTO_LINK(__constant_htons(ETH_P_IP), &proto_ip), + PROTO_LINK(__constant_htons(ETH_P_ARP), &proto_arp), + PROTO_LINK(__constant_htons(ETH_P_IPV6), &proto_ip6), + PROTO_LINK(__constant_htons(ETH_P_8021Q), &proto_vlan), }, .templates = { @@ -741,10 +741,10 @@ const struct datatype etheraddr_type = { static const struct symbol_table ethertype_tbl = { .symbols = { - SYMBOL("ip", ETH_P_IP), - SYMBOL("arp", ETH_P_ARP), - SYMBOL("ip6", ETH_P_IPV6), - SYMBOL("vlan", ETH_P_8021Q), + SYMBOL("ip", __constant_htons(ETH_P_IP)), + SYMBOL("arp", __constant_htons(ETH_P_ARP)), + SYMBOL("ip6", __constant_htons(ETH_P_IPV6)), + SYMBOL("vlan", __constant_htons(ETH_P_8021Q)), SYMBOL_LIST_END }, }; @@ -792,10 +792,10 @@ const struct proto_desc proto_eth = { .base = PROTO_BASE_LL_HDR, .protocol_key = ETHHDR_TYPE, .protocols = { - PROTO_LINK(ETH_P_IP, &proto_ip), - PROTO_LINK(ETH_P_ARP, &proto_arp), - PROTO_LINK(ETH_P_IPV6, &proto_ip6), - PROTO_LINK(ETH_P_8021Q, &proto_vlan), + PROTO_LINK(__constant_htons(ETH_P_IP), &proto_ip), + PROTO_LINK(__constant_htons(ETH_P_ARP), &proto_arp), + PROTO_LINK(__constant_htons(ETH_P_IPV6), &proto_ip6), + PROTO_LINK(__constant_htons(ETH_P_8021Q), &proto_vlan), }, .templates = { [ETHHDR_DADDR] = ETHHDR_ADDR("daddr", ether_dhost), -- cgit v1.2.3