From 54943abd65058d7c24fbf9384759181c16913a96 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 28 Sep 2007 13:30:48 +0000 Subject: Add secure link mode. --- network/manager.c | 2 +- network/server.c | 6 +++--- network/server.h | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'network') diff --git a/network/manager.c b/network/manager.c index b5b4f0a8..053e03bb 100644 --- a/network/manager.c +++ b/network/manager.c @@ -939,7 +939,7 @@ int network_init(DBusConnection *conn, struct network_conf *service_conf) * (setup connection request) contains the destination service * field that defines which service the source is connecting to. */ - if (server_init(conn, conf->iface_prefix) < 0) + if (server_init(conn, conf->iface_prefix, conf->security) < 0) return -1; if (connection_init(conn, conf->iface_prefix) < 0) diff --git a/network/server.c b/network/server.c index b5a2c6d0..ac87ad19 100644 --- a/network/server.c +++ b/network/server.c @@ -600,7 +600,8 @@ static gboolean connect_event(GIOChannel *chan, return TRUE; } -int server_init(DBusConnection *conn, const char *iface_prefix) +int server_init(DBusConnection *conn, const char *iface_prefix, + gboolean secure) { struct l2cap_options l2o; struct sockaddr_l2 l2a; @@ -645,8 +646,7 @@ int server_init(DBusConnection *conn, const char *iface_prefix) goto fail; } - /* FIXME: Set link mode - it is applied to all servers */ - lm = 0; + lm = secure? L2CAP_LM_SECURE : 0; if (lm && setsockopt(sk, SOL_L2CAP, L2CAP_LM, &lm, sizeof(lm)) < 0) { err = errno; error("Failed to set link mode. %s(%d)", diff --git a/network/server.h b/network/server.h index 9f49cad7..839aea4b 100644 --- a/network/server.h +++ b/network/server.h @@ -21,7 +21,8 @@ * */ -int server_init(DBusConnection *conn, const char *iface_prefix); +int server_init(DBusConnection *conn, const char *iface_prefix, + gboolean secure); void server_exit(); int server_register(const char *path, bdaddr_t *src, uint16_t id); int server_register_from_file(const char *path, const bdaddr_t *src, -- cgit