]> granicus.if.org Git - strace/commitdiff
net: decode AF_PACKET protocols in socket syscall
authorEugene Syromyatnikov <evgsyr@gmail.com>
Mon, 27 Aug 2018 13:20:33 +0000 (15:20 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 2 Sep 2018 17:44:26 +0000 (17:44 +0000)
* net.c: Include "xlat/ethernet_protocols.h" in XLAT_MACROS_ONLY mode.
(SYS_FUNC(socket)) <AF_PACKET>: Decode using ethernet_protocols xlat.

net.c

diff --git a/net.c b/net.c
index 66dde0f40ca3490043bdc101cb0e6de629bd27c1..58296b9c4e3d49681d68d6854d77cb85a3cc7483 100644 (file)
--- 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;