1. 03 Sep, 2018 2 commits
    • Jussi Laakkonen's avatar
      connection: Check for active flag when updating default gateway · 45b5defc
      Jussi Laakkonen authored
      Set default gateway if it has been updated or if it has not been set as
      active yet.
      The check for active interface is required in cases that are induced by
      a race condition caused by a change of interfaces that are either too
      fast or too slow to go down, or to get up. In such case the interface
      that should be used as default gateway may end up with no default route
      set in routing table.
      This is because the change happens in a situation where the old default
      service A going down is still online, when the new service B that is
      becoming the new default, is still in ready state. The new default
      service B is not detected as default gateway because of the service list
      order. The new service B has been added to gateway_hash and the routes
      other than the default route have been set into routing table.
      After this the routes of the old default service A are removed but
      because of the old default service A still being the default service
      according to service list, the removal of routes of the old default
      service A does not get the new default gateway B to be selected as the
      default gateway. After this the old default service A is properly
      disconnected and set to idle setting the new default service B as the
      default service.
      The next call to this update gateway function results in a situation where
      updated flag is not set, hence new default service B is the only one in
      the gateway_hash. By checking also the active flag of the gateway the
      new default gateway B in the scenario above will have a default route
      set also in routing table.
      [connman] Check active flag when updating gateway. Contributes to JB#42017
    • Jussi Laakkonen's avatar
      connection: Set and unset active flag when changing default gateway · 6c365d45
      Jussi Laakkonen authored
      The active flag for gateway should be set also when it is set or unset
      as default gateway as it is done with VPN gateways. The active flag is
      used in finding the active gateway (find_active_gateway(), choosing the
      default gateway (choose_default_gateway()), updating the default gateway
      (__connman_connection_update_gateway()) and to delete routes
      The active flag is set/unset when adding or removing the gateway but not
      touched when updating the interface using set_default_gateway() and
      unset_default_gateway(). This adds setting of the flag in both of the
      uses of the set/unset default gateway and unset_default_gateway(). This
      adds setting of the flag in both of the uses of the set/unset default
      [connman] Set/unset active flag if changing gw. Contributes to JB#42017
  2. 30 Aug, 2018 1 commit
  3. 29 Aug, 2018 2 commits
    • Slava Monich's avatar
      service: Remove __connman_service_get_order() · b3cc1a6f
      Slava Monich authored
      It doesn't do anything that's not done by set_split_routing()
      and its return value was never used.
    • Slava Monich's avatar
      service: Initialize order for VPN services · adc3b6a8
      Slava Monich authored
      If the default value of do_split_routing is 0 (false) then
      according to set_split_routing() the default order for VPN
      services should be 10. If the whole structure is zeroed on
      initialization, do_split_routing and order for VPN services
      were left in inconsistent state.
  4. 26 Aug, 2018 1 commit
  5. 24 Aug, 2018 3 commits
    • Slava Monich's avatar
      [unit] Removed test-dnsproxy · 9f41ede0
      Slava Monich authored
      It didn't really test anything. Line, function and branch coverage
      for dnsproxy.c was 3.9%, 7.3% and 2.4%, respectively. That's pretty
    • Patrik Flykt's avatar
      dnsproxy: Be more strict with incoming DNS requests · 217a5822
      Patrik Flykt authored
      Be more strict with incoming DNS requests. Verify that there is
      only one entry in the question section and none in the answer or
      name server sections.
      Ensure that the question section has a proper IN class and
      compute the remaing length and the pointer position with respect
      to the end of the question section. If there is an EDNS0 extension,
      log its length.
      [connman] cherry-picks from upstream for dnsproxy
    • Patrik Flykt's avatar
      dnsproxy: Send a short response on error · a0c44002
      Patrik Flykt authored
      On error there is no need to send the whole packet back to the
      client, only the basic headers informing of the error. Also check
      the length of the buffer, including protocol offsets.
  6. 23 Aug, 2018 1 commit
  7. 22 Aug, 2018 3 commits
    • Slava Monich's avatar
    • Slava Monich's avatar
      inet: Invoke rtnl callback on errors too · a36dd896
      Slava Monich authored
      Not invoking the callback results in memory leaks like this one:
      ==6817== 30 (8 direct, 22 indirect) bytes in 1 blocks are definitely lost in loss record 1,600 of 3,200
      ==6817==    at 0x483F3EC: malloc (vg_replace_malloc.c)
      ==6817==    by 0x8DC1B: __connman_inet_get_route (inet.c)
      ==6817==    by 0x5E2E7: set_vpn_routes (connection.c)
      ==6817==    by 0x5FD77: __connman_connection_gateway_add (connection.c)
      ==6817==    by 0x837F7: __connman_ipconfig_gateway_add (ipconfig.c)
      ==6817==    by 0x7DFA7: set_connected (provider.c)
      ==6817==    by 0x7E0CB: connman_provider_set_state (provider.c)
      ==6817==    by 0x499C3: set_provider_state (vpn.c)
      ==6817==    by 0x4D95F: property_changed (vpn.c)
      ==6817==    by 0xD7D4B: signal_filter (watch.c)
      ==6817==    by 0xD8323: message_filter (watch.c)
      ==6817==    by 0x4A1E02F: dbus_connection_dispatch (dbus-connection.c)
    • Slava Monich's avatar
      vpn: Free if_name before assigning new value · e5cbd02c
      Slava Monich authored
      Fixes a memory leak:
      ==10939== 20 bytes in 4 blocks are definitely lost in loss record 199 of 429
      ==10939==    at 0x483F3EC: malloc (vg_replace_malloc.c)
      ==10939==    by 0x4C7E35F: g_malloc (gmem.c)
      ==10939==    by 0x4C962BD: g_strdup (gstrfuncs.c)
      ==10939==    by 0x1945B: vpn_create_tun (vpn.c)
      ==10939==    by 0x19C83: vpn_connect (vpn.c)
      ==10939==    by 0x292DF: __vpn_provider_connect (vpn-provider.c)
      ==10939==    by 0x27797: do_connect (vpn-provider.c)
      ==10939==    by 0x46853: process_message (object.c)
      ==10939==    by 0x486AB: generic_message (object.c)
      ==10939==    by 0x49BDFE1: _dbus_object_tree_dispatch_and_unlock (dbus-object-tree.c)
      ==10939==    by 0x49B4071: dbus_connection_dispatch (dbus-connection.c)
      ==10939==    by 0x43A8B: message_dispatch (mainloop.c)
  8. 20 Aug, 2018 1 commit
  9. 17 Aug, 2018 1 commit
  10. 16 Aug, 2018 6 commits
  11. 14 Aug, 2018 5 commits
    • Jussi Laakkonen's avatar
      [connman-vpn] Set autoconnect off if dialog canceled. Fixes JB#42666 · 231dbcac
      Jussi Laakkonen authored
      This fix disables autoconnect for VPN if login dialog is canceled.
      Canceling VPN login dialog calls vpn-provider.c
      vpn_provider_indicate_error() which in case of error sets the state of
      VPN as failed. With this fix autoconnecting of the canceled VPN is
      stopped in case login fails.
    • Jussi Laakkonen's avatar
      Merge branch 'jb42601' into 'master' · 18a70d5f
      Jussi Laakkonen authored
      Treat NULL and any address gateways the same.
      See merge request mer-core/connman!128
    • Slava Monich's avatar
      dhcp: Prefer to reuse broadcast flag from DHCPDISCOVER · d78d66eb
      Slava Monich authored
      Some (broken?) DHCP servers are picky about the BROADCAST flag.
      They may respond with an IP broadcast, but ignore requests with
      the BROADCAST flag set. IP unicast received from the server, on
      the other hand, should guarantee that the server is ok with the
      BROADCAST bit cleared.
      [connman] Prefer to reuse DHCP broadcast flag from DHCPDISCOVER. Fixes JB#42576
    • Jussi Laakkonen's avatar
      inet: Treat NULL and any address gateways as the same · d5781c91
      Jussi Laakkonen authored
      This fixes an issue of treating an any address (IPv4 or IPv6) as gateway
      address when adding routes, which causes RTF_GATEWAY flag being set and
      adding of such route to fail. RTF_GATEWAY should be set only when the
      address is an real IP address.
      In addition, when adding a IPv6 route the return value of inet_pton() is
      utilized in order to check for the address validity before enabling
      RTF_GATEWAY flag.
      Added a helper function (__connman_inet_is_any_addr()) to check if an
      IPv4 or IPv6 address is an any address. For convenience and future use
      function prototype is added to src/connman.h.
    • Jussi Laakkonen's avatar
      [connman] Accommodate inet.c upstream changes. Fixes JB#42601 · d93e221f
      Jussi Laakkonen authored
      Accommodate changes to upstream that were made in commit
      id=572c2033e304fd89ff705d2c2823bd8f594e6dbc for inet.c route address
      Removed __connman_ipaddress_is_any_addr() from inet.c and changed to use
      __connman_inet_is_any_addr() elsewhere.
      Revert change in inet.c:connman_inet_add_ipv6_network_route() gateway
      check to follow upstream before the commit.
  12. 09 Aug, 2018 2 commits
  13. 27 Jul, 2018 2 commits
    • Alexander Kochetkov's avatar
      ntp: clear ADJ_MAXERROR to keep STA_UNSYNC cleared after jump adjust · f5c530fa
      Alexander Kochetkov authored
      NTP use jump adjust if system has incorrect time read from RTC during boot.
      It is desireble to update RTC time as soon as NTP set correct system time.
      Sometimes kernel failed to update RTC due to STA_UNSYNC get set before RTC
      update finised. In that case RTC time wouldn't be updated within long time.
      The commit makes RTC updates stable.
      When NTP do jump time adjust using ADJ_SETOFFSET it clears STA_UNSYNC flag.
      If don't clear ADJ_MAXERROR, STA_UNSYNC will be set again by kernel within
      1 second (by second_overflow() function). STA_UNSYNC flag prevent RTC updates
      in kernel. Sometimes the kernel is able to update RTC withing 1 second,
      but sometimes it falied.
    • Peter Meerwald-Stadler's avatar
      ntp: Fix unused value · 639f2de5
      Peter Meerwald-Stadler authored
      msg.poll is assigned twice, the first assignment should probably be
      a comment. RFC5905 specifies MINPOLL 6 and MAXPOLL 17.
      CID 1352485
  14. 12 Jul, 2018 1 commit
  15. 11 Jul, 2018 1 commit
  16. 09 Jul, 2018 1 commit
  17. 06 Jul, 2018 1 commit
  18. 29 Jun, 2018 3 commits
  19. 17 Jun, 2018 2 commits
    • Slava Monich's avatar
      [wifi] Don't immediately trigger the scan after display is on. JB#41295 · 1208740c
      Slava Monich authored
      Lots of things are happening right after screen unlocks,
      including UI animation and such. Let's postpone scanning a bit.
    • Slava Monich's avatar
      [wifi] Don't remove wifi networks too quickly. JB#41295 · 8893d5d2
      Slava Monich authored
      If wifi network is missing from the scan, give it a few more chances
      to reappear and only when the number of recover attempts exceeds the
      limit, notify connman core that the network is gone.
      The recovery logic that was there before never really worked. This
      one sometimes actually helps to avoid generating unnecessary D-Bus
      traffic (i.e. removing and then adding back the same network).
  20. 13 Jun, 2018 1 commit
    • Jian Liang's avatar
      gweb: Fix a crash using wispr over TLS · 87a3ecf0
      Jian Liang authored
      When gnutls_channel is instantiated, the gnutls_channel->established
      has to be initiated as FALSE. Otherwise, check_handshake function
      won't work. A random initial value 1 of gnutls_channel->established
      will make check_handshake return G_IO_STATUS_NORMAL, when the channel
      is actually not ready to be used. The observed behaviours are,
      - wispr is getting random errors in wispr_portal_web_result
      - ConnMan crashes on exit after those random errors
      - when wispr is luckly working, ConnMan doesn't crash on exit