[PATCH 3/3] proto: fix byteorder of ETH_P_* values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <kaber@xxxxxxxxx>
---
 src/proto.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/proto.c b/src/proto.c
index e5f49cb..15a456a 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),
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux