1. 07 Nov, 2014 40 commits
    • 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
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      dhcp/test: fix compiler warning about pointer arithmetric for void* · 57133a38
      Thomas Haller authored
      clang warns:
      
          make[4]: Entering directory `./NetworkManager/src/dhcp-manager/tests'
            CC       test-dhcp-utils.o
          test-dhcp-utils.c:684:2: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wpointer-arith]
                  COMPARE_ID (nothex, TRUE, nothex, strlen (nothex));
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          test-dhcp-utils.c:667:23: note: expanded from macro 'COMPARE_ID'
                          g_assert (memcmp (p + 1, expected, expected_len) == 0); \
                                            ~ ^
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
      57133a38
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      gitignore: ignore dhcp test binary · 25228672
      Thomas Haller authored
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
      25228672
    • Lubomir Rintel's avatar
      sd-dhcp-client: Add missing initializers · b1550df6
      Lubomir Rintel authored
      Missing initializers together with automatic cleanup seem to annoy GCC's
      -Werror=maybe-uninitialized, breaking the --enable-more-warnings=error
      builds.
      b1550df6
    • Jiří Klimeš's avatar
      cli: add 'nmcli agent' command (bgo #739568) · 3a551664
      Jiří Klimeš authored
      Synopsis:
      nmcli agent { secret | polkit | all }
      
      The command runs separate NetworkManager secret agent or session polkit agent, or both.
      It is useful when
      - no other secret agent is available (such as GUI nm-applet, gnome-shell, KDE applet)
      - no other polkit agent is available (such as polkit-gnome-authentication-agent-1,
        polkit-kde-authentication-agent-1 or lxpolkit)
      
      https://bugzilla.gnome.org/show_bug.cgi?id=739568
      3a551664
    • Jiří Klimeš's avatar
      merge: implement a polkit agent and use it in nmcli (bgo #739413) · cc7dc016
      Jiří Klimeš authored
      The polkit agent listener code is generic and will be used by nmtui as well.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=739413
      cc7dc016
    • Jiří Klimeš's avatar
      cli: add a polkit agent support for nmcli · e5170612
      Jiří Klimeš authored
      Example: nmcli --ask general hostname computer007
      e5170612
    • Jiří Klimeš's avatar
      c7aaee10
    • Jiří Klimeš's avatar
      clients: add common code for polkit agent listener · ca5d6be9
      Jiří Klimeš authored
      that can be used by nmcli and nmtui
      ca5d6be9
    • Jiří Klimeš's avatar
    • Jiří Klimeš's avatar
    • Jiří Klimeš's avatar
      cli: add 'passwd-file' option for 'nmcli connection up' to provide passwords · 3c9b8671
      Jiří Klimeš authored
      It is useful for running nmcli without --ask option, i.e. non-interactively.
      
      Example contents of the file:
      wifi.psk: s e c r e t 12345
      802-1x.password:kili manjaro
      802-1x.pin:987654321
      3c9b8671
    • Jiří Klimeš's avatar
      cli: use secret agent for getting passwords from user · de7f85bd
      Jiří Klimeš authored
      --ask option has to be used, so that nmcli can be interactive.
      de7f85bd
    • Jiří Klimeš's avatar
      clients: add real property name to NNSecretAgentSimpleSecret · b41cb60b
      Jiří Klimeš authored
      It is necessary to identify secrets uniquely in nmcli.
      b41cb60b
    • Jiří Klimeš's avatar
      clients: move secret agent to common directory · 801fc34d
      Jiří Klimeš authored
      The agent code will be shared by both nmtui and nmcli.
      801fc34d
    • Dan Williams's avatar
    • Dan Williams's avatar
      dhcp: add systemd-based "internal" DHCP client · d2dd3b2c
      Dan Williams authored
      We must also remove -Waggregate-return from m4/compiler-warnings.m4 because systemd
      uses aggregate return (correctly) in a couple cases, and we cannot keep single-level
      makefiles and override aggregate-return only for the systemd sub-library.
      
      This client currently only supports DHCPv4 because the base systemd code
      does not yet fully support DHCPv6.
      d2dd3b2c
    • Dan Williams's avatar
      dhcp: add nm_dhcp_utils_client_id_string_to_bytes() · 3c34f1d9
      Dan Williams authored
      Generic function to convert a DHCP client identifier string in either
      hex form ("aa:bb:cc") or string form ("blahblah") to bytes.
      3c34f1d9
    • Dan Williams's avatar
      dhcp: systemd DHCP code changes necessary for NM integration · cd12e976
      Dan Williams authored
      Random functionality that's necessary for our use of the library.
      cd12e976
    • Dan Williams's avatar
      dhcp: make systemd DHCP code into a library · 1b1222ff
      Dan Williams authored
      The systemd code was modified to add "#if 0 /* NM_IGNORED */"
      around lines that cause problems for compilation or code that is
      not actually used in the library.
      
      An adaptation layer (nm-sd-adapt) was added for glue between
      systemd functions and NetworkManager, but changes to the actual
      systemd code have been kept to a minimum.
      
      The sd_event/sd_event_source functions of systemd have been
      re-implemented on top of the GLib main loop.
      1b1222ff
    • Thomas Haller's avatar
      dhcp: fix compiler warning in IN_SET macro · 78539e5a
      Thomas Haller authored
      clang warns:
      
          dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
                  assert_return (IN_SET(client->state, DHCP_STATE_INIT,
                                 ^
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:376:17: note: expanded from macro 'IN_SET'
                          const typeof(_y) _x = (x);                              \
                          ^
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                          if (_unlikely_(!(expr))) {                              \
                                           ^
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
          #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                                     ^
          dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:379:47: note: expanded from macro 'IN_SET'
                          for (_i = 0; _i < 1 + sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
                                                        ^
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                          if (_unlikely_(!(expr))) {                              \
                                           ^
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
          #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                                     ^
          dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:379:91: note: expanded from macro 'IN_SET'
                          for (_i = 0; _i < 1 + sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
                                                                                                    ^
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                          if (_unlikely_(!(expr))) {                              \
                                           ^
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
          #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                                     ^
          dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c:120:24: error: duplicate 'const' declaration specifier [-Werror,-Wduplicate-decl-specifier]
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:380:31: note: expanded from macro 'IN_SET'
                                  if (((const typeof(_x)[]) { _y, __VA_ARGS__ })[_i] == _x) { \
                                        ^
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:238:34: note: expanded from macro 'assert_return'
                          if (_unlikely_(!(expr))) {                              \
                                           ^
          ../src/dhcp-manager/systemd-dhcp/src/shared/macro.h:42:44: note: expanded from macro '_unlikely_'
          #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                                     ^
      Signed-off-by: Thomas Haller's avatarThomas Haller <thaller@redhat.com>
      78539e5a
    • Dan Williams's avatar
      sd-dhcp-client: fix REBOOT state handling · 9c3dbb02
      Dan Williams authored
      client->secs wasn't getting set in the REBOOT state, causing
      an assertion.  REBOOT should work the same way as INIT, per
      RFC 2131:
      
         secs          2  Filled in by client, seconds elapsed since client
                          began address acquisition or renewal process.
      
      REBOOT is necessary because many DHCP servers (especially on
      home routers) do not hand back the same IP address when in
      response to a DISCOVER packet, even if the same client ID is used.
      9c3dbb02
    • Dan Williams's avatar
      sd-dhcp-client: clean up raw socket sd_event_source when creating UDP source · 389daa38
      Dan Williams authored
      The raw socket sd_event_source used for DHCP server solicitations
      was simply dropped on the floor when creating the new UDP socket
      after a lease has been acquired.  Clean it up properly so we're
      not still listening and responding to events on it.
      389daa38
    • Dan Williams's avatar
      sd-dhcp-lease: expose load/save functions · d0bb1592
      Dan Williams authored
      They're useful outside of networkd itself.
      d0bb1592
    • Dan Williams's avatar
      sd-dhcp-lease: load/save client ID · 0c14c887
      Dan Williams authored
      The lease is intimately tied to the client ID in use, so when loading
      and renewing a lease, the same client ID should be used.
      0c14c887
    • Dan Williams's avatar
      sd-dhcp-client: support custom client IDs · 7c9db27a
      Dan Williams authored
      Non-ethernet interface types use different client identifier formats,
      plus when doing DHCPv4 and DHCPv6 on the same interface, the client
      identifier should be related per RFC 4361.  Thus let the caller
      override the existing MAC-based client identifier if necessary.
      7c9db27a
    • Dan Williams's avatar
      sd-dhcp6-client: fix off-by-two error in DUID length · 9f6c81ca
      Dan Williams authored
      The duid data passed by the client does not include the DUID type,
      but client->duid_len does account for the size of the DUID type.
      9f6c81ca
    • Dan Williams's avatar
      dhcp: add systemd DHCP code · 20462b50
      Dan Williams authored
      This is a direct dump from systemd git on 2014-10-28, git commit
      c4ac990007.  Only relevant files were included.
      
          SYSTEMD_DIR=../systemd
          COMMIT=c4ac990007cd0069bb7e76ec15dd731320f382fd
      
          mkdir -p ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/
          mkdir -p ./src/dhcp-manager/systemd-dhcp/src/shared/
          mkdir -p ./src/dhcp-manager/systemd-dhcp/src/systemd/
      
          (
             cd "$SYSTEMD_DIR"
             git checkout "$COMMIT"
             git clean -fdx
          )
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-internal.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-lease-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-lease-internal.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-network.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-network.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-option.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-option.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-packet.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-packet.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-protocol.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp-protocol.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-internal.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-lease-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-lease-internal.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-network.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-network.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-option.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-option.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-protocol.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-protocol.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.h ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.h
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-client.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-lease.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-lease.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-client.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-client.c
          /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-lease.c ./src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-lease.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/async.h ./src/dhcp-manager/systemd-dhcp/src/shared/async.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.c ./src/dhcp-manager/systemd-dhcp/src/shared/fileio.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.h ./src/dhcp-manager/systemd-dhcp/src/shared/fileio.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/list.h ./src/dhcp-manager/systemd-dhcp/src/shared/list.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/macro.h ./src/dhcp-manager/systemd-dhcp/src/shared/macro.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/refcnt.h ./src/dhcp-manager/systemd-dhcp/src/shared/refcnt.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.c ./src/dhcp-manager/systemd-dhcp/src/shared/siphash24.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.h ./src/dhcp-manager/systemd-dhcp/src/shared/siphash24.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/socket-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/socket-util.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/sparse-endian.h ./src/dhcp-manager/systemd-dhcp/src/shared/sparse-endian.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/strv.c ./src/dhcp-manager/systemd-dhcp/src/shared/strv.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/strv.h ./src/dhcp-manager/systemd-dhcp/src/shared/strv.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.c ./src/dhcp-manager/systemd-dhcp/src/shared/time-util.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/time-util.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.c ./src/dhcp-manager/systemd-dhcp/src/shared/utf8.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.h ./src/dhcp-manager/systemd-dhcp/src/shared/utf8.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/util.c ./src/dhcp-manager/systemd-dhcp/src/shared/util.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/util.h ./src/dhcp-manager/systemd-dhcp/src/shared/util.h
          /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.c ./src/dhcp-manager/systemd-dhcp/src/shared/in-addr-util.c
          /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.h ./src/dhcp-manager/systemd-dhcp/src/shared/in-addr-util.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/_sd-common.h ./src/dhcp-manager/systemd-dhcp/src/systemd/_sd-common.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-client.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-client.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-lease.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-lease.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-client.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp6-client.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-lease.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp6-lease.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-event.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-event.h
          /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-id128.h ./src/dhcp-manager/systemd-dhcp/src/systemd/sd-id128.h
      20462b50
    • Dan Williams's avatar
      b0626324
    • Dan Williams's avatar
      vpn: reconnect on service failures (bgo #349151) · 6cbbb9c0
      Dan Williams authored
      Attempt to reconnect the VPN on failures, except when the underlying
      device fails.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=349151
      6cbbb9c0
    • Dan Williams's avatar
    • 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
      vpn: allow plugins to re-enter the STARTING state to indicate reconnect · a966a5e8
      Dan Williams authored
      If the VPN re-enters the STARTING state to indicate that it has
      disconnected from the VPN server and is trying to reconnect, change
      the VPN connection's state to indicate that connectivity may be
      limited.  Wait for the VPN to provide updated IP configuration
      information from the reconnect to change back to the ACTIVATED
      state.
      a966a5e8
    • 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
      4b2935b9
    • Dan Williams's avatar