Commit Graph

21088 Commits

Author SHA1 Message Date
Thomas Haller
2de000e1d2 proxy: reject huge pac_script values in verify() 2016-10-04 11:44:44 +02:00
Atul Anand
20098591d9 proxy: change semantics of pac-script
libnm-core: pac-script property in NMSettingProxy now represents the
script itself not the location. It ensures that the connection is
self contained.

nmcli: Supports loading of PAC Script via file path or written explicitly.
2016-10-04 11:44:44 +02:00
Atul Anand
812b8774f6 proxy: remove unnecessary APIs
Unnecessary APIs have been removed from nm-setting-proxy, client like
nm-connection-editor are expected to create a PAC script snippet the load
the location of file in NM.
2016-10-04 11:44:44 +02:00
Thomas Haller
0a9d1e001b po: translate libnm-core/nm-setting-proxy.c 2016-10-04 11:44:44 +02:00
Thomas Haller
ac8bf57f1b proxy: refactor NMProxyConfig to keep internal variables as strv
The API of NMProxyConfig exposes @proxies and @excludes as strv values.
There is no need to track those values internally as a GPtrArray and
then clone them in the getters (especially, since the entire NMProxyConfig
API is internal to core.

Thereby, fix a few memory leaks in add_proxy_config() and some
style fixes for { }.
2016-10-04 11:44:44 +02:00
Thomas Haller
931871995c proxy: fix logging level for proxy related messages in nm-device.c
Give them a common prefix ("proxy") and more importantly: don't log
non-important messages with <info> priority.
2016-10-04 11:44:44 +02:00
Thomas Haller
404f57a2a9 proxy/trivial: rename nm_pac_runner_manager*() functions
As the type is called NMPacRunnerManager, the proper name for the
functions is nm_pac_runner_manager*(). Alternatively, it the type
should be NMPacrunnerManager.
2016-10-04 11:44:44 +02:00
Thomas Haller
a9820a63d4 proxy: embed private date in NMPacRunnerManager and NMProxyConfig
These are final/sealed types (that is without subclasses). We can
hide the type structures and neatly embed the private data there.
2016-10-04 11:44:44 +02:00
Thomas Haller
27811b792c proxy: don't let nm_pacrunner_manager_send() fail
nm_pacrunner_manager_send() would only fail if passed in a NULL proxy_config.
And then it would log a <info> message without details about what failed.

Just don't do that.
2016-10-04 11:44:44 +02:00
Atul Anand
3ef7d316f6 TODO: Remove Proxies from the list of TODO
Remove Proxies from the list once proxy patches are successfully merged.
2016-10-04 11:44:44 +02:00
Atul Anand
2cb75e08d6 nmcli: Add Proxy support to nmcli
nmcli fixed to allow users edit proxy properties.
2016-10-04 11:44:44 +02:00
Atul Anand
197baf6dee callouts: Fixes in Dispatcher to release Proxy env variables
Dispatcher Fixed to release env variables for proxy stuff. For VPNs
proxy variables have prefix "VPN_" as usual.
2016-10-04 11:44:44 +02:00
Atul Anand
86d4573baa src: Fixes to add Proxy Feature
src: Fixes in nm-device.c and nm-vpn-connection.c to update PacRunner
at the right place and moment. When a device goes up PacRunner is
configured with the Device IPxConfigs and Proxy Config. When it goes
down the same configuration is removed from PacRunner.

ifcfg-rh: Fixed to read and write proxy settings to the ifcfg network
scripts.
2016-10-04 11:44:44 +02:00
Atul Anand
fd0b9ab583 src:(pacrunner-manager): Object for interaction with PacRunner
A new object NMPacRunnerManager has been added to manage and interact
PacRunner. It invokes both DBus methods on PacRunner DBus interface.
It stores the returned object path from CreateProxyConfiguration()
to feed as parameter to DestroyProxyCofiguration() when network goes down.
2016-10-04 11:44:13 +02:00
Atul Anand
ecfcdbda46 src:(proxy): A new Object NMProxyConfig with Proxy Parameters
A new config object NMProxyConfig has been implemented inside core
which contains proxy parameters.
2016-10-04 11:44:13 +02:00
Atul Anand
2a40112ebe libnm: API for Proxy Feature
libnm-core has been expanded to include proxy settings which clients
like nmcli, nm-connection-editor use to configure proxy in PacRunner. It
offers three modes i.e 'auto', 'manual'and 'none' and accordingly take
data to configure PacRunner. The modes matches on the PacRunner side too.
2016-10-04 11:44:13 +02:00
Thomas Haller
a5a36d6dfe core: merge branch 'th/cleanup-core-bgo772158'
https://bugzilla.gnome.org/show_bug.cgi?id=772158
2016-10-04 11:42:37 +02:00
Thomas Haller
ad0f403f9d dhcp: refactor loading of DHCP plugins
The DHCP plugins are linked statically and don't have a plugin mechanism
to be loaded from a shared library. Change the _nm_dhcp_client_register()
mechanism to something more static.

Also, only link the plugins into the binary if they are actually
enabled. Previously, they would always be linked in (and always
register themself). However, nm_dhcp_dh*_get_path() would return NULL
which made the plugin unusable.

The autoconf code to detect the DHCP plugins is still not stellar, but
seems to work well enough for now. At least, we log the result of the
detection at the end of the configure-script, so a user can at least
notice what happend.
2016-10-04 11:41:20 +02:00
Thomas Haller
4d37f7a1e9 core: refactor private data in "src"
- use _NM_GET_PRIVATE() and _NM_GET_PRIVATE_PTR() everywhere.

- reorder statements, to have GObject related functions (init, dispose,
  constructed) at the bottom of each file and in a consistent order w.r.t.
  each other.

- unify whitespaces in signal and properties declarations.

- use NM_GOBJECT_PROPERTIES_DEFINE() and _notify()

- drop unused signal slots in class structures

- drop unused header files for device factories
2016-10-04 09:50:56 +02:00
Thomas Haller
92e9822e1b core: forward-declare NMConfigDeviceStateData in nm-types.h 2016-10-03 12:04:49 +02:00
Thomas Haller
1f91c83a30 core: rename "nm-activation-request.[hc]" for NMActRequest
"nm-activation-request.[hc]" contains NMActRequest. It should
thus be called "nm-act-request.[hc]".
2016-10-03 12:04:49 +02:00
Thomas Haller
70c2292b45 dhcp: use NM_GOBJECT_PROPERTIES_DEFINE() for properties of NMDhcpClient 2016-10-03 12:04:49 +02:00
Thomas Haller
b2c0573f08 core/trivial: move code around
- get_property() should be imidiately before set_property().
- type_init() should be before constructing(), constructed()
  and type_new().
- dispose() and finalize() should be after object creation.
- at last follows class_init().
2016-10-03 12:04:49 +02:00
Thomas Haller
37268914f7 dhcp: make dispose() of NMDhcpDhclient/NMDhcpDhcpcd reentrant 2016-10-03 12:04:14 +02:00
Thomas Haller
0aa3a6dbfb core: refactor private data for NMExportedObject and others 2016-10-03 12:04:14 +02:00
Thomas Haller
b4e66c4818 shared: add nm_clear_g_free() 2016-10-03 12:02:34 +02:00
Thomas Haller
a83eb773ce all: modify line separator comments to be 80 chars wide
sed 's#^/\*\{5\}\*\+/$#/*****************************************************************************/#' $(git grep -l '\*\{5\}' | grep '\.[hc]$') -i
2016-10-03 12:01:15 +02:00
Aidan Delaney
05e66d5202 core: search in /usr/local before system paths for the dnsmasq binary
When looking for the dnsmasq (or any) binary, NetworkManager should
check /usr/local before it checks any system installed version. This
allows the user to replace the binary with a newer version should they
desire and is more consistent with the search behaviour commonly found
in $PATH.

https://github.com/NetworkManager/NetworkManager/pull/10
2016-10-01 13:52:04 +02:00
Lubomir Rintel
f605262792 build: enable JSON validation unless explicitly disabled
This makes it easier for packagers to make sure they're not building
without a feature unintentionally.
2016-09-27 18:37:22 +02:00
Lubomir Rintel
67999ef2d3 libnm-core/tests: disable the JSON validation check without jansson 2016-09-27 18:37:22 +02:00
Pellaeon Lin
4d7cf9a16d libnm: fix typo g_size to gsize
Fixes: 32f78ae6c3

https://bugzilla.gnome.org/show_bug.cgi?id=772062
2016-09-27 18:08:13 +02:00
Thomas Haller
e3a072f3c0 build: don't add systemd path the include search path
Our internal copy of systemd should not be in the search path.
Instead, let users only
  #include "systemd/nm-sd.h"
which then includes everything from systemd that we need.

We want to avoid to accidentally include anything from our
systemd-copy. Any user of that should only include "nm-sd.h",
which then includes everything that is needed further.

For example, "src/devices/wwan/nm-modem-manager.c" has
  #include <systemd/nm-daemon.h>
which in turn includes
  #include "_sd-common.h"
This works all correctly before, because #include "" will first
look in the directory where sd-daemon.h is. However, our mixing of
external systemd library and internal copy is rather dangerous.
Try to avoid it further by keeping the include paths clean.
2016-09-27 14:13:21 +02:00
Thomas Haller
3f4aa48d6b systemd: merge branch systemd into master 2016-09-27 13:29:38 +02:00
Thomas Haller
20ac1e8655 systemd: update code from upstream
This is a direct dump from systemd git on 2016-09-26, git commit
b4c6f71b827d41a4af8007b735edf21ef7609f99.

======

SYSTEMD_DIR=../systemd
COMMIT=b4c6f71b827d41a4af8007b735edf21ef7609f99

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files :/src/systemd/src/ | xargs -d '\n' rm -f

nm_copy_sd() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd "src/basic/alloc-util.c"
nm_copy_sd "src/basic/alloc-util.h"
nm_copy_sd "src/basic/async.h"
nm_copy_sd "src/basic/escape.c"
nm_copy_sd "src/basic/escape.h"
nm_copy_sd "src/basic/ether-addr-util.c"
nm_copy_sd "src/basic/ether-addr-util.h"
nm_copy_sd "src/basic/extract-word.c"
nm_copy_sd "src/basic/extract-word.h"
nm_copy_sd "src/basic/fileio.c"
nm_copy_sd "src/basic/fileio.h"
nm_copy_sd "src/basic/fd-util.c"
nm_copy_sd "src/basic/fd-util.h"
nm_copy_sd "src/basic/fs-util.c"
nm_copy_sd "src/basic/fs-util.h"
nm_copy_sd "src/basic/hash-funcs.c"
nm_copy_sd "src/basic/hash-funcs.h"
nm_copy_sd "src/basic/hashmap.c"
nm_copy_sd "src/basic/hashmap.h"
nm_copy_sd "src/basic/hexdecoct.c"
nm_copy_sd "src/basic/hexdecoct.h"
nm_copy_sd "src/basic/hostname-util.c"
nm_copy_sd "src/basic/hostname-util.h"
nm_copy_sd "src/basic/in-addr-util.c"
nm_copy_sd "src/basic/in-addr-util.h"
nm_copy_sd "src/basic/io-util.c"
nm_copy_sd "src/basic/io-util.h"
nm_copy_sd "src/basic/list.h"
nm_copy_sd "src/basic/log.h"
nm_copy_sd "src/basic/macro.h"
nm_copy_sd "src/basic/mempool.h"
nm_copy_sd "src/basic/mempool.c"
nm_copy_sd "src/basic/parse-util.c"
nm_copy_sd "src/basic/parse-util.h"
nm_copy_sd "src/basic/path-util.c"
nm_copy_sd "src/basic/path-util.h"
nm_copy_sd "src/basic/prioq.h"
nm_copy_sd "src/basic/prioq.c"
nm_copy_sd "src/basic/random-util.c"
nm_copy_sd "src/basic/random-util.h"
nm_copy_sd "src/basic/refcnt.h"
nm_copy_sd "src/basic/set.h"
nm_copy_sd "src/basic/signal-util.h"
nm_copy_sd "src/basic/siphash24.c"
nm_copy_sd "src/basic/siphash24.h"
nm_copy_sd "src/basic/socket-util.c"
nm_copy_sd "src/basic/socket-util.h"
nm_copy_sd "src/basic/sparse-endian.h"
nm_copy_sd "src/basic/stdio-util.h"
nm_copy_sd "src/basic/string-table.c"
nm_copy_sd "src/basic/string-table.h"
nm_copy_sd "src/basic/string-util.c"
nm_copy_sd "src/basic/string-util.h"
nm_copy_sd "src/basic/strv.c"
nm_copy_sd "src/basic/strv.h"
nm_copy_sd "src/basic/time-util.c"
nm_copy_sd "src/basic/time-util.h"
nm_copy_sd "src/basic/umask-util.h"
nm_copy_sd "src/basic/unaligned.h"
nm_copy_sd "src/basic/utf8.c"
nm_copy_sd "src/basic/utf8.h"
nm_copy_sd "src/basic/util.c"
nm_copy_sd "src/basic/util.h"
nm_copy_sd "src/libsystemd-network/arp-util.c"
nm_copy_sd "src/libsystemd-network/arp-util.h"
nm_copy_sd "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-network.c"
nm_copy_sd "src/libsystemd-network/dhcp-option.c"
nm_copy_sd "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.h"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.c"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-network.h"
nm_copy_sd "src/libsystemd-network/network-internal.c"
nm_copy_sd "src/libsystemd-network/network-internal.h"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd "src/libsystemd-network/sd-lldp.c"
nm_copy_sd "src/libsystemd/sd-event/sd-event.c"
nm_copy_sd "src/libsystemd/sd-id128/id128-util.c"
nm_copy_sd "src/libsystemd/sd-id128/id128-util.h"
nm_copy_sd "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd "src/shared/dns-domain.c"
nm_copy_sd "src/shared/dns-domain.h"
nm_copy_sd "src/systemd/_sd-common.h"
nm_copy_sd "src/systemd/sd-dhcp6-client.h"
nm_copy_sd "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd "src/systemd/sd-dhcp-client.h"
nm_copy_sd "src/systemd/sd-dhcp-lease.h"
nm_copy_sd "src/systemd/sd-event.h"
nm_copy_sd "src/systemd/sd-ndisc.h"
nm_copy_sd "src/systemd/sd-id128.h"
nm_copy_sd "src/systemd/sd-ipv4acd.h"
nm_copy_sd "src/systemd/sd-ipv4ll.h"
nm_copy_sd "src/systemd/sd-lldp.h"
2016-09-27 13:28:23 +02:00
Thomas Haller
1a54ac0a1f po: fix adding libnm-core/nm-setting-team.c to po/POTFILES.in
Fixes: 146e0d23bc
2016-09-27 12:02:14 +02:00
Thomas Haller
1b8c201cce cli: reject team.config from files with '\0'
The team-config must be valid utf-8. First of all, JSON
is also defined for other unicode encodings, but libjansson
can only handle utf-8. So, just require that.

A file with a '\0' truncates part of the file and is thus
invalid.
2016-09-27 11:24:47 +02:00
Thomas Haller
c2ef5da42a nmcli: merge branch 'th/nmcli-team-config-args-bgo771870'
https://bugzilla.gnome.org/show_bug.cgi?id=771870
2016-09-27 11:01:24 +02:00
Thomas Haller
c1a4c084b0 cli: support explicitly selecting team-config as file or json data
nmcli has a heuristic when setting the team-config to accepting both
a filename or the plain json text.

Add support for two schemes "file://" and "json://" to explicitly
determine whether to read from file or from json.

Also, no longer silently ignore an all-whitespace word. That is an
error (unless you have a file named " ").

Also, no longer replace newlines with space. Don't mangle the input
text at all.
2016-09-27 10:59:47 +02:00
Thomas Haller
146e0d23bc libnm: reject too large team-config JSON 2016-09-27 10:56:57 +02:00
Thomas Haller
32f78ae6c3 libnm: expose nm_utils_is_json_object() utility function
Since we possibly already link against libjansson, we can also expose some
helper utils which allows nmcli to do basic validation of JSON without
requiring to duplicate the effort of using libjansson.

Also, tighten up the cecks to ensure that we have a JSON object at hand.
We are really interested in that and not of arrays or literals.
2016-09-27 10:56:42 +02:00
Lubomir Rintel
c3586ce01a device: consider a device with slaves configured
Do assume connections for it.

https://bugzilla.redhat.com/show_bug.cgi?id=1333983
2016-09-26 17:49:26 +02:00
Thomas Haller
eb3dd9b679 policy: refactor auto_activate_device() to get rid of "out" cleanup label 2016-09-26 17:10:32 +02:00
Thomas Haller
7a5537ee86 policy: fix owner-ship of specific_object in can_auto_connect()
NMPolicy:auto_activate_device() would wrongly not free the
specific_object, although it is documented as transfer-full.

The only implementation of can_auto_connect() that returned
a specific-object is NMDeviceWifi:can_auto_connect(). So, there
wasn't any actual bug or memory leak.

Fixes: 4c028c7cef
2016-09-26 17:10:07 +02:00
Thomas Haller
ee86069601 shared: add test for NM_SET_OUT() 2016-09-26 17:00:38 +02:00
Beniamino Galvani
d27ae4a8fe checkpoint: merge branch 'bg/checkpoint-improvements-bgo770315'
https://bugzilla.gnome.org/show_bug.cgi?id=770315
2016-09-26 15:10:44 +02:00
Beniamino Galvani
45f72c8cc1 checkpoint: restore both applied and settings connections 2016-09-26 15:10:39 +02:00
Beniamino Galvani
1ab616b59c checkpoint: make python example accept multiple devices and timeout
Add a timeout parameter and allow passing multiple interfaces to make
the script more useful for testing purposes.
2016-09-26 15:10:39 +02:00
Beniamino Galvani
8b9ea0b7c6 checkpoint: consider all devices when an empty list is passed
First, consider all devices and not only realized and managed ones
when an empty list is passed. Also, move the list evaluation to the
checkpoint manager, since the check for device conflicts is done
there.

Fixes: 3e09aed2a0
2016-09-26 15:10:39 +02:00
Beniamino Galvani
c76e218877 checkpoint: use UUID instead of path to match connections
The path can change, while the UUID should univocally identify the
connection.
2016-09-26 15:10:39 +02:00
Beniamino Galvani
637e31bc1f checkpoint: better handle unmanaged and unrealized devices
In order to better restore the previous system state, allow the
inclusion of unmanaged devices in a checkpoint and try to revert to
the old state taking also the realized/managed state into account.
2016-09-26 15:10:39 +02:00