summaryrefslogtreecommitdiffstats
path: root/tools/hciconfig.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-10-25 08:34:08 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-10-25 08:34:08 +0000
commit8831229d721edddb91548d86420a013f5b44b57f (patch)
tree36a2e81c9df80419a6fbcb1d6c7cdb1ab8469b9c /tools/hciconfig.c
parent8e6ac465d6f3504f60d6e81e0c6f5dc6a653717c (diff)
Support for enabling the kernel security manager
Diffstat (limited to 'tools/hciconfig.c')
-rw-r--r--tools/hciconfig.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index 797cb775..0e591e8d 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -198,12 +198,12 @@ void cmd_auth(int ctl, int hdev, char *opt)
struct hci_dev_req dr;
dr.dev_id = hdev;
- if( !strcmp(opt, "auth") )
+ if (!strcmp(opt, "auth"))
dr.dev_opt = AUTH_ENABLED;
else
dr.dev_opt = AUTH_DISABLED;
- if( ioctl(ctl, HCISETAUTH, (unsigned long)&dr) < 0 ) {
+ if (ioctl(ctl, HCISETAUTH, (unsigned long) &dr) < 0) {
printf("Can't set auth on hci%d. %s(%d)\n", hdev, strerror(errno), errno);
exit(1);
}
@@ -214,17 +214,33 @@ void cmd_encrypt(int ctl, int hdev, char *opt)
struct hci_dev_req dr;
dr.dev_id = hdev;
- if( !strcmp(opt, "encrypt") )
+ if (!strcmp(opt, "encrypt"))
dr.dev_opt = ENCRYPT_P2P;
else
dr.dev_opt = ENCRYPT_DISABLED;
- if( ioctl(ctl, HCISETENCRYPT, (unsigned long)&dr) < 0 ) {
+ if (ioctl(ctl, HCISETENCRYPT, (unsigned long) &dr) < 0) {
printf("Can't set encrypt on hci%d. %s(%d)\n", hdev, strerror(errno), errno);
exit(1);
}
}
+void cmd_secmgr(int ctl, int hdev, char *opt)
+{
+ int val, s = hci_open_dev(hdev);
+
+ if (!strcmp(opt, "secmgr"))
+ val = 1;
+ else
+ val = 0;
+
+ if (ioctl(s, HCISETSECMGR, val) < 0) {
+ printf("Can't set security manager on hci%d. %s(%d)\n", hdev, strerror(errno), errno);
+ exit(1);
+ }
+ close(s);
+}
+
void cmd_up(int ctl, int hdev, char *opt)
{
int ret;
@@ -236,7 +252,7 @@ void cmd_up(int ctl, int hdev, char *opt)
printf("Can't init device hci%d. %s(%d)\n", hdev, strerror(errno), errno);
exit(1);
}
- cmd_scan(ctl, hdev, "piscan");
+ cmd_scan(ctl, hdev, "piscan");
}
void cmd_down(int ctl, int hdev, char *opt)
@@ -1119,6 +1135,8 @@ struct {
{ "noauth", cmd_auth, 0, "Disable Authentication" },
{ "encrypt", cmd_encrypt, 0, "Enable Encryption" },
{ "noencrypt", cmd_encrypt, 0, "Disable Encryption" },
+ { "secmgr", cmd_secmgr, 0, "Enable Security Manager" },
+ { "nosecmgr", cmd_secmgr, 0, "Disable Security Manager" },
{ "piscan", cmd_scan, 0, "Enable Page and Inquiry scan" },
{ "noscan", cmd_scan, 0, "Disable scan" },
{ "iscan", cmd_scan, 0, "Enable Inquiry scan" },