summaryrefslogtreecommitdiff
path: root/android/pan.c
diff options
context:
space:
mode:
authorRavi kumar Veeramally <ravikumar.veeramally@linux.intel.com>2014-02-06 16:28:39 +0100
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-02-07 11:21:22 +0200
commitce8bf58e5f5fbc2ecc1aa68b5ac76350dbce6b6d (patch)
treeacf46dc51d83b3e11b42f71364fb220c0673841b /android/pan.c
parent375bed1c4df456c1cf675ffb6458b637c00abe46 (diff)
downloadbluez-ce8bf58e5f5fbc2ecc1aa68b5ac76350dbce6b6d.tar.gz
android/pan: Fix bnep interface name
Android uses bt-pan static interface in PAN profile. In server role it uses it as bridge name. But current implementaion passes interface names like bnep0, bnep1... Android Framework is unaware of this name and unable to allocate IP address after profile connection setup.
Diffstat (limited to 'android/pan.c')
-rw-r--r--android/pan.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/android/pan.c b/android/pan.c
index 0d6adafdb..83def538a 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -51,8 +51,9 @@
#define SVC_HINT_NETWORKING 0x02
-#define BNEP_BRIDGE "bnep"
+#define BNEP_BRIDGE "bt-pan"
#define BNEP_PANU_INTERFACE "bt-pan"
+#define BNEP_NAP_INTERFACE "bt-pan%d"
#define FORWARD_DELAY_PATH "/sys/class/net/"BNEP_BRIDGE"/bridge/forward_delay"
static bdaddr_t adapter_addr;
@@ -229,8 +230,13 @@ static void bt_pan_notify_ctrl_state(struct pan_device *dev, uint8_t state)
ev.state = state;
ev.local_role = local_role;
ev.status = HAL_STATUS_SUCCESS;
+
memset(ev.name, 0, sizeof(ev.name));
- memcpy(ev.name, dev->iface, sizeof(dev->iface));
+
+ if (local_role == HAL_PAN_ROLE_NAP)
+ memcpy(ev.name, BNEP_BRIDGE, sizeof(BNEP_BRIDGE));
+ else
+ memcpy(ev.name, dev->iface, sizeof(dev->iface));
ipc_send_notif(HAL_SERVICE_ID_PAN, HAL_EV_PAN_CTRL_STATE, sizeof(ev),
&ev);
@@ -542,6 +548,9 @@ static void nap_confirm_cb(GIOChannel *chan, gpointer data)
local_role = HAL_PAN_ROLE_NAP;
dev->role = HAL_PAN_ROLE_PANU;
+ strncpy(dev->iface, BNEP_NAP_INTERFACE, 16);
+ dev->iface[15] = '\0';
+
dev->io = g_io_channel_ref(chan);
g_io_channel_set_close_on_unref(dev->io, TRUE);