vserver 1.9.5.x5
[linux-2.6.git] / net / bluetooth / hci_sock.c
index 348a82f..7fe6b9f 100644 (file)
@@ -111,7 +111,8 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
                /* Apply filter */
                flt = &hci_pi(sk)->filter;
 
-               if (!test_bit((skb->pkt_type & HCI_FLT_TYPE_BITS), &flt->type_mask))
+               if (!test_bit((skb->pkt_type == HCI_VENDOR_PKT) ?
+                               0 : (skb->pkt_type & HCI_FLT_TYPE_BITS), &flt->type_mask))
                        continue;
 
                if (skb->pkt_type == HCI_EVENT_PKT) {
@@ -178,6 +179,9 @@ static inline int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, unsign
                if (!capable(CAP_NET_ADMIN))
                        return -EACCES;
 
+               if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
+                       return -EPERM;
+
                if (arg)
                        set_bit(HCI_RAW, &hdev->flags);
                else
@@ -185,6 +189,17 @@ static inline int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, unsign
 
                return 0;
 
+       case HCISETSECMGR:
+               if (!capable(CAP_NET_ADMIN))
+                       return -EACCES;
+
+               if (arg)
+                       set_bit(HCI_SECMGR, &hdev->flags);
+               else
+                       clear_bit(HCI_SECMGR, &hdev->flags);
+
+               return 0;
+
        case HCIGETCONNINFO:
                return hci_get_conn_info(hdev, (void __user *)arg);
 
@@ -435,7 +450,7 @@ drop:
        goto done;
 }
 
-int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int len)
+static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int len)
 {
        struct hci_ufilter uf = { .opcode = 0 };
        struct sock *sk = sock->sk;
@@ -502,7 +517,7 @@ int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user
        return err;
 }
 
-int hci_sock_getsockopt(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)
 {
        struct hci_ufilter uf;
        struct sock *sk = sock->sk;
@@ -555,7 +570,7 @@ int hci_sock_getsockopt(struct socket *sock, int level, int optname, char __user
        return 0;
 }
 
-struct proto_ops hci_sock_ops = {
+static struct proto_ops hci_sock_ops = {
        .family         = PF_BLUETOOTH,
        .owner          = THIS_MODULE,
        .release        = hci_sock_release,
@@ -635,13 +650,13 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
        return NOTIFY_DONE;
 }
 
-struct net_proto_family hci_sock_family_ops = {
+static struct net_proto_family hci_sock_family_ops = {
        .family = PF_BLUETOOTH,
        .owner  = THIS_MODULE,
        .create = hci_sock_create,
 };
 
-struct notifier_block hci_sock_nblock = {
+static struct notifier_block hci_sock_nblock = {
        .notifier_call = hci_sock_dev_event
 };