net: decode Bluetooth protocol names unconditionally

As we have all BTPROTO_* constant definitions now, there is no need
to rely on bluetooth.h header anymore.

* net.c (AF_BLUETOOTH): Provide a fallback definition.
[HAVE_BLUETOOTH_BLUETOOTH_H]: Do not include <bluetooth/bluetooth.h>.
[!HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h".
[!HAVE_BLUETOOTH_BLUETOOTH_H] (decode_sockbuf): Decode AF_BLUETOOTH.
(decode_sockbuf) <case AF_BLUETOOTH>: Use printxval_index.
* xlat/bt_protocols.in: Add "#value_indexed" directive.
This commit is contained in:
Eugene Syromyatnikov 2018-04-11 13:53:54 +02:00 committed by Dmitry V. Levin
parent 616fa24122
commit 02114f254c
2 changed files with 5 additions and 6 deletions

10
net.c
View File

@ -84,10 +84,10 @@
#include "xlat/inet_protocols.h"
#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
# include <bluetooth/bluetooth.h>
# include "xlat/bt_protocols.h"
#ifndef AF_BLUETOOTH
# define AF_BLUETOOTH 31
#endif
#include "xlat/bt_protocols.h"
static void
decode_sockbuf(struct tcb *const tcp, const int fd, const kernel_ulong_t addr,
@ -138,11 +138,9 @@ SYS_FUNC(socket)
printxval(netlink_protocols, tcp->u_arg[2], "NETLINK_???");
break;
#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
case AF_BLUETOOTH:
printxval(bt_protocols, tcp->u_arg[2], "BTPROTO_???");
printxval_index(bt_protocols, tcp->u_arg[2], "BTPROTO_???");
break;
#endif
default:
tprintf("%" PRI_klu, tcp->u_arg[2]);

View File

@ -1,3 +1,4 @@
#value_indexed
BTPROTO_L2CAP 0
BTPROTO_HCI 1
BTPROTO_SCO 2