| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
connman_technology is an opaque type but has all the parameters to handle
the connection. Those parameters are only used in wifi tethering
one and not in other technologies
|
|
|
|
|
|
|
| |
gcc complains with format-overflow for the DBG statement for the
bridge argument. Let's move the DBG after the initial checks to avoid
the complain and also make the output more helpful. If we see it in
the log, the bridge has been created.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If there is an ongoing connect or disconnect when the system is suspended,
the Bluetooth PAN device might be gone when the system resumes. This can
cause the network being removed before the connect or disconnect callback
is called. As the connect or disconnect callback do not re-check for an
existing pan->network, a crash will happen as a NULL network is accessed.
Fix this by verifying that pan->network exists when the callback is called.
connmand[9153]: src/network.c:__connman_network_disconnect() network 0x563544e6ca30
connmand[9153]: plugins/bluetooth.c:bluetooth_pan_disconnect() network 0x563544e6ca30
connmand[9153]: src/network.c:connman_network_unref_debug() 0x563544e6ca30 name phone ref 3 by src/service.c:4687:service_free()
connmand[9153]: src/ipconfig.c:__connman_ipconfig_unref_debug() 0x563544e58330 ref 0 by src/service.c:4697:service_free()
connmand[9153]: src/ipconfig.c:__connman_ipconfig_disable() ipconfig 0x563544e58330
connmand[9153]: src/ipconfig.c:__connman_ipconfig_unref_debug() 0x563544e81fd0 ref 0 by src/service.c:4704:service_free()
connmand[9153]: src/ipconfig.c:__connman_ipconfig_disable() ipconfig 0x563544e81fd0
connmand[9153]: plugins/bluetooth.c:bluetooth_pan_remove() network 0x563544e6ca30 pan 0x563544e580b0
connmand[9153]: plugins/bluetooth.c:pan_remove_nap() network 0x563544e6ca30 pan 0x563544e580b0
connmand[9153]: src/device.c:connman_device_remove_network() device 0x563544e630d0 network 0x563544e6ca30
connmand[9153]: src/device.c:free_network() network 0x563544e6ca30
connmand[9153]: src/network.c:network_remove() network 0x563544e6ca30 name phone
connmand[9153]: plugins/bluetooth.c:bluetooth_pan_remove() network 0x563544e6ca30 pan (nil)
connmand[9153]: src/network.c:connman_network_unref_debug() 0x563544e6ca30 name phone ref 2 by src/device.c:378:free_network()
connmand[9153]: src/network.c:connman_network_unref_debug() 0x563544e6ca30 name phone ref 1 by plugins/bluetooth.c:160:pan_remove_nap()
connmand[9153]: src/network.c:connman_network_unref_debug() 0x563544e6ca30 name phone ref 0 by src/device.c:378:free_network()
connmand[9153]: src/network.c:network_destruct() network 0x563544e6ca30 name phone
connmand[9153]: plugins/bluetooth.c:pan_connect_cb() network (nil) org.bluez.Error.Failed
connmand[9153]: src/network.c:connman_network_set_associating() network (nil) associating 0
connmand[9153]: Aborting (signal 11) [src/connmand]
connmand[9153]: ++++++++ backtrace ++++++++
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When bluetooth PAN connection fails, ConnMan can start looping
endlessly. This can happen when trying to connect to a device
out of reach or when trying to reconnect just after disconnect.
The debug output will look like the following:
plugins/bluetooth.c:bluetooth_pan_disconnect() network 0xfb8510
plugins/bluetooth.c:pan_disconnect_cb() network 0xfb8510 org.bluez.Error.NotConnected
plugins/bluetooth.c:pan_disconnect_cb() network 0xfb8510
src/network.c:connman_network_set_connected() network 0xfb8510 connected 0/0 connecting 0 associating 1
src/network.c:connman_network_set_error() network 0xfb8510 error 4
src/service.c:__connman_service_indicate_error() service 0xfb88e0 error 4
src/network.c:__connman_network_disconnect() network 0xfb8510
plugins/bluetooth.c:bluetooth_pan_disconnect() network 0xfb8510
plugins/bluetooth.c:pan_disconnect_cb() network 0xfb8510 org.bluez.Error.NotConnected
...
Fix this by setting network associating to false in the bluetooth
plugin.
|
| |
|
|
|
|
| |
Tethering struct is allocated memory but not freed in case of error.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a crash in pan_create_nap function when proxy_get_string
returns NULL for "Adapter".
The Backtrace:
update_properties
->add_property
-->pan_create_nap
--->g_hash_table_lookup
---->g_str_hash
R0: 00000000 indicating NULL is passed to g_str_hash
This patch handles the crash by adding NULL check before passing it
to g_hash_table_lookup.
|
|
|
|
|
|
| |
Gdbus client for BlueZ was created on plugin initialization, but not
cleaned up on plugin exit. Fixed by adding a g_dbus_client_unref() to
bluetooth_exit().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The technology_set implementation in the bluetooth plugin returns
-EINPROGRESS which causes problems.
1. When setting the Tethering property via D-Bus, D-Bus returns an error
instead of completing successfuly.
2. When using the PersistentTetheringMode option, bluetooth tethering
is not remembered. This is because /var/lib/connman/settings is not
updated if technology_set returns an error.
This fixes the issue by returning 0 when bluetooth_tech_set_tethering
completes successfully.
|
|
|
|
|
|
| |
This fixes a crash that was introduced in commit
6f6927236fc35429eecb1b1459ea5e20ab667db8. It is possible for the role
to be NULL, which caused a crash in strcmp.
|
|
|
|
|
|
|
|
|
| |
This fixes an error in the proxy_get_role fuction in commit
6f6927236fc35429eecb1b1459ea5e20ab667db8.
The comment was correct as to what we want to accomplish here, however the
programming logic did not match what the comment says. Now it correctly
returns the most preferred role instead of just the first matching role.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bluetooth PAN specifies three different roles for different types of
network connections, PANU, NAP and GN. ConnMan currently supports NAP
but ignores the other roles. This patch adds support for the GN and
PANU roles so that we can connect to devices that don't offer NAP.
In the case that a device provides more than one role, we prefer NAP
over GN and GN over PANU. ConnMan will only use the most preferred role
and ignore the others so that we don't have duplicate services in
ConnMan.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Once a Bluetooth adapter changes its Powered property, PAN networks
need to be created or removed. Factor out device and PAN creation
and removal in order to call it when the adapter changes in addition
to the normal device enabling and disabling.
PAN network creation and removal on adapter change needs to be done
explicitely as the Bluetooth adapter has already changed state and
thus the bluetooth plugin will not make a D-Bus call to Bluez nor
will the callback be called where PAN network enabling and disabling
was happening.
Thanks to Krzysztof Wilk for reporting and pointing out the issue
and for the initial quick test of this fix.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When hypernating following can happen:
systemd[1]: Service bluetooth.target is not needed anymore. Stopping.
systemd[1]: Stopping Bluetooth.
systemd[1]: Stopped target Bluetooth.
systemd-sleep[10271]: System resumed.
systemd[1]: Starting Bluetooth.
systemd[1]: Reached target Bluetooth.
ConnMan receives the D-Bus messages that the Network objects are gone
(during the resume phase):
connmand[13571]: plugins/bluetooth.c:object_removed() org.bluez.Network1 /org/bluez/hci0/dev_98_0D_2E_54_B7_50
connmand[13571]: plugins/bluetooth.c:pan_remove_nap() network 0xccfe30 pan 0xccfd50
This sequence sets pan->network to NULL. Then the we get the D-Bus
message that the device have gone too:
connmand[13571]: Aborting (signal 11) [/usr/sbin/connmand]
connmand[13571]: ++++++++ backtrace ++++++++
connmand[13571]: #0 0x3bbec35cb0 in /lib64/libc.so.6
connmand[13571]: #1 0x44b4be in connman_network_get_device() at ome/wagi/src/connman/src/network.c:2052
connmand[13571]: #2 0x4301e3 in device_disable_cb() at ome/wagi/src/connman/plugins/bluetooth.c:554
connmand[13571]: #3 0x4a3709 in set_property_reply() at ome/wagi/src/connman/gdbus/client.c:657
connmand[13571]: #4 0x3bca40cad2 in /lib64/libdbus-1.so.3
connmand[13571]: #5 0x3bca40fdc1 in /lib64/libdbus-1.so.3
connmand[13571]: #6 0x49ce5f in message_dispatch() at ome/wagi/src/connman/gdbus/mainloop.c:72 (discriminator 1)
connmand[13571]: #7 0x3bc0c492a6 in /lib64/libglib-2.0.so.0
connmand[13571]: #8 0x3bc0c49628 in /lib64/libglib-2.0.so.0
connmand[13571]: #9 0x3bc0c49a3a in /lib64/libglib-2.0.so.0
connmand[13571]: #10 0x4435a2 in main() at ome/wagi/src/connman/src/main.c:695
connmand[13571]: #11 0x3bbec21d65 in /lib64/libc.so.6
connmand[13571]: +++++++++++++++++++++++++++
device_disable_cb() blindly passes a NULL pointer to
connman_network_get_device().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Root cause:
When ConnMan tries to enable bluetooth technology, first it will
send RFkill unblock event to kernel, then call dbus method to enable
bluetooth device. When bluez receives the RFkill event, it will power
on the device immediately, and sends PropertyChanged message to
ConnMan.
In ConnMan, the device powered state is updated in device enable dbus
reply callback function, but ConnMan receives PropertyChanged message
before device enable dbus reply. In current ConnMan Bluez 5.x
bluetooth plugin, when handling PropertyChanged message, it finds the
adapter state(enabled) is different with the device state ConnMan
stores(disabled), it will disable the bluetooth device.
Solution:
In ConnMan bluetooth plugin for Bluez 5.x, when ConnMan finds the
adapter state is different with the device state ConnMan stores,
update device state in ConnMan to the adapter state.
|
|
|
|
|
| |
We only disconnect PAN connections when ConnMan stops and leave
other BT connections running.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch generate via coccinelle with:
@ disable is_null,isnt_null1 @
expression E;
@@
(
- E == NULL
+ !E
|
- E != NULL
+ E
)
|
| |
|
|
|
|
| |
Check pointer for null before dereferencing it.
|
|
|
|
|
| |
The coccinelle patch introduces some whitespace violiacense.
Fix up most errors and warnings reported by checkpatch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch is completely generated by set of coccille rules and
containts zero manual changes. The rule set is not really beautiful
but it does the job. We might miss a few conversions but there should
be none accidently wrong converted bool here.
The rules are as following:
//// Do not compare boolean expressions
@@
expression E;
symbol TRUE;
symbol FALSE;
@@
(
E
- == TRUE
|
- TRUE == E
+ E
|
- E != TRUE
+ !E
|
- TRUE != E
+ !E
|
- E == FALSE
+ !E
|
- FALSE == E
+ !E
|
E
- != FALSE
|
- FALSE != E
+ E
)
//// Convert connman_bool_t to stdbool
@@
connman_bool_t x;
@@
x =
(
- TRUE
+ true
|
- FALSE
+ false
)
@@
identifier f;
@@
connman_bool_t f(...) {
<...
- return TRUE;
+ return true;
...>
}
@@
identifier f;
@@
connman_bool_t f(...) {
<...
- return FALSE;
+ return false;
...>
}
@r@
identifier f;
parameter list[n] ps;
identifier i;
@@
f(ps, connman_bool_t i, ...) { ... }
@@
identifier r.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, connman_bool_t i, ...);
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
@@
typedef bool;
@@
- connman_bool_t
+ bool
//// Convert gboolean to stdbool
@@
gboolean x;
@@
x =
(
- TRUE
+ true
|
- FALSE
+ false
)
// Figure out which function signature will to be fixed...
// when we have the defitition
@r@
identifier f;
parameter list[n] ps;
identifier i;
@@
f(ps, gboolean i, ...) { ... }
// ... and now convert all call sites
@@
identifier r.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// Figure out which function signature will to be fixed...
// when we have the declaration only
@r2@
type T;
identifier f;
parameter list[n] ps;
identifier i;
@@
T f(ps, gboolean i, ...);
// ... and now convert all call sites
@@
identifier r2.f;
expression list [r.n] es;
@@
f(es,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
// A handfull of the GLib hooks we can't change. Let's remember
// all ther positions.
// 1. timeouts
@k1@
identifier f;
position p;
typedef gpointer;
identifier ptr;
@@
static gboolean@p f(gpointer ptr);
@k2@
identifier f;
position p;
identifier ptr;
@@
static gboolean@p f(gpointer ptr) { ... }
// hash map iterator functions
@k3@
identifier f;
position p;
identifier p1, p2, p3;
@@
static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... }
// 2. GIOChannel
@k4@
identifier f;
position p;
typedef GIOChannel, GIOCondition;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr);
@k5@
identifier f;
position p;
identifier ptr;
identifier ch, cn;
@@
static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... }
// 3. GSourceFuncs
@k6@
identifier f;
position p;
typedef GSource;
identifier src;
@@
static gboolean@p f(GSource *src, ...) { ... }
// gdbus functions
@k7@
identifier f;
position p;
typedef DBusConnection;
identifier con;
@@
static gboolean@p f(DBusConnection *con, ...) { ... }
// Now convert all gboolean which are are not used for interactin
// with GLib
// Note here happens the magic!
@@
typedef bool;
position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p};
@@
- gboolean@p
+ bool
// Update all return types
@@
identifier f;
@@
bool f(...) {
<...
- return TRUE;
+ return true;
...>
}
@@
identifier f;
@@
bool f(...) {
<...
- return FALSE;
+ return false;
...>
}
//// Last last rule is to fixup all missed call sites. In theory we should
//// fixed them with some rules above but somehow coccinelle does not
//// match.
@@
identifier f =~ "^(__)?connman_.*" ;
@@
f(...,
(
- FALSE
+ false
|
- TRUE
+ true
)
,...)
|
|
|
|
|
|
|
| |
When we start using stdbool, the size of the stdbool does not
match with dbus_bool_t which is important. Therefore fix all
places where we use currently connman_bool_t instead of
dbus_bool_t to access D-Bus layer.
|
| |
|
|
|
|
|
|
| |
Implement connect and disconnect functionality for a ConnMan network.
On network creation check the connection status of the Bluez 5 Network1
object and set the network to connected when needed.
|
|
|
|
|
|
|
|
|
|
| |
Create ConnMan networks for those Bluez 5 org.bluez.Network1/Device1
objects that support PAN NAP. A network is created or removed in response
to the Network1/Device1 being created or when the Device1 object's UUID
changed.
The ConnMan network struct is added to and removed from the ConnMan
device when the device is created, enabled or disabled.
|
|
|
|
|
|
|
| |
Set up functions monitoring Bluez 5 org.bluez.Network1 objects being
added and removed. Add a GDBusProxy for the org.bluez.Device1 object
that corresponds to the Network1 object. Set up functions monitoring
Network1 'Connected' and Device1 'UUID' properties.
|
|
|
|
|
|
|
|
|
|
| |
Set up functions monitoring Bluez 5 objects being added and removed using
GDBusProxy. When an adapter appears, create a new device for it and set up
a watch function for the adapter's 'Powered' property.
Keep the adapter 'Powered' property in sync with the device state and if
they differ reset the adapter to the device state. Also update the Bluez 5
adapter 'Powered' property when the device is enabled or disabled.
|
| |
|
| |
|
|
|
|
|
|
| |
Set the plugin priority to CONNMAN_PLUGIN_PRIORITY_LOW and the technology
priority to -10. Update strings to "bluetooth_legacy" and use ordinary
string instead of ident.
|
|
|
|
|
|
| |
Convert usage of g_slist_append() to g_slist_prepend() where
appropriate. gdbus, dnsproxy, resolver, rtnl, session and session
unit test have ordering requirements and thus not touched.
|
|
|
|
| |
Fixes BMC#25215
|
|
|
|
|
|
|
|
|
|
|
| |
In the case we add a new adapter and the adapter is powered off
we would ignore the reported devices. Later when the adapter was
powered on it would just not add those networks.
Instead silently ignoring the devices, store the D-Bus paths in
a hash table and process them as soon the adapter is powered.
Fixes BMC#25322
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
During the connman_device_register() procedure a lookup to the
bluetooth_devices hash table happens, however the device is not on the
hash at this point and the look out fails.
If the registration fails, technology_disable() returns the Failed
message on D-Bus with the error status zero. That happens because we
don't have any device registered.
This patch moves the insertion of the device to before the device
registration.
|
| |
|
| |
|
|
|
|
|
| |
We have two drivers for the CONNMAN_DEVICE_TYPE_BLUETOOTH and therefore
check owner ship in probe function.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
The bluetooth plugin creates the network object therefore
it should also unref (destroy) it.
|
| |
|
|
|
|
|
|
|
|
| |
Since the service object doesn't take a reference the
intermediate step of having a connman_network_register/unregister
is not needed. This function are only there to have an additional
step where probe()/remove() will be called. This is the job of
connman_device_add_network()/connman_device_remove_network().
|
| |
|
| |
|