1. 19 Nov, 2014 12 commits
  2. 15 Nov, 2014 4 commits
    • Dan Winship's avatar
      libnm-core: change how new and legacy properties are serialized · c785a7df
      Dan Winship authored
      Although libnm filters out properties received from the daemon that it
      doesn't understand, there may be other clients that do not. In
      particular, a client might call GetSettings() on a connection, update
      the ipv4.addresses property in the returned dictionary, and then pass
      the dictionary to Update(). In that case, the updated dictionary would
      contain ipv4.address-data, but it would not reflect the changes the
      client intended to make.
      
      Fix this by changing the daemon side to prefer the legacy properties
      to the new ones if both are set, and changing the client side to not
      send the legacy properties (since we don't support new clients talking
      to old servers anyway).
      c785a7df
    • Dan Winship's avatar
      libnm-core: add _nm_utils_is_manager_process · 543416e5
      Dan Winship authored
      Add a variable indicating whether the process is the NetworkManager
      daemon.
      543416e5
    • Dan Winship's avatar
      libnm-core: add some missing array length annotations · 94157ce9
      Dan Winship authored
      A bunch of nm-utils methods that used to take GByteArray now take
      array+length, but weren't annotated to indicate that.
      94157ce9
    • Dan Winship's avatar
      libnm: add some missing (transfer) annotations · a41aff37
      Dan Winship authored
      All the old "const GByteArray" methods got changed to return a GBytes
      instead, but since they aren't declared "const" any more, we need to
      explicitly annotate them "(transfer none)".
      
      Also, the scanner apparently doesn't recognize that an (out)
      "const char **" is "(transfer none)", so annotate that in two places
      too
      a41aff37
  3. 13 Nov, 2014 2 commits
    • Dan Winship's avatar
      libnm*: fix library gettext usage · 53f5e9af
      Dan Winship authored
      Libraries need to include <gi18n-lib.h>, not <gi18n.h>, so that _()
      will get defined to "dgettext (GETTEXT_DOMAIN, string)" rather than
      "gettext (string)" (which will use the program's default domain, which
      works fine for programs in the NetworkManager tree, but not for
      external users). Likewise, we need to call bindtextdomain() so that
      gettext can find the translations if the library is installed in a
      different prefix from the program using it (and
      bind_textdomain_codeset(), so it will know the translations are in
      UTF-8 even if the locale isn't).
      
      (The fact that no one noticed this was broken before is because the
      libraries didn't really start returning useful translated strings much
      until 0.9.10, and none of the out-of-tree clients have been updated to
      actually show those strings to users yet.)
      53f5e9af
    • Dan Winship's avatar
      all: consistently include config.h · 3bfb163a
      Dan Winship authored
      config.h should be included from every .c file, and it should be
      included before any other include. Fix that.
      
      (As a side effect of how I did this, this also changes us to
      consistently use "config.h" rather than <config.h>. To the extent that
      it matters [which is not much], quotes are more correct anyway, since
      we're talking about a file in our own build tree, not a system
      include.)
      3bfb163a
  4. 12 Nov, 2014 1 commit
  5. 07 Nov, 2014 17 commits
    • Dan Williams's avatar
      libnm,core: enhance nm_utils_hexstr2bin() · 22762324
      Dan Williams authored
      Make the type return GBytes since most in-tree users want that.
      
      Allow the function to accept many more formats as valid hex, including
      bytes delimited by ':' and a leading '0x'.
      22762324
    • Dan Winship's avatar
      libnm, docs: docs fixes · cbabd135
      Dan Winship authored
      Update the docs build to include and exclude the correct files.
      
      Fill in some missing documentation, and fix problems in the existing
      docs. (In particular, "<" can't appear as a literal in documentation,
      so change it to "&lt;". Also, "PKCS#12" has to be written as
      "PKCS#<!-- -->12", or gtk-doc will think "#12" is a reference to a
      type named "12".)
      cbabd135
    • Thomas Haller's avatar
    • Dan Winship's avatar
      all: allow route metrics to be "0" · e374923b
      Dan Winship authored
      Change NMIPRoute to use "-1" for "default", so that "0" is a valid
      metric. Update everything for that.
      e374923b
    • Dan Winship's avatar
      libnm-core: don't serialize empty address-labels · ff608c24
      Dan Winship authored
      If no address in an NMSettingIP4Config has a label, then don't bother
      serializing an array of empty strings.
      ff608c24
    • Dan Winship's avatar
      libnm-core: don't warn about unrecognized properties · f8dcb951
      Dan Winship authored
      b64c82a3 removed the warning in libnm-util when
      nm_setting_new_from_hash() sees an unrecognized property, but we were
      still warning in the equivalent libnm-core code. But it doesn't make
      sense to warn here either: we do add new properties sometimes, but we
      always make sure that older clients still get the information they
      need as well, so they can just ignore the new property.
      f8dcb951
    • Dan Winship's avatar
      libnm-core, libnm, core: add AddressData and RouteData properties · d16905df
      Dan Winship authored
      Add AddressData and RouteData properties to NMSettingIPConfig and
      NMIP[46]Config. These are like the existing "addresses" and "routes"
      properties, but using strings and containing additional attributes,
      like NMIPAddress and NMIPRoute.
      
      This only affects the D-Bus representations; there are no API changes
      to NMSettingIP{,4,6}Config or NMIP{4,6}Config as a result of this; the
      additional information is just added to the existing 'addresses' and
      'routes' properties.
      
      NMSettingIP4Config and NMSettingIP6Config now always generate both
      old-style data ('addresses', 'address-labels', 'routes') and new-style
      data ('address-data', 'gateway', 'route-data') when serializing to
      D-Bus, for backward compatibility. When deserializing, they will fill
      in the 'addresses' and 'routes' properties from the new-style data if
      it is present (ignoring the old-style data), or from the old-style
      data if the new-style isn't present.
      
      The daemon-side NMIP4Config and NMIP6Config always emit changes for
      both 'Addresses'/'Routes' and 'AddressData'/'RouteData'. The
      libnm-side classes initially listen for changes on both properties,
      but start ignoring the 'Addresses' and 'Routes' properties once they
      know the daemon is also providing 'AddressData' and 'RouteData'.
      d16905df
    • Dan Winship's avatar
      libnm-core: add NMSettingIPConfig:gateway, drop NMIPAddress:gateway · f17699f4
      Dan Winship authored
      The gateway is a global property of the IPv4/IPv6 configuration, not
      an attribute of any particular address. So represent it as such in the
      API; remove the gateway from NMIPAddress, and add it to
      NMSettingIPConfig.
      
      Behind the scenes, the gateway is still serialized along with the
      first address in NMSettingIPConfig:addresses, and is deserialized from
      that if the settings dictionary doesn't contain a 'gateway' key.
      
      Adjust nmcli's interactive mode to prompt for IP addresses and gateway
      separately. (Patch partly from Jirka Klimeš.)
      f17699f4
    • Dan Winship's avatar
      all: stop pretending to support multiple "gateway"s · 329791ad
      Dan Winship authored
      NMSettingIP[46]Config let you associate a gateway with each address,
      and the writable settings backends record that information. But it
      never actually gets used: NMIP4Config and NMIP6Config only ever use
      the first gateway, and completely ignore any others. (And in the
      common usage of the term, an interface can only have one gateway
      anyway.)
      
      So, stop pretending that multiple gateways are meaningful; don't
      serialize or deserialize gateways other than the first in the
      'addresses' properties, and don't read or write multiple gateway
      values either.
      329791ad
    • Dan Winship's avatar
      libnm-core: extract NMSettingIPConfig superclass out of IP4, IP6 classes · 3f30c6f1
      Dan Winship authored
      Split a base NMSettingIPConfig class out of NMSettingIP4Config and
      NMSettingIP6Config, and update things accordingly.
      
      Further simplifications of now-redundant IPv4-vs-IPv6 code are
      possible, and should happen in the future.
      3f30c6f1
    • Dan Winship's avatar
      libnm-core: add NMIPAddress/NMIPRoute attributes, use for labels · 39709fdc
      Dan Winship authored
      Add key-value attributes to NMIPAddress and NMIPRoute, and use them to
      store IPv4 address labels. Demote NMSettingIP4Config:address-labels to
      a D-Bus-only property, and arrange for :addresses setter to read the
      labels out of that property when creating the addresses.
      39709fdc
    • Dan Winship's avatar
      libnm-core, all: merge IPv4 and IPv6 address/route types · 21c8a6b2
      Dan Winship authored
      Merge NMIP4Address and NMIP6Address into NMIPAddress, and NMIP4Route
      and NMIP6Route into NMIPRoute. The new types represent IP addresses as
      strings, rather than in binary, and so are address-family agnostic.
      21c8a6b2
    • Dan Winship's avatar
      libnm-core: tweak handling of overridden properties · 303e84e6
      Dan Winship authored
      nm_setting_compare() and nm_setting_diff() were ignoring the get_func
      of overridden properties, because that function requires passing an
      NMConnection, and they didn't have one to pass. This wasn't a problem
      yet because the only user of _nm_setting_class_override_property()
      wasn't using a get_func anyway, but it would cause problems later.
      
      The connection arg to NMSettingPropertyGetFunc is really there to be
      used by D-Bus-only properties (which don't get compared anyway), not
      for ordinary property overrides. So split it into two different
      function types: NMSettingPropertySynthFunc (used by D-Bus-only
      properties, to synthesize a fake property value for D-Bus, possibly
      using other properties in the NMConnection), and
      NMSettingPropertyGetFunc (used by overridden properties for both D-Bus
      and comparison purposes, and not getting an NMConnection argument).
      303e84e6
    • Dan Winship's avatar
      libnm-core: fix NMSetting property override docs · ec976324
      Dan Winship authored
      The docs for _nm_setting_class_add_dbus_only_property() and
      _nm_setting_class_override_property() mistakenly still referred to
      some functionality that didn't make it into the final version, and
      also had only been partially updated for the GValue->GVariant change.
      ec976324
    • Dan Williams's avatar
      vpn: allow plugins to indicate 'can-persist' capability · 1f544d33
      Dan Williams authored
      The plugin can indicate that this connection can persist across link
      changes and other connectivity dropouts by passing this option
      back in the SetConfig() calls.
      1f544d33
    • Dan Williams's avatar
      libnm/libnm-util: add VPN 'persistent' property · 2b9e4420
      Dan Williams authored
      This property will indicate that the user wishes the VPN connection
      to stay active until explicitly disconnected, even across link changes
      or other interruptions.
      2b9e4420
    • Dan Williams's avatar
      libnm: cancel NMRemoteSettings/NMManager property reload when NM quits · 648270d4
      Dan Williams authored
      If the operation isn't canceled it returns an error, printing this:
      
      /libnm/client-nm-running:
      (/home/dcbw/Development/fdo/NetworkManager/libnm/tests/.libs/lt-test-nm-client:17983): libnm-WARNING **: updated_properties: error reading NMRemoteSettings properties: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message did not receive a reply (timeout by message bus)
      /bin/sh: line 5: 17983 Trace/breakpoint trap   ./libnm-test-launch.sh ${dir}$tst
      FAIL: test-nm-client
      
      which screws up testcases because they don't expect this message.
      And in this case, since libnm knows that NM is exiting and will
      just clear out the properties anyway, it's useless to print the message.
      648270d4
  6. 29 Oct, 2014 2 commits
  7. 28 Oct, 2014 2 commits
    • Dan Winship's avatar
      libnm-core: make nm_setting_verify() take an NMConnection · 9e5c7d91
      Dan Winship authored
      nm_setting_verify() took a GSList of other NMSettings, but really it
      would just be simpler all around to pass the NMConnection instead...
      
      This means that several formerly NMSetting-branded functions that
      operated on lists-of-settings now get replaced with
      NMConnection-branded functions instead.
      9e5c7d91
    • Dan Winship's avatar
      libnm-core: add nm-core-types.h, remove cross-includes · b1087908
      Dan Winship authored
      Add nm-core-types.h, typedefing all of the GObject types in
      libnm-core; this is needed so that nm-setting.h can reference
      NMConnection in addition to nm-connection.h referencing NMSetting.
      
      Removing the cross-includes from the various headers causes lots of
      fallout elsewhere. (In particular, nm-utils.h used to include
      nm-connection.h, which included every setting header, so any file that
      included nm-utils.h automatically got most of the rest of libnm-core
      without needing to pay attention to specifics.) Fix this up by
      including nm-core-internal.h from those files that are now missing
      includes.
      b1087908