1. 19 Dec, 2018 16 commits
    • Thomas Haller's avatar
      all: don't use static buffer for nm_utils_inet*_ntop() · a51c09dc
      Thomas Haller authored
      While nm_utils_inet*_ntop() accepts a %NULL buffer to fallback
      to a static buffer, don't do that.
      I find the possibility of using a static buffer here error prone
      and something that should be avoided. There is of course the downside,
      that in some cases it requires an additional line of code to allocate
      the buffer on the stack as auto-variable.
    • Thomas Haller's avatar
      libnm: add internal API nm_utils_inet*_ntop_dup() · 898f7a56
      Thomas Haller authored
      In quite some cases we need the string representation on the heap.
      While nm_utils_inet*_ntop() accepts NULL as output buffer to fallback
      to a static buffer, such usage of a static buffer is discouraged.
      So, we actually should always allocate a temporaray buffer on the
      stack. But that is cumbersome to write.
      Add simple wrappers that makes calling this more convenient.
    • Thomas Haller's avatar
      shared/tests: add helper functions to convert IP address to string · 1e4c0dd6
      Thomas Haller authored
      We have nm_utils_inet*_ntop(), however:
       - that is partly private API libnm-core, and thus only available in
         components that have access to that. Partly it's public API of
         libnm, but still only available in components that use libnm.
       - relying on the static buffers is discouraged for nm_utils_inet*_ntop().
         For testing, that is fine as we are in a more controlled envionment.
         So, add a test variant that explicitly relies on static buffers.
         That way, it's more convenient to use from tests.
       - these functions can assert more and are more convenient to use from
    • Thomas Haller's avatar
      core: implement nm_utils_ip4_netmask_to_prefix() via __builtin_ctz() · e442e388
      Thomas Haller authored
      Taken from systemd's in4_addr_netmask_to_prefixlen().
      Yes, this adds the requirement that "int" is 32 bits. But systemd
      already has the same requirement in u32ctz(), hence we anyway cannot
      build on other architectures. If that is ever necessary, it's easy
      to adjust.
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      device: drop rp_filter handling · a936086d
      Thomas Haller authored
      After commit b1082aa9 (device: disable
      rp_filter handling) drop the now unused code.
    • Thomas Haller's avatar
      device: add sysctl-ip-conf getter and use it · 8bf6ae1b
      Thomas Haller authored
      - add nm_device_sysctl_ip_conf_get() and nm_device_sysctl_ip_conf_get_int_checked().
        These functions don't use nm_device_get_ip_iface(), but resolve the
        ifname from the platform cache.
      - in general, resolve the name first with nm_device_get_ip_iface_from_platform().
    • Thomas Haller's avatar
      device: add nm_device_get_ip_iface_from_platform() · f9077fa7
      Thomas Haller authored
      We have a cached nm_device_get_ip_iface() property. However, the interface
      name is not an identifier for a link because it can change at any time.
      Also, we already have the (ip) ifindex as proper identifier for the
      platform link. We shouldn't use two redundant identifiers to refer to
      a link.
      Clearly, sometimes we need an ifname. For example for ethtool ioctl or
      sysctl path names. For ethtool API, we resolve the actual name as late
      as possible, and for sysctl API we prefer NMP_SYSCTL_PATHID_NETDIR*().
      However, that is not always possible, for example for /proc/sys/net/ipv6/conf/
      Add a function that resolves the ifname by looking into the cache. This
      of course is still racy, but it minimizes the time.
      Also, we should less and less rely on the ifname, and resolve it as late
      as possible. This patch adds a small wrapper going into that direction.
    • Thomas Haller's avatar
      core/trivial: rename nm_platform_sysctl_set_ip6_hop_limit_safe() · 91b5babf
      Thomas Haller authored
      Now that we have other helper function on platfrom for setting
      IP configuration sysctls, rename the function to set the hop-limit
      to match the pattern.
    • Thomas Haller's avatar
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      device/trivial: rename device's sysctl function · 395374cf
      Thomas Haller authored
      These functions call platform's sysctl getter and setters.
      Note that the called platform functions are called nm_platform_sysctl_get()
      and nm_platform_sysctl_set(). Also, in this case they use the ip-conf path
      via nm_utils_sysctl_ip_conf_path().
      Also, next we will add API nm_platform_sysctl_ip_conf_get() and
      nm_platform_sysctl_ip_conf_set(), which will be wrappers around
      nm_platform_sysctl_get() and nm_platform_sysctl_set(), using the ip-conf
      paths as well.
      Rename the device functions, to be more similar to the existing and future
      naming in platform.
    • Thomas Haller's avatar
      device: merge IPv4 and IPv6 variants of nm_device_ipv4_sysctl_set() · d27fa362
      Thomas Haller authored
      For one, next we will drop setting rp_filter, hence there are no
      more users of an IPv4 variant and nm_device_ipv4_sysctl_set() would
      have to be dropped anyway.
      However, instead of doing that, merge the IPv4 and IPv6 variant.
      With this, the fallback to the default is now also supported for IPv6
      (though unused).
      Also, don't access nm_device_get_ip_iface(). The interface name might
      not be right, we should only rely on the ifindex. Load the interface
      name from platform cache instead.
    • Thomas Haller's avatar
      platform: use struct initializer instead of memset() · 8b9fd01e
      Thomas Haller authored
      I think this is preferred over memset(), because it allows the
      compiler to better unstand what is happening.
      Also, strictly speaking in the C language, %NULL pointers are not
      guaranteed to have an all zero bit pattern. Of course, that is already
      required on any architecture where NetworkManager is running.
    • Thomas Haller's avatar
      platform: assert length of stack allocation in NMP_SYSCTL_PATHID_NETDIR_unsafe() · 67f02b2a
      Thomas Haller authored
      NMP_SYSCTL_PATHID_NETDIR_unsafe() uses alloca() to allocate the string.
      Assert that the "path" argument is reasonably short.
      In practice, that is of course the case, because there are only 2 callers
      which take care not to pass an untrusted, unbounded path argument.
    • Aleksander Morgado's avatar
      settings,gsm: deprecate and stop using 'number' property · 6ed21e83
      Aleksander Morgado authored
      The 'number' property in GSM settings is a legacy thing that comes
      from when ModemManager used user-provided numbers, if any, to connect
      3GPP modems.
      Since ModemManager 1.0, this property is completely unused for 3GPP
      modems, and so it doesn't make sense to use it in the NetworkManager
      settings. Ofono does not use it either.
      For AT+PPP-based 3GPP modems, the 'number' to call to establish the
      data connection is decided by ModemManager itself, e.g. for standard
      GSM/UMTS/LTE modems it will connect a given predefined PDP context,
      and for other modems like Iridium it will have the number to call
      hardcoded in the plugin itself.
  2. 16 Dec, 2018 1 commit
  3. 14 Dec, 2018 4 commits
  4. 13 Dec, 2018 18 commits
  5. 12 Dec, 2018 1 commit