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.
This commit is contained in:
Eugene Syromyatnikov 2018-08-27 15:20:33 +02:00 committed by Dmitry V. Levin
parent 9a969eb670
commit 38e0f55602

8
net.c
View File

@ -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;