Hi,
v2 changes:
- swapped the null check in patch #01
- added two more patches after noticing crashes when testing patch #08
The crashes happened when I was connected via ethernet and the
IPv6 method was set to OFF. Then I removed ethernet cable and
immediately set the IPv6 method to AUTO. This cable un-plugging
caused the service->network to be become NULL and method setting
to AUTO was trying to access NULL pointer. So it seems that there
is a race somewhere, unfortunately the patches #13 and #14 do not
fix the race, they just prevent the crash in these cases.
- when reviewing the #08, I noticed service state errors when
combining IPv4 and IPv6 states. This is now fixed in patch #08 and #09
so here are patches that are needed by L2TP/PPTP patches that I will
be updating and sending soonish. The patches are not related to
L2TP/PPTP but are generic fixes. They mainly fix bugs and also
implement authentication failure notification to the user (via agent
API). The auth failure notification works with every VPN driver after
these fixes.
01 - provider driver name null check
02 - Set the authentication failure error code so that we can catch
VPN authentication errors.
03 - Return ipconfig state to caller. Needed by patch #04
04 - Do not change the service disconnect state unless we were really
disconnecting the service. This means that if the service is in
idle / failure state, we do not mark the ipconfig state as
disconnected. This is useful in VPN case so that we do not lose
the failure state when combining the states.
05 - Set the user connect flag for VPN services. This is needed so
that if there is an authentication error, the agent API will be
called and the user will know about the auth failure.
06 - Fix the function name as it is now static
07 - Fix the debug print location, currently it is not very useful
08 - Fix service state combining. The patch fixes the case when
IPv4 is ONLINE/READY and IPv6 is DISCONNECTED. In this case
we should be ONLINE/READY instead of DISCONNECT.
09 - If the ipconfig method is OFF, then we set the corresponding
service state to IDLE. This is done so that only the active
ipconfig affects the service state combining.
10 - Add reference counting debugging for provider
11 - If the user tries to connect to existing VPN service, then
return the already existing service. It does not make sense
to disconnect the older service and then reconnect.
12 - Service was not properly ref counted in connection.c
This problem was clearly seen when using VPN service and valgrind.
13 - NULL check. The problem can be triggered by setting IPv6 method
of eth0 to OFF, then un-plugging ethernet cable and at the same
time setting IPv6 method to AUTO
14 - NULL check. Same issue as in #13
BTW, there is an easy way to test the service state machine:
1. setup radvd in the network so that connman will receive router
advertisements
2. run following commands
$ set-ipv6-method service auto
$ set-ipv4-method service dhcp
$ get-state should return online
$ set-ipv6-method service off
$ get-state should return online
$ set-ipv4-method service off
$ get-state should return offline
$ set-ipv6-method service auto
$ get-state should return online
$ set-ipv4-method service dhcp
$ get-state should return online
I noticed that when IPv4 method is set from OFF to DHCP, the device
(in this case it was netbook with meego 1.2+) will not fetch ip
address automagically when connected via ethernet.
One needs to reconnect ethernet cable to start the dhcp. I had no
time to investigate this.
Regards,
Jukka
Jukka Rissanen (14):
provider: NULL pointer check.
vpn: Set authentication failure error code properly in provider.
service: Add function to get the ipconfig state.
network: Change the service disconnect state when necessary.
service: Set the user connect status correctly for VPN.
service: Fix function name as it is static.
service: Change the debug print location to be more useful.
service: Fix state combining.
service: Set the service state to IDLE if method is off or unknown.
provider: Add ref counting debug.
provider: Return existing service path if already connected.
connection: Service was not ref counted properly.
network: Add NULL check.
service: Add NULL check.
plugins/vpn.c | 5 ++
plugins/vpn.h | 1 +
src/connection.c | 6 ++-
src/connman.h | 3 +
src/network.c | 21 +++++++++-
src/provider.c | 16 +++++---
src/service.c | 120 ++++++++++++++++++++++++++++++------------------------
7 files changed, 109 insertions(+), 63 deletions(-)
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman