#include <linux/compat.h>
#include <linux/export.h>
#include <linux/utsname.h>
#include <linux/sched.h>
#include <linux/unaligned.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
#include <net/bluetooth/hci_mon.h>
#include <net/bluetooth/mgmt.h>
#include "mgmt_util.h"
static LIST_HEAD(mgmt_chan_list);
static DEFINE_MUTEX(mgmt_chan_list_lock);
static DEFINE_IDA(sock_cookie_ida);
static atomic_t monitor_promisc = …;
#define hci_pi(sk) …
struct hci_pinfo { … };
static struct hci_dev *hci_hdev_from_sock(struct sock *sk)
{ … }
void hci_sock_set_flag(struct sock *sk, int nr)
{ … }
void hci_sock_clear_flag(struct sock *sk, int nr)
{ … }
int hci_sock_test_flag(struct sock *sk, int nr)
{ … }
unsigned short hci_sock_get_channel(struct sock *sk)
{ … }
u32 hci_sock_get_cookie(struct sock *sk)
{ … }
static bool hci_sock_gen_cookie(struct sock *sk)
{ … }
static void hci_sock_free_cookie(struct sock *sk)
{ … }
static inline int hci_test_bit(int nr, const void *addr)
{ … }
#define HCI_SFLT_MAX_OGF …
struct hci_sec_filter { … };
static const struct hci_sec_filter hci_sec_filter = …;
static struct bt_sock_list hci_sk_list = …;
static bool is_filtered_packet(struct sock *sk, struct sk_buff *skb)
{ … }
void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
{ … }
static void hci_sock_copy_creds(struct sock *sk, struct sk_buff *skb)
{ … }
static struct sk_buff *hci_skb_clone(struct sk_buff *skb)
{ … }
static void __hci_send_to_channel(unsigned short channel, struct sk_buff *skb,
int flag, struct sock *skip_sk)
{ … }
void hci_send_to_channel(unsigned short channel, struct sk_buff *skb,
int flag, struct sock *skip_sk)
{ … }
void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb)
{ … }
void hci_send_monitor_ctrl_event(struct hci_dev *hdev, u16 event,
void *data, u16 data_len, ktime_t tstamp,
int flag, struct sock *skip_sk)
{ … }
static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event)
{ … }
static struct sk_buff *create_monitor_ctrl_open(struct sock *sk)
{ … }
static struct sk_buff *create_monitor_ctrl_close(struct sock *sk)
{ … }
static struct sk_buff *create_monitor_ctrl_command(struct sock *sk, u16 index,
u16 opcode, u16 len,
const void *buf)
{ … }
static void __printf(2, 3)
send_monitor_note(struct sock *sk, const char *fmt, ...)
{ … }
static void send_monitor_replay(struct sock *sk)
{ … }
static void send_monitor_control_replay(struct sock *mon_sk)
{ … }
static void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data)
{ … }
void hci_sock_dev_event(struct hci_dev *hdev, int event)
{ … }
static struct hci_mgmt_chan *__hci_mgmt_chan_find(unsigned short channel)
{ … }
static struct hci_mgmt_chan *hci_mgmt_chan_find(unsigned short channel)
{ … }
int hci_mgmt_chan_register(struct hci_mgmt_chan *c)
{ … }
EXPORT_SYMBOL(…);
void hci_mgmt_chan_unregister(struct hci_mgmt_chan *c)
{ … }
EXPORT_SYMBOL(…);
static int hci_sock_release(struct socket *sock)
{ … }
static int hci_sock_reject_list_add(struct hci_dev *hdev, void __user *arg)
{ … }
static int hci_sock_reject_list_del(struct hci_dev *hdev, void __user *arg)
{ … }
static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd,
unsigned long arg)
{ … }
static int hci_sock_ioctl(struct socket *sock, unsigned int cmd,
unsigned long arg)
{ … }
#ifdef CONFIG_COMPAT
static int hci_sock_compat_ioctl(struct socket *sock, unsigned int cmd,
unsigned long arg)
{ … }
#endif
static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
int addr_len)
{ … }
static int hci_sock_getname(struct socket *sock, struct sockaddr *addr,
int peer)
{ … }
static void hci_sock_cmsg(struct sock *sk, struct msghdr *msg,
struct sk_buff *skb)
{ … }
static int hci_sock_recvmsg(struct socket *sock, struct msghdr *msg,
size_t len, int flags)
{ … }
static int hci_mgmt_cmd(struct hci_mgmt_chan *chan, struct sock *sk,
struct sk_buff *skb)
{ … }
static int hci_logging_frame(struct sock *sk, struct sk_buff *skb,
unsigned int flags)
{ … }
static int hci_sock_sendmsg(struct socket *sock, struct msghdr *msg,
size_t len)
{ … }
static int hci_sock_setsockopt_old(struct socket *sock, int level, int optname,
sockptr_t optval, unsigned int len)
{ … }
static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
sockptr_t optval, unsigned int len)
{ … }
static int hci_sock_getsockopt_old(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{ … }
static int hci_sock_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{ … }
static void hci_sock_destruct(struct sock *sk)
{ … }
static const struct proto_ops hci_sock_ops = …;
static struct proto hci_sk_proto = …;
static int hci_sock_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ … }
static const struct net_proto_family hci_sock_family_ops = …;
int __init hci_sock_init(void)
{ … }
void hci_sock_cleanup(void)
{ … }