From 38e0f556022f9b38b401c63201b95a95fdefa91d Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Mon, 27 Aug 2018 15:20:33 +0200
Subject: [PATCH 063/293] net: decode AF_PACKET protocols in socket syscall

* net.c: Include "xlat/ethernet_protocols.h" in XLAT_MACROS_ONLY mode.
(SYS_FUNC(socket)) <AF_PACKET>: Decode using ethernet_protocols xlat.
---
 net.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net.c b/net.c
index 66dde0f..58296b9 100644
--- a/net.c
+++ b/net.c
@@ -86,6 +86,7 @@
 
 #define XLAT_MACROS_ONLY
 # include "xlat/addrfams.h"
+# include "xlat/ethernet_protocols.h"
 #undef XLAT_MACROS_ONLY
 #include "xlat/irda_protocols.h"
 #include "xlat/can_protocols.h"
@@ -148,6 +149,13 @@ SYS_FUNC(socket)
 		printxval(netlink_protocols, tcp->u_arg[2], "NETLINK_???");
 		break;
 
+	case AF_PACKET:
+		tprints("htons(");
+		printxval_searchn(ethernet_protocols, ethernet_protocols_size,
+				  ntohs(tcp->u_arg[2]), "ETH_P_???");
+		tprints(")");
+		break;
+
 	case AF_IRDA:
 		printxval_index(can_protocols, tcp->u_arg[2], "IRDAPROTO_???");
 		break;
-- 
1.7.12.4

