net: decode more AF_* protocol names

* xlat/caif_protocols.in: New file.
* xlat/can_protocols.in: Likewise.
* xlat/irda_protocols.in: Likewise.
* xlat/isdn_protocols.in: Likewise.
* xlat/kcm_protocols.in: Likewise.
* xlat/nfc_protocols.in: Likewise.
* xlat/phonet_protocols.in: Likewise.
* xlat/smc_protocols.in: Likewise.
* net.c: Include "xlat/irda_protocols.h", "xlat/can_protocols.h",
"xlat/isdn_protocols.h", "xlat/phonet_protocols.h",
"xlat/caif_protocols.h", "xlat/nfc_protocols.h",
"xlat/kcm_protocols.h", and "xlat/smc_protocols.h".
(SYS_FUNC(socket)): Decode AF_IRDA, AF_CAN, AF_RXRPC, AF_ISDN,
AF_PHONET, AF_CAIF, AF_NFC, AF_KCM, and AF_SMC protocol names.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
This commit is contained in:
Eugene Syromyatnikov 2018-05-07 06:10:41 +00:00 committed by Dmitry V. Levin
parent fb3d571696
commit 4784564caf
9 changed files with 93 additions and 0 deletions

45
net.c
View File

@ -87,7 +87,15 @@
#define XLAT_MACROS_ONLY
# include "xlat/addrfams.h"
#undef XLAT_MACROS_ONLY
#include "xlat/irda_protocols.h"
#include "xlat/can_protocols.h"
#include "xlat/bt_protocols.h"
#include "xlat/isdn_protocols.h"
#include "xlat/phonet_protocols.h"
#include "xlat/caif_protocols.h"
#include "xlat/nfc_protocols.h"
#include "xlat/kcm_protocols.h"
#include "xlat/smc_protocols.h"
static void
decode_sockbuf(struct tcb *const tcp, const int fd, const kernel_ulong_t addr,
@ -138,10 +146,47 @@ SYS_FUNC(socket)
printxval(netlink_protocols, tcp->u_arg[2], "NETLINK_???");
break;
case AF_IRDA:
printxval_index(can_protocols, tcp->u_arg[2], "IRDAPROTO_???");
break;
case AF_CAN:
printxval_index(can_protocols, tcp->u_arg[2], "CAN_???");
break;
case AF_BLUETOOTH:
printxval_index(bt_protocols, tcp->u_arg[2], "BTPROTO_???");
break;
case AF_RXRPC:
printxval(addrfams, tcp->u_arg[2], "AF_???");
break;
case AF_ISDN:
printxval(isdn_protocols, tcp->u_arg[2], "ISDN_P_???");
break;
case AF_PHONET:
printxval_index(phonet_protocols, tcp->u_arg[2], "PN_PROTO_???");
break;
case AF_CAIF:
printxval_index(caif_protocols, tcp->u_arg[2], "CAIFPROTO_???");
break;
case AF_NFC:
printxval_index(nfc_protocols, tcp->u_arg[2],
"NFC_SOCKPROTO_???");
break;
case AF_KCM:
printxval_index(kcm_protocols, tcp->u_arg[2], "KCMPROTO_???");
break;
case AF_SMC:
printxval_index(smc_protocols, tcp->u_arg[2], "SMCPROTO_???");
break;
default:
tprintf("%" PRI_klu, tcp->u_arg[2]);
break;

7
xlat/caif_protocols.in Normal file
View File

@ -0,0 +1,7 @@
#value_indexed
CAIFPROTO_AT 0
CAIFPROTO_DATAGRAM 1
CAIFPROTO_DATAGRAM_LOOP 2
CAIFPROTO_UTIL 3
CAIFPROTO_RFM 4
CAIFPROTO_DEBUG 5

7
xlat/can_protocols.in Normal file
View File

@ -0,0 +1,7 @@
#value_indexed
CAN_RAW 1
CAN_BCM 2
CAN_TP16 3
CAN_TP20 4
CAN_MCNET 5
CAN_ISOTP 6

3
xlat/irda_protocols.in Normal file
View File

@ -0,0 +1,3 @@
#value_indexed
IRDAPROTO_UNITDATA 0
IRDAPROTO_ULTRA 1

19
xlat/isdn_protocols.in Normal file
View File

@ -0,0 +1,19 @@
ISDN_P_BASE 0
ISDN_P_TE_S0 1
ISDN_P_NT_S0 2
ISDN_P_TE_E1 3
ISDN_P_NT_E1 4
ISDN_P_LAPD_TE 0x10
ISDN_P_LAPD_NT 0x11
ISDN_P_B_RAW 0x21
ISDN_P_B_HDLC 0x22
ISDN_P_B_X75SLP 0x23
ISDN_P_B_L2DTMF 0x24
ISDN_P_B_L2DSP 0x25
ISDN_P_B_L2DSPHDLC 0x26
/*
* those two are present in include/linux/mISDNif.h but are not handled during
* socket creation.
*/
/* ISDN_P_B_T30_FAX 0x27 */
/* ISDN_P_B_MODEM_ASYNC 0x28 */

2
xlat/kcm_protocols.in Normal file
View File

@ -0,0 +1,2 @@
#value_indexed
KCMPROTO_CONNECTED 0

3
xlat/nfc_protocols.in Normal file
View File

@ -0,0 +1,3 @@
#value_indexed
NFC_SOCKPROTO_RAW 0
NFC_SOCKPROTO_LLCP 1

4
xlat/phonet_protocols.in Normal file
View File

@ -0,0 +1,4 @@
#value_indexed
PN_PROTO_TRANSPORT 0
PN_PROTO_PHONET 1
PN_PROTO_PIPE 2

3
xlat/smc_protocols.in Normal file
View File

@ -0,0 +1,3 @@
#value_indexed
MCPROTO_SMC 0
SMCPROTO_SMC6 1