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.
This commit is contained in:
Ravi kumar Veeramally 2014-02-06 16:28:39 +01:00 committed by Luiz Augusto von Dentz
parent 375bed1c4d
commit ce8bf58e5f

View File

@ -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);