]> granicus.if.org Git - strace/commitdiff
net: add support for AX.25 protocols and socket option names decoding
authorEugene Syromyatnikov <evgsyr@gmail.com>
Mon, 27 Aug 2018 04:22:52 +0000 (06:22 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 2 Sep 2018 22:03:43 +0000 (22:03 +0000)
* xlat/ax25_protocols.in: New file.
* xlat/sock_ax25_options.in: Likewise.
* net.c: Include "xlat/ax25_protocols.h" and "xlat/sock_ax25_options.h".
* (SYS_FUNC(socket)): <[AF_AX25]>: Print protocol name using
ax25_protocols xlat.
(print_sockopt_fd_level_name) <[SOL_AX25]>: Print socket option name
using sock_ax25_options xlat.

net.c
xlat/ax25_protocols.in [new file with mode: 0644]
xlat/sock_ax25_options.in [new file with mode: 0644]

diff --git a/net.c b/net.c
index 58296b9c4e3d49681d68d6854d77cb85a3cc7483..f791a92b06ca8f5cfcfa39d47a3460062471a229 100644 (file)
--- a/net.c
+++ b/net.c
@@ -88,6 +88,7 @@
 # include "xlat/addrfams.h"
 # include "xlat/ethernet_protocols.h"
 #undef XLAT_MACROS_ONLY
+#include "xlat/ax25_protocols.h"
 #include "xlat/irda_protocols.h"
 #include "xlat/can_protocols.h"
 #include "xlat/bt_protocols.h"
@@ -145,6 +146,12 @@ SYS_FUNC(socket)
                printxval_search(inet_protocols, tcp->u_arg[2], "IPPROTO_???");
                break;
 
+       case AF_AX25:
+               /* Those are not available in public headers.  */
+               printxval_searchn_ex(ARRSZ_PAIR(ax25_protocols), tcp->u_arg[2],
+                                    "AX25_P_???", XLAT_STYLE_VERBOSE);
+               break;
+
        case AF_NETLINK:
                printxval(netlink_protocols, tcp->u_arg[2], "NETLINK_???");
                break;
@@ -445,6 +452,7 @@ SYS_FUNC(socketpair)
 #include "xlat/getsock_ipv6_options.h"
 #include "xlat/setsock_ipv6_options.h"
 #include "xlat/sock_ipx_options.h"
+#include "xlat/sock_ax25_options.h"
 #include "xlat/sock_netlink_options.h"
 #include "xlat/sock_packet_options.h"
 #include "xlat/sock_raw_options.h"
@@ -496,6 +504,9 @@ print_sockopt_fd_level_name(struct tcb *tcp, int fd, unsigned int level,
        case SOL_IPX:
                printxval(sock_ipx_options, name, "IPX_???");
                break;
+       case SOL_AX25:
+               printxval_search(sock_ax25_options, name, "AX25_???");
+               break;
        case SOL_PACKET:
                printxval(sock_packet_options, name, "PACKET_???");
                break;
diff --git a/xlat/ax25_protocols.in b/xlat/ax25_protocols.in
new file mode 100644 (file)
index 0000000..89ced43
--- /dev/null
@@ -0,0 +1,17 @@
+/* sorted */
+/* Those are pulled from include/net/ax25.h, they should be part of UAPI */
+AX25_P_ROSE            0x01
+AX25_P_VJCOMP          0x06    /* Compressed TCP/IP packet   */
+                               /* Van Jacobsen (RFC 1144)    */
+AX25_P_VJUNCOMP                0x07    /* Uncompressed TCP/IP packet */
+                               /* Van Jacobsen (RFC 1144)    */
+AX25_P_SEGMENT         0x08    /* Segmentation fragment      */
+AX25_P_TEXNET          0xc3    /* TEXTNET datagram protocol  */
+AX25_P_LQ              0xc4    /* Link Quality Protocol      */
+AX25_P_ATALK           0xca    /* Appletalk                  */
+AX25_P_ATALK_ARP       0xcb    /* Appletalk ARP              */
+AX25_P_IP              0xcc    /* ARPA Internet Protocol     */
+AX25_P_ARP             0xcd    /* ARPA Address Resolution    */
+AX25_P_FLEXNET         0xce    /* FlexNet                    */
+AX25_P_NETROM          0xcf    /* NET/ROM                    */
+AX25_P_TEXT            0xf0    /* No layer 3 protocol impl.  */
diff --git a/xlat/sock_ax25_options.in b/xlat/sock_ax25_options.in
new file mode 100644 (file)
index 0000000..4b6bed5
--- /dev/null
@@ -0,0 +1,15 @@
+/* sorted */
+AX25_WINDOW    1
+AX25_T1                2
+AX25_N2                3
+AX25_T3                4
+AX25_T2                5
+AX25_BACKOFF   6
+AX25_EXTSEQ    7
+AX25_PIDINCL   8
+AX25_IDLE      9
+AX25_PACLEN    10
+AX25_IAMDIGI   12
+
+/* 13, 25, or 16409, depending on arch */
+SO_BINDTODEVICE