1. 15 May, 2019 6 commits
    • Thomas Haller's avatar
      libnm: mark NMVariantAttributeSpec pointers as const · fde9250c
      Thomas Haller authored
      This actually allows the compiler/linker to mark the memory as read-only and any
      modification will cause a segmentation fault.
      
      I would also think that it allows the compiler to put the structure directly
      beside the outer constant array (in which this pointer is embedded). That is good
      locality-wise.
      
      (cherry picked from commit 4e3955e6)
      fde9250c
    • Thomas Haller's avatar
      libnm: cleanup _nm_utils_parse_tc_handle() · b954ddc2
      Thomas Haller authored
      - g_ascii_strtoll() accepts leading spaces, but it leaves
        the end pointer at the first space after the digit. That means,
        we accepted "1: 0" but not "1 :0". We should either consistently
        accept spaces around the digits/colon or reject it.
      
      - g_ascii_strtoll() accepts "\v" as a space (just like `man 3 isspace`
        comments that "\v" is a space in C and POSIX locale.
        For some reasons (unknown to me) g_ascii_isspace() does not treat
        "\v" as space. And neither does NM_ASCII_SPACES and
        nm_str_skip_leading_spaces().
        We should be consistent about what we consider spaces and what not.
        It's already odd to accept '\n' as spaces here, but well, lets do
        it for the sake of consistency (so that it matches with our
        understanding of ASCII spaces, albeit not POSIX's).
      
      - don't use bogus error domains in "g_set_error (error, 1, 0, ..."
        That is a bug and we have NM_UTILS_ERROR exactly for error instances
        with unspecified domain and code.
      
      - as before, accept a trailing ":" with omitted minor number.
      
      - reject all unexpected characters. strtoll() accepts '+' / '-'
        and a "0x" prefix of the numbers (and leading POSIX spaces). Be
        strict here and only accepts NM_ASCII_SPACES, ':', and hexdigits.
        In particular, don't accept the "0x" prefix.
      
      This parsing would be significantly simpler to implement, if we could
      just strdup() the string, split the string at the colon delimiter and
      use _nm_utils_ascii_str_to_int64() which gets leading/trailing spaces
      right. But let's save the "overhead" of an additional alloc.
      
      (cherry picked from commit cc9f0716)
      b954ddc2
    • Thomas Haller's avatar
      libnm/tests: add test for _nm_utils_parse_tc_handle() · 13e3bd41
      Thomas Haller authored
      (cherry picked from commit fac95d00)
      13e3bd41
    • Thomas Haller's avatar
      shared: use nm_str_skip_leading_spaces() in _nm_utils_ascii_str_to_int64() · 84bd35e4
      Thomas Haller authored
      (cherry picked from commit 9d2623cc)
      84bd35e4
    • Lubomir Rintel's avatar
      tc/tfilter: add mirred action · 4be7cf71
      Lubomir Rintel authored
      (cherry picked from commit 90029214)
      4be7cf71
    • Lubomir Rintel's avatar
      tc/qdisc: add support for fq_codel attributes · 67047a44
      Lubomir Rintel authored
      (cherry picked from commit 1efe982e)
      67047a44
  2. 14 May, 2019 1 commit
    • Thomas Haller's avatar
      core: fix file permissions for "/var/lib/NetworkManager/secret_key" · 2d46247c
      Thomas Haller authored
      Ooherwise, the file has wrong permissions:
      
        # ls -la /var/lib/NetworkManager/secret_key
        ----r-xr-x. 1 root root 50 May 14 13:52 /var/lib/NetworkManager/secret_key
      
      Luckily, /var/lib/NetworkManager should be already
      
        # ls -lad /var/lib/NetworkManager
        drwx------. 2 root root 8192 May 14 13:57 /var/lib/NetworkManager
      
      which mitigates this a bit.
      
      Fixes: dbcb1d6d ('core: let nm_utils_secret_key_read() handle failures internally')
      
      #175
      (cherry picked from commit dc3a2f9b)
      2d46247c
  3. 10 May, 2019 2 commits
    • Thomas Haller's avatar
      settings/d-bus: fix boolean return value of "LoadConnections" · e73a5058
      Thomas Haller authored
      The boolean value is intended to indicate success. It would indicated
      failure due to a bug.
      
      Fixes: 297d4985 ('core/dbus: rework D-Bus implementation to use lower layer GDBusConnection API'):
      (cherry picked from commit 22e830f0)
      e73a5058
    • Thomas Haller's avatar
      settings: avoid assertion for LoadConnections D-Bus method with relative paths · c21171e0
      Thomas Haller authored
        $ busctl call org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/Settings org.freedesktop.NetworkManager.Settings LoadConnections as 1 relative/filename
      
      triggers a g_critical() assertion in nm_utils_file_is_in_path():
      
        ...
        #3  0x00007ffff7a19e7d in g_return_if_fail_warning
            (log_domain=log_domain@entry=0x55555586c333 "NetworkManager", pretty_function=pretty_function@entry=0x55555586c0a0 <__FUNCTION__.38585> "nm_utils_file_is_in_path", expression=expression@entry=0x55555586c010 "abs_filename && abs_filename[0] == '/'") at ../glib/gmessages.c:2767
        #4  0x00005555555f1128 in nm_utils_file_is_in_path (abs_filename=abs_filename@entry=0x555555b56670 "dfd", abs_path=<optimized out>) at src/NetworkManagerUtils.c:1077
        #5  0x00005555555a4779 in load_connection (config=<optimized out>, filename=0x555555b56670 "dfd") at src/settings/plugins/keyfile/nms-keyfile-plugin.c:522
        #6  0x00005555557ce291 in nm_settings_plugin_load_connection (self=0x5555559fd400 [NMSKeyfilePlugin], filename=0x555555b56670 "dfd") at src/settings/nm-settings-plugin.c:70
        #7  0x000055555559ccdf in impl_settings_load_connections
            (obj=<optimized out>, interface_info=<optimized out>, method_info=<optimized out>, connection=<optimized out>, sender=<optimized out>, invocation=0x7fffe0015ed0 [GDBusMethodInvocation], parameters=<optimized out>) at src/settings/nm-settings.c:1439
        #8  0x00005555555a9bf9 in dbus_vtable_method_call
            (connection=0x5555559b91b0 [GDBusConnection], sender=sender@entry=0x555555b5c360 ":1.32283", object_path=object_path@entry=0x7fffe0019070 "/org/freedesktop/NetworkManager/Settings", interface_name=<optimized out>, interface_name@entry=0x7fffe002aa70 "org.freedesktop.NetworkManager.Settings", method_name=<optimized out>,
            method_name@entry=0x7fffe00276b0 "LoadConnections", parameters=parameters@entry=0x555555c4a690, invocation=0x7fffe0015ed0 [GDBusMethodInvocation], user_data=0x5555559a1a00)
            at src/nm-dbus-manager.c:947
        #9  0x00007ffff7c506c4 in call_in_idle_cb (user_data=user_data@entry=0x7fffe0015ed0) at ../gio/gdbusconnection.c:4874
        #10 0x00007ffff7a0e8eb in g_idle_dispatch (source=source@entry=0x7fffe00208a0, callback=0x7ffff7c50590 <call_in_idle_cb>, user_data=0x7fffe0015ed0) at ../glib/gmain.c:5627
        #11 0x00007ffff7a11fd0 in g_main_dispatch (context=0x555555994d00) at ../glib/gmain.c:3189
        #12 0x00007ffff7a11fd0 in g_main_context_dispatch (context=context@entry=0x555555994d00) at ../glib/gmain.c:3854
        #13 0x00007ffff7a12368 in g_main_context_iterate (context=0x555555994d00, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:3927
        #14 0x00007ffff7a126b3 in g_main_loop_run (loop=0x555555995e60) at ../glib/gmain.c:4123
        #15 0x000055555558a741 in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:444
      
      Filter out relative filenames early.
      
      (cherry picked from commit a1b102ea)
      c21171e0
  4. 08 May, 2019 4 commits
  5. 07 May, 2019 3 commits
  6. 06 May, 2019 9 commits
  7. 03 May, 2019 2 commits
    • Thomas Haller's avatar
      device/wireguard: fix memleak for NMDeviceWireGuard · 5a1818b6
      Thomas Haller authored
      Fixes: 2148d094 ('core/wireguard: add support for WireGuard peers')
      (cherry picked from commit 56d748eb)
      5a1818b6
    • Thomas Haller's avatar
      platform/tests: workaround routing-rules test failure due to suppress_prefixlen on older kernels · cc438c2a
      Thomas Haller authored
      On Ubuntu 14.04 kernel (4.4.0-146-generic, x86_64) this easily causes
      test failures:
      
          make -j 8 src/platform/tests/test-route-linux \
          && while true; do \
              NMTST_SEED_RANDOM= ./tools/run-nm-test.sh src/platform/tests/test-route-linux -p /route/rule \
              || break; \
          done
      
      outputs:
      
          ...
          /route/rule/1:
          nmtst: initialize nmtst_get_rand() with NMTST_SEED_RAND=22892021
          OK
          /route/rule/2: >>> failing...
          >>> no fuzzy match between: [routing-rule,0x205ab30,1,+alive,+visible; [6] 0: from all suppress_prefixlen 8 none]
          >>>                    and: [routing-rule,0x205c0c0,1,+alive,+visible; [6] 0: from all suppress_prefixlen -1579099242 none]
          **
          test:ERROR:src/platform/tests/test-route.c:1695:test_rule: code should not be reached
      
      (cherry picked from commit d5a2b709)
      cc438c2a
  8. 23 Apr, 2019 2 commits
    • Thomas Haller's avatar
      tools: fix out-of-tree build test "tools/check-docs.sh" for duplicate generated sources · 19cb8f91
      Thomas Haller authored
      When we do an in-tree-build with autotools and an out-of-tree build
      with meson (all in the same source directory), then we have the
      following files:
      
        libnm-core/nm-core-enum-types.h
        libnm/nm-enum-types.h
        build/libnm-core/nm-core-enum-types.h
        build/libnm/nm-enum-types.h
      
      This caused "tools/check-docs.sh" for `ninja -C build test` to fail,
      because the files are detected twice:
      
          --- command ---
          /data/src/NetworkManager/tools/check-docs.sh /data/src/NetworkManager /data/src/NetworkManager/build
          --- stderr ---
          8a9
          > nm-core-enum-types
          38a40
          > nm-enum-types
          *** Error: libnm classes not included in docs/libnm/libnm-docs.xml ***
          -------
      
      (cherry picked from commit 17adf58d)
      19cb8f91
    • Thomas Haller's avatar
      tools: cleanup path variable in "tools/check-docs.sh" · f81cefde
      Thomas Haller authored
      - don't append the path separator to the SOURCEDIR variable.
        Instead, use the path separator when we need it.
      
      (cherry picked from commit a9b4362f)
      f81cefde
  9. 21 Apr, 2019 4 commits
  10. 20 Apr, 2019 5 commits
  11. 19 Apr, 2019 2 commits