Add support for secure mode

This commit is contained in:
Marcel Holtmann 2004-11-18 08:23:23 +00:00
parent e3c755f8a8
commit 6f6c722d1f
2 changed files with 13 additions and 2 deletions

View File

@ -62,6 +62,7 @@ static int persist;
static int use_sdp = 1;
static int use_cache;
static int encrypt;
static int secure;
static int master;
static int cleanup;
static int search_duration = 10;
@ -166,9 +167,10 @@ static int do_listen(void)
lm = 0;
if (master)
lm |= L2CAP_LM_MASTER;
if (encrypt)
lm |= L2CAP_LM_ENCRYPT;
if (secure)
lm |= L2CAP_LM_SECURE;
if (lm && setsockopt(sk, SOL_L2CAP, L2CAP_LM, &lm, sizeof(lm)) < 0) {
syslog(LOG_ERR, "Failed to set link mode. %s(%d)", strerror(errno), errno);
@ -493,6 +495,7 @@ static struct option main_lopts[] = {
{ "nodetach", 0, 0, 'n' },
{ "persist", 2, 0, 'p' },
{ "encrypt", 0, 0, 'E' },
{ "secure", 0, 0, 'S' },
{ "master", 0, 0, 'M' },
{ "cache", 0, 0, 'C' },
{ "pidfile", 1, 0, 'P' },
@ -500,7 +503,7 @@ static struct option main_lopts[] = {
{ 0, 0, 0, 0 }
};
static char main_sopts[] = "hsc:k:Kr:e:i:lnp::DQ::EMC::P:z";
static char main_sopts[] = "hsc:k:Kr:e:i:lnp::DQ::ESMC::P:z";
static char main_help[] =
"Bluetooth PAN daemon version " VERSION " \n"
@ -520,6 +523,7 @@ static char main_help[] =
"\t--device -i <bdaddr> Source bdaddr\n"
"\t--nosdp -D Disable SDP\n"
"\t--encrypt -E Enable encryption\n"
"\t--secure -S Secure connection\n"
"\t--master -M Become the master of a piconet\n"
"\t--nodetach -n Do not become a daemon\n"
"\t--persist -p[interval] Persist mode\n"
@ -586,6 +590,10 @@ int main(int argc, char **argv)
encrypt = 1;
break;
case 'S':
secure = 1;
break;
case 'M':
master = 1;
break;

View File

@ -45,6 +45,9 @@ Disable SDP
\fB\-\-encrypt\fR \fB\-E\fR
Enable encryption
.TP
\fB\-\-secure\fR \fB\-S\fR
Secure connection
.TP
\fB\-\-master\fR \fB\-M\fR
Become the master of a piconet
.TP