1. 21 May, 2019 7 commits
  2. 18 Apr, 2019 16 commits
    • Thomas Haller's avatar
      build/meson: rename "nm_core_dep" to "libnm_core_dep" · e7836cd1
      Thomas Haller authored
      The library is called "libnm_core". So the dependency should be called
      "libnm_core_dep", like in all other cases.
      
      (cherry picked from commit c27ad37c)
      e7836cd1
    • Thomas Haller's avatar
      shared: build helper "libnm-libnm-core-{intern|aux}.la" library for libnm-core · 284ac92e
      Thomas Haller authored
      "libnm-core" implements common functionality for "NetworkManager" and
      "libnm".
      
      Note that clients like "nmcli" cannot access the internal API provided
      by "libnm-core". So, if nmcli wants to do something that is also done by
      "libnm-core", , "libnm", or "NetworkManager", the code would have to be
      duplicated.
      
      Instead, such code can be in "libnm-libnm-core-{intern|aux}.la".
      Note that:
      
        0) "libnm-libnm-core-intern.la" is used by libnm-core itsself.
           On the other hand, "libnm-libnm-core-aux.la" is not used by
           libnm-core, but provides utilities on top of it.
      
        1) they both extend "libnm-core" with utlities that are not public
           API of libnm itself. Maybe part of the code should one day become
           public API of libnm. On the other hand, this is code for which
           we may not want to commit to a stable interface or which we
           don't want to provide as part of the API.
      
        2) "libnm-libnm-core-intern.la" is statically linked by "libnm-core"
           and thus directly available to "libnm" and "NetworkManager".
           On the other hand, "libnm-libnm-core-aux.la" may be used by "libnm"
           and "NetworkManager".
           Both libraries may be statically linked by libnm clients (like
           nmcli).
      
        3) it must only use glib, libnm-glib-aux.la, and the public API
           of libnm-core.
           This is important: it must not use "libnm-core/nm-core-internal.h"
           nor "libnm-core/nm-utils-private.h" so the static library is usable
           by nmcli which couldn't access these.
      
      Note that "shared/nm-meta-setting.c" is an entirely different case,
      because it behaves differently depending on whether linking against
      "libnm-core" or the client programs. As such, this file must be compiled
      twice.
      
      (cherry picked from commit af07ed01)
      284ac92e
    • Thomas Haller's avatar
      shared: move most of "shared/nm-utils" to "shared/nm-glib-aux" · d984b2ce
      Thomas Haller authored
      From the files under "shared/nm-utils" we build an internal library
      that provides glib-based helper utilities.
      
      Move the files of that basic library to a new subdirectory
      "shared/nm-glib-aux" and rename the helper library "libnm-core-base.la"
      to "libnm-glib-aux.la".
      
      Reasons:
      
       - the name "utils" is overused in our code-base. Everything's an
         "utils". Give this thing a more distinct name.
      
       - there were additional files under "shared/nm-utils", which are not
         part of this internal library "libnm-utils-base.la". All the files
         that are part of this library should be together in the same
         directory, but files that are not, should not be there.
      
       - the new name should better convey what this library is and what is isn't:
         it's a set of utilities and helper functions that extend glib with
         funcitonality that we commonly need.
      
      There are still some files left under "shared/nm-utils". They have less
      a unifying propose to be in their own directory, so I leave them there
      for now. But at least they are separate from "shared/nm-glib-aux",
      which has a very clear purpose.
      
      (cherry picked from commit 80db06f7)
      d984b2ce
    • Thomas Haller's avatar
      cli: use "escaped-tokens" style for splitting "vlan.xgress-priority-map" list · 5b2d0f0f
      Thomas Haller authored
      There should be little difference here, because the priority list is
      (and was) never serialized with special characters like backslashes or
      delimiters that require escaping.
      
      Likewise, no working code actually tried to set such characters.
      
      Still, drop the plain VALUE_STRSPLIT_MODE_STRIPPED and use
      VALUE_STRSPLIT_MODE_ESCAPED_TOKENS_WITH_SPACES instead. We should have
      a small set of modes that we use for splitting strings.
      
      (cherry picked from commit 7f01da91)
      5b2d0f0f
    • Thomas Haller's avatar
      cli: cleanup _get_fcn_vlan_xgress_priority_map() · f6237b3f
      Thomas Haller authored
      - merge the pointless helper function vlan_priorities_to_string()
        into the only caller _get_fcn_vlan_xgress_priority_map().
      
      - minor cleanups, like setting out-is-default if num==0, not
        based on whether we have a non-empty string. There is not difference
        in practice, because nm_setting_vlan_get_priority() never fails.
        Hence they are identical. But nm_setting_vlan_get_priority() has
        an API that allows it to fail, so we should declare the default
        depending on the number of vlan priorities.
      
      - don't allocate the temporary GString instance if we won't need it.
      
      - only append the delimiter if needed, and not truncate it afterwards.
        It might have even worse performance this way, but it feels more
        correct to me.
      
      - also cache the result of nm_setting_vlan_get_num_priorities().
        NMSettingVlan's implementation is horrible and uses a GSList to
        track the list of priorities. This makes it relatively expensive
        to call get-num-priorities repeatedly (and pointless).
      
      (cherry picked from commit bbfd3668)
      f6237b3f
    • Thomas Haller's avatar
      cli: unify set of characters to tokenize list properties · 0e54f55c
      Thomas Haller authored
      the only change in behaviour is for VALUE_STRSPLIT_MODE_MULTILIST.
      Previously, we would split at " \t,", now we will also split at
      the white space characters "\n\r\f".
      
      (cherry picked from commit 7a92fb6b)
      0e54f55c
    • Thomas Haller's avatar
      cli: refactor multilist property handling of "match.interface-names" · f6d73aff
      Thomas Haller authored
      We had %VALUE_STRSPLIT_MODE_MULTILIST_WITH_ESCAPE, which was used
      by "match.interface-names". This uses nm_utils_strsplit_set_full()
      with %NM_UTILS_STRSPLIT_SET_FLAGS_ALLOW_ESCAPING and
      _nm_utils_unescape_plain().
      
      We want eventually to use nm_utils_escaped_tokens_split() everywhere.
      
      We already have %VALUE_STRSPLIT_MODE_ESCAPED_TOKENS, which splits the
      list at ',' (and strips whitespaces at the around the delimiter). That
      differs from what %VALUE_STRSPLIT_MODE_MULTILIST_WITH_ESCAPE did, which
      also considered whitespace a delimiter.
      
      So, we need a new mode %VALUE_STRSPLIT_MODE_ESCAPED_TOKENS_WITH_SPACES
      which replaces the previous mode.
      
      Note that the previous implementation did almost the same thing. In
      fact, I cannot imagine examples where they behaved differently, but
      my feeling is that there might be some edge cases where this changes
      behavior.
      
      (cherry picked from commit 6093f493)
      f6d73aff
    • Thomas Haller's avatar
      cli: return early when splitting with %VALUE_STRSPLIT_MODE_STRIPPED · 53b3e3d7
      Thomas Haller authored
      The reminder of the function only does (something akin to) g_strstrip().
      As we split the strings are spaces to begin with, there is nothing to
      strip and we can return right away.
      
      (cherry picked from commit b74d9a0b)
      53b3e3d7
    • Thomas Haller's avatar
      cli: drop unused strsplit_with_escape mode for objlist properties · 55a46f91
      Thomas Haller authored
      (cherry picked from commit 3f5df5ab)
      55a46f91
    • Thomas Haller's avatar
      cli: assert for proper escaping when creating objlist string · f4a7c2eb
      Thomas Haller authored
      (cherry picked from commit 84bd1d38)
      f4a7c2eb
    • Thomas Haller's avatar
      cli: default splitting list properties with escaped-tokens style · 872025d2
      Thomas Haller authored
      When splitting (and concatenating) list-typed properties,
      we really should use nm_utils_escaped_tokens_split()
      and nm_utils_escaped_tokens_escape*().
      
      Make that the default, and mark all properties to opt-in to the
      legacy behavior.
      
      (cherry picked from commit 5a715920)
      872025d2
    • Thomas Haller's avatar
      cli: fix splitting of multilist property in setter · 4eaff61f
      Thomas Haller authored
      The modes VALUE_STRSPLIT_MODE_OBJLIST* and VALUE_STRSPLIT_MODE_MULTILIST* are
      different. We must use the right mode.
      
      For example, _get_fcn_match_interface_name() concatenates the interface-names
      with space. So, the tokenizer of the setter must also use space as delimiter.
      VALUE_STRSPLIT_MODE_MULTILIST_WITH_ESCAPE does that correctly,
      VALUE_STRSPLIT_MODE_OBJLIST_WITH_ESCAPE does not.
      
      (cherry picked from commit 758bf326)
      4eaff61f
    • Thomas Haller's avatar
      cli: fix handling empty match.interface-name property · c26a4214
      Thomas Haller authored
      (cherry picked from commit 6bef7236)
      c26a4214
    • Beniamino Galvani's avatar
      all: use escaped_tokens API for bridge vlans · 6ac953e9
      Beniamino Galvani authored
      (cherry picked from commit 9f23c5e2)
      6ac953e9
    • Beniamino Galvani's avatar
      all: support bridge vlan ranges · da204257
      Beniamino Galvani authored
      In some cases it is convenient to specify ranges of bridge vlans, as
      already supported by iproute2 and natively by kernel. With this commit
      it becomes possible to add a range in this way:
      
       nmcli connection modify eth0-slave +bridge-port.vlans "100-200 untagged"
      
      vlan ranges can't be PVIDs because only one PVID vlan can exist.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1652910
      (cherry picked from commit 70935157)
      da204257
    • Beniamino Galvani's avatar
      clients: fix typos · ea8ed6ce
      Beniamino Galvani authored
      (cherry picked from commit ea16cf59)
      ea8ed6ce
  3. 17 Apr, 2019 3 commits
    • Thomas Haller's avatar
      cli: use nm_utils_escaped_tokens_*() for handling policy routes · b583f3a4
      Thomas Haller authored
      Optimally, all list types properties in nmcli support proper escaping.
      For that, we should use nm_utils_escaped_tokens_*() API.
      
      For now, just change that for policy routes. They were just added recently,
      so no change in behavior of released API.
      
      (cherry picked from commit d59f046b)
      b583f3a4
    • Thomas Haller's avatar
      cli: add new style for tokenizing/concatenating list options in nmcli · 0deb3024
      Thomas Haller authored
      nmcli supports list options (optlist and multilist properties).
      These commonly are individual items, concatenated by a delimiter.
      
      It should be generally possibly to express every value. That means, we
      need some for of escaping mechanism for delimiters.
      
      Currently this is all inconsistent or no escaping is supported. I intend
      to fix that (which will be a change in behavior).
      
      For now, just add yet another style of tokenzing/concatenating list
      items in nmcli. This is the style to replace all other styles.
      
      (cherry picked from commit ba956bd4)
      0deb3024
    • Thomas Haller's avatar
      cli: avoid duplicate delimiters when printing objlist property · 53ab539d
      Thomas Haller authored
      Usually, obj_to_str_fcn() should not fail and always add something.
      If not, remove the delimiter again.
      
      (cherry picked from commit 720bc30b)
      53ab539d
  4. 16 Apr, 2019 1 commit
  5. 12 Apr, 2019 3 commits
  6. 11 Apr, 2019 1 commit
  7. 10 Apr, 2019 5 commits
  8. 05 Apr, 2019 1 commit
  9. 04 Apr, 2019 1 commit
  10. 03 Apr, 2019 2 commits