Diff between 12cf7617adf628377301d9eb2ffa3cd1a8f34ad9 and 20adf23209c8848fe60742eeedcb714bf92eec2e

Changed Files

File Additions Deletions Status
src/btd.h +1 -0 modified
src/main.c +18 -4 modified
src/main.conf +20 -5 modified

Full Patch

diff --git a/src/btd.h b/src/btd.h
index f83591f..ff9f082 100644
--- a/src/btd.h
+++ b/src/btd.h
@@ -103,6 +103,7 @@ struct btd_opts {
 	uint32_t	discovto;
 	uint32_t	tmpto;
 	uint8_t		privacy;
+	bool		device_privacy;
 
 	struct btd_defaults defaults;
 
diff --git a/src/main.c b/src/main.c
index 2835c81..dd954e1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -666,13 +666,27 @@ static void parse_config(GKeyFile *config)
 	} else {
 		DBG("privacy=%s", str);
 
-		if (!strcmp(str, "network") || !strcmp(str, "on"))
+		if (!strcmp(str, "network") || !strcmp(str, "on")) {
 			btd_opts.privacy = 0x01;
-		if (!strcmp(str, "device") || !strcmp(str, "limited"))
+		} else if (!strcmp(str, "device")) {
+			btd_opts.privacy = 0x01;
+			btd_opts.device_privacy = true;
+		} else if (!strcmp(str, "limited-network")) {
+			if (btd_opts.mode != BT_MODE_DUAL) {
+				DBG("Invalid privacy option: %s", str);
+				btd_opts.privacy = 0x00;
+			}
+			btd_opts.privacy = 0x01;
+		} else if (!strcmp(str, "limited-device")) {
+			if (btd_opts.mode != BT_MODE_DUAL) {
+				DBG("Invalid privacy option: %s", str);
+				btd_opts.privacy = 0x00;
+			}
 			btd_opts.privacy = 0x02;
-		else if (!strcmp(str, "off"))
+			btd_opts.device_privacy = true;
+		} else if (!strcmp(str, "off")) {
 			btd_opts.privacy = 0x00;
-		else {
+		} else {
 			DBG("Invalid privacy option: %s", str);
 			btd_opts.privacy = 0x00;
 		}
diff --git a/src/main.conf b/src/main.conf
index 4019ea9..c82d7e6 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -67,14 +67,29 @@
 
 # Default privacy setting.
 # Enables use of private address.
-# Possible values: "off", "network/on", "device/limited"
-# "network/on": a device will only accept advertising packets from peer devices
-# that contain private addresses. It may not be compatible with some legacy
-# devices since it requires the use of RPA(s) all the time.
-# "device/limited": A device in device privacy mode is only concerned about the
+# Possible values for LE mode: "off", "network/on", "device"
+# Possible values for Dual mode: "off", "network/on", "device",
+# "limited-network", "limited-device"
+#
+# - off: Local privacy disabled.
+#
+# - network/on: A device will only accept advertising packets from peer
+# devices that contain private addresses. It may not be compatible with some
+# legacy devices since it requires the use of RPA(s) all the time.
+#
+# - device: A device in device privacy mode is only concerned about the
 # privacy of the device and will accept advertising packets from peer devices
 # that contain their Identity Address as well as ones that contain a private
 # address, even if the peer device has distributed its IRK in the past.
+
+# - limited-network: Apply Limited Discoverable Mode to advertising, which
+# follows the same policy as to BR/EDR that publishes the identity address when
+# discoverable, and Network Privacy Mode for scanning.
+#
+# - limited-device: Apply Limited Discoverable Mode to advertising, which
+# follows the same policy as to BR/EDR that publishes the identity address when
+# discoverable, and Device Privacy Mode for scanning.
+#
 # Defaults to "off"
 #Privacy = off