Commit Graph

7207 Commits

Author SHA1 Message Date
Beniamino Galvani
d9d77d054d platform: fix gcc warning about comparison between enums
gcc complains with the following warning:

"comparison between 'enum <anonymous>' and 'enum vlan_flags'"

Cast one side of the comparison to avoid that.

Fixes: ee7414ebc8
2015-10-27 18:26:04 +01:00
Thomas Haller
ee7414ebc8 platform: NM defines for vlan header flags equal the linux headers 2015-10-27 17:24:52 +01:00
Jiří Klimeš
6142dc960b tests: add a testcase for matching VLAN connections 2015-10-27 17:17:06 +01:00
Jiří Klimeš
689de5c94a vlan: (all) add VLAN MVRP flag
http://patchwork.ozlabs.org/patch/219364/
2015-10-27 17:17:05 +01:00
Jiří Klimeš
93b8871f56 libnm: sort INGRESS_PRIORITY_MAP, EGRESS_PRIORITY_MAP properties
This fixes comparing the properties.

Priority map { 1:2, 2:5 } is actually the same as { 2:5, 1:2 }.
2015-10-27 17:17:05 +01:00
Jiří Klimeš
48b8f57468 platform: remove unnecessary rtnl_link_set_type (change, "vlan")
The type is set by build_rtnl_link().
2015-10-27 16:29:18 +01:00
Jiří Klimeš
22a0136bcb ifcfg-rh: read/write VLAN GVRP flags with GVRP= ifcfg file variable
initscripts uses GVRP variable for the flag (since 2011):
https://git.fedorahosted.org/cgit/initscripts.git/commit/?id=f662d4777625cd3bedea19cccabea7741a8b45c9

But continue reading "GVRP" from VLAN_FLAG= if GVRP= is missing.
2015-10-27 16:26:37 +01:00
Jiří Klimeš
db62fc9d72 platform: fix adding VLAN flags
We need to unset flags first.
2015-10-27 16:23:10 +01:00
Dan Williams
0e3086e8b8 bluetooth: fix missing 'connected' notifications (rh #1255284)
Because Bluez5 dropped DUN support, NM must do that manually which
includes emulating the "connected" property for Bluetooth devices when
DUN is used.  It does this by setting priv->connected = TRUE in
nm_bluez_device_connect_finish().

But for PAN, when NM does process the 'connected' property change
notification, priv->connected is already TRUE and
_take_variant_property_connected() does nothing.  Hence the
corresponding GObject property notification is not emitted,
nm-device-bt.c::check_connect_continue() will never return success, and
the activation times out.

To fix this, ensure that GObject notifications are emitted when the
device is connected, even if emulated internally.

https://mail.gnome.org/archives/networkmanager-list/2015-October/msg00053.html
https://bugzilla.redhat.com/show_bug.cgi?id=1255284
2015-10-25 19:47:43 +01:00
Lubomir Rintel
3621c2dd1e agent-manager: fix up bad cherry-pick from 1.0
Fixes: 5d1cac81a0
2015-10-23 18:54:09 +02:00
Lubomir Rintel
5d1cac81a0 agent-manager: cancel secrets requests on an error
It might be that the user didn't supply the secrets in time and the dbus call
timed out. The agent should now hide the secrets dialog and we must let it know.

https://bugzilla.redhat.com/show_bug.cgi?id=1272023
2015-10-23 18:21:25 +02:00
Lubomir Rintel
e9c88ba9de dbus: add strongswan to the vpn plugin bus names 2015-10-23 12:05:48 +02:00
Lubomir Rintel
a426f7f396 dbus: don't do <deny send_interface="..." /> in dbus service file
It does more than intended; apart from denying messages to that particular
interface it also denies all messages non-qualified with an interface globally.
From the dbus-daemon manual:

  Be careful with send_interface/receive_interface, because the
  interface field in messages is optional. In particular, do NOT
  specify <deny send_interface="org.foo.Bar"/>! This will cause
  no-interface messages to be blocked for all services, which is almost
  certainly not what you intended. Always use rules of the form: <deny
  send_interface="org.foo.Bar" send_destination="org.foo.Service"/>

We can just safely remove those rules, since we're sufficiently protected
by the send_destination matches and method calls are disallowed by default
anyway.
2015-10-23 12:05:47 +02:00
Jiří Klimeš
e9bc18d2a7 wifi: do no crash when getting BSSID fails
https://bodhi.fedoraproject.org/updates/NetworkManager-1.0.6-7.fc23#comment-342089
2015-10-22 10:27:14 +02:00
Jiří Klimeš
5fa369e95c wifi: fix a problem in removing non-existing source
GLib-CRITICAL **: Source ID 4197 was not found when attempting to remove it
2015-10-22 10:19:21 +02:00
Beniamino Galvani
97b14a21e4 ifcfg-rh: fix memory leak in reading of LLDP property
Fixes: 5966e14abf
2015-10-21 13:49:27 +02:00
Thomas Haller
58fc4381ff ifcfg-rh: remove another unused variable in parse_ethtool_option() 2015-10-20 17:43:05 +02:00
Thomas Haller
f840d9465f ifcfg-rh: remove unused variable in parse_ethtool_option() 2015-10-20 17:40:30 +02:00
Thomas Haller
fd7d57be03 platform/trivial: rename "auto_nmp_obj" macro to "nm_auto_nmpobj"
A define in a header file should have an "NM" prefix. Also,
let's have "nm_auto_" as a prefix for cleanup macros beside
libgsystem's "gs_".
2015-10-20 14:43:54 +02:00
Thomas Haller
638528d312 platform: move static asserts from header to source file
No point in having every user of the header file evaluate the
static assertion.
2015-10-20 14:08:04 +02:00
Thomas Haller
839330cd39 device: properly cancel queued activation request
We would leak the NMActivationRequest when carrier didn't
come within timeout. We must properly set the state of the
activation request.

https://bugzilla.redhat.com/show_bug.cgi?id=1079353
Fixes: 0bfe635119
2015-10-19 15:17:42 +02:00
Thomas Haller
118de885ea device: don't wait for carrier when activating static connection
When the connection to be activated doesn't require carrier,
don't queue it to wait for it.

https://bugzilla.redhat.com/show_bug.cgi?id=1079353
Fixes: 0bfe635119
2015-10-19 14:45:17 +02:00
Thomas Haller
c89fd1ea76 device: refactor using nm_clear_g_source() for priv->carrier_wait_id 2015-10-19 14:26:52 +02:00
Thomas Haller
cff3e93527 manager: fix activation without specified device
For an explicit user-request, we relax some checks when searching for a suitable
device; such as requiring-carrier.

Without this patch, a connection-up while the device has no carrier yet,
would fail right away with "No suitable device found for this connection."

https://bugzilla.redhat.com/show_bug.cgi?id=1079353
Fixes: 0bfe635119
2015-10-19 14:16:50 +02:00
Thomas Haller
8a6afe92c1 platform: fix link-detection for s390 CTC-type devices
Commit 02c6a93343 (rh#1212118)
introduced detection of CTC devices based on the driver name.

That was broken a while ago while refactoring.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1212118
https://bugzilla.redhat.com/show_bug.cgi?id=1272974

Fixes: ddaea22332
2015-10-19 12:24:39 +02:00
Beniamino Galvani
571f0dba38 core: fix conversion of nameservers to GValue in NMIP6Config
Fixes: 6c8f860820
2015-10-18 15:19:35 +02:00
Thomas Haller
bd1c0086bd ifcfg-rh: improve parsing of Wake-on-LAN options
Initscripts do:
    oldifs=$IFS;
    IFS=';';
    [ -n "${ETHTOOL_DELAY}" ] && /bin/usleep ${ETHTOOL_DELAY}
    for opts in $ETHTOOL_OPTS ; do
        IFS=$oldifs;
        if [[ "${opts}" =~ [[:space:]]*- ]]; then
            /sbin/ethtool $opts
        else
            /sbin/ethtool -s ${REALDEVICE} $opts
        fi
        IFS=';';
    done
    IFS=$oldifs;

thus, we want to split on ';', otherwise we parse
  "wol d;something else"
wrong.

Also, g_strsplit_set() returns multiple empty tokens. So
we must skip over empty tokens in case of "wol    d".

The @use_password was wrong, because we would warn if sopass is specified
before wol:
  "sopass AA:BB:CC:DD:EE:FF wol g"

More resilently handle wrong configurations:
  "wol pu wol m" => gives m.
  "wol pu wol" => should give NONE and warn (instead of "pu").

Also accept tab as separator.
2015-10-16 17:11:43 +02:00
Beniamino Galvani
e587dcb16e wake-on-lan: add option to keep existing settings
Add a new 'ignore' option to NMSettingWired.wake-on-lan which disables
management of wake-on-lan by NetworkManager (i.e. the pre-existing
option will not be touched). Also, change the default behavior to be
'ignore' instead of 'disabled'.

https://bugzilla.gnome.org/show_bug.cgi?id=755182
2015-10-16 17:11:26 +02:00
Guido Günther
35802ac01c platform: fix compilation if we don't have INET6_ADDR_GEN_MODE_* constants
As in src/platform/nm-linux-platform.c

https://mail.gnome.org/archives/networkmanager-list/2015-October/msg00023.html
2015-10-15 17:44:44 +02:00
Thomas Haller
2144457fab keyfile: make the keyfile location configurable
https://bugzilla.gnome.org/show_bug.cgi?id=755995
2015-10-14 20:23:38 +02:00
Thomas Haller
0c0cdb1c46 keyfile: remove "common.h" header
It only contained a few defines. Move them over to "utils.h".
2015-10-14 20:23:38 +02:00
Lubomir Rintel
7209356c4f manager: export the VPN connections when activating them
The vpn manager assumes it has a DBus path already.
2015-10-14 19:48:59 +02:00
Thomas Haller
06aafabf14 platform/test: add test adding IPv4 addresses that only differ by their peer-address
Also do a major cleanup of the tests:

- Have utility functions in "test-common.h" with a new prefix "nmtstp_".
  The prefix indicates that these are test functions for platform.

- Add functions to add/remove IP addresses that either use external
  iproute2 command or platform function itself. These commands also
  assert whether the command had the expected result.

- Randomize, whether we use the external command for adding
  ip-addresses. Both approaches should yield the same result
  for linux-platform.
  I did this now for address-tests, but effectively this doubled
  all our previous tests to use both internal and external ways
  to configure the address.

- Enable all address tests for fake-platform. They now
  automatically don't call external iproute2 but fallback
  to fake-platform implementation. This adds more coverage
  to the fake-platform, which we want to behave identical
  to linux-platform.

- Setup a clean test device before every address-test.
2015-10-14 16:16:21 +02:00
Thomas Haller
6a5dab5c7c platform: fix id-equality for IPv6 address to ignore prefix-length
For IPv6 addresses, the prefix-length is not part of the id.
E.g. you cannot add two IPv6 addresses that only differ by
plen.
2015-10-14 12:52:07 +02:00
Thomas Haller
eab5a462b4 platform: fix comparing peer-address for IPv6 address in nm_platform_ip6_address_cmp() 2015-10-14 12:52:07 +02:00
Thomas Haller
cc654b9dd3 ip-config: expose IP peer address on D-Bus 2015-10-14 12:52:07 +02:00
Thomas Haller
8968e15eb7 platform: properly handle peer-address for IPv4 addresses
Kernel allows to add the same IPv4 address that only differs by
peer-address (IFL_ADDRESS):

    $ ip link add dummy type dummy
    $ ip address add 1.1.1.1 peer 1.1.1.3/24 dev dummy
    $ ip address add 1.1.1.1 peer 1.1.1.4/24 dev dummy
    RTNETLINK answers: File exists
    $ ip address add 1.1.1.1 peer 1.1.2.3/24 dev dummy
    $ ip address show dev dummy
    2: dummy@NONE: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
        link/ether 52:58:a7:1e:e8:93 brd ff:ff:ff:ff:ff:ff
        inet 1.1.1.1 peer 1.1.1.3/24 scope global dummy
           valid_lft forever preferred_lft forever
        inet 1.1.1.1 peer 1.1.2.3/24 scope global dummy
           valid_lft forever preferred_lft forever

We must also consider peer-address, otherwise platform will treat
two different addresses as one and the same.

https://bugzilla.gnome.org/show_bug.cgi?id=756356
2015-10-14 12:52:07 +02:00
Thomas Haller
df8e5da3c0 ip-config: refactor to use _addresses_get_index() function
Also change the semantic of nm_ip6_config_address_exists()
to ignore the prefix length. It seems more correct this way,
but as there are no users of the function it doesn't actually
matter.
2015-10-14 12:52:07 +02:00
Thomas Haller
560de03bf3 ip4-config: allow IPv4 addresses that only differ by prefix-length
Kernel treats IPv4 addresses with different netmask/prefix-length as
different addresses.
It is wrong to merge them together in nm_ip4_config_add_address().

For IPv6 addresses that is not the case and you cannot configure
two IPv6 addresses that only differ by plen (on the same interface).
2015-10-14 12:52:07 +02:00
Thomas Haller
44c43b4f5c platform: rename _CMP_POINTER() macro to _CMP_SELF()
This name is better, because _CMP_SELF() is the first check of the two
operands to catch pointer-equality and NULL values.
2015-10-14 12:52:07 +02:00
Thomas Haller
f193d98ced platform: refactor order of peer-address argument in ip_address_add() function
The peer-address seems less important then the prefix-length.
Also, nm_platform_ip4_address_delete() has the peer-address
argument as last.

Soon ip4_address_get() also receives a peer-address argument,
so get the order right first.
2015-10-14 12:52:07 +02:00
Thomas Haller
d1c528e64c device: fix regenerating IP settings for assumed connections
Fixes: 06da353242
2015-10-14 12:52:06 +02:00
Lubomir Rintel
5b48befaad vpn-manager: support multiple VPN connections of the same type
A separate instance of the support plugin is spawned for each connection with
a different bus name. The bus name is passed via --bus-name <name> argument.
Plugins that support the feature indicate it with
support-multiple-connections=true key in the [VPN Connection] section.

The bus name is currently generated by adding a .<connection.uuid> to the VPN
service name. It's guarranteed unique, but if it proves to be too long or ugly
it can easily be replaced with something more meaningful (such as the same number
as is used for connection's DBus name).

NMVpnService has been removed and folded into NMVpnConnection. A
NMVpnConnection will spawn a service plugin instance whenever it is activated
and notices the bus name it needs is not provided.

The NMVpnManager no longer needs to keep track of the connections in use apart
for compatibility purposes with plugins that don't support the feature.
2015-10-13 18:20:56 +02:00
Lubomir Rintel
9bbf5e94c2 device: allow multiple vpn IP configurations 2015-10-13 18:20:56 +02:00
Lubomir Rintel
965363a6d5 vpn-connection: export add nm_vpn_connection_get_service()
Will be useful later on.
2015-10-13 18:20:56 +02:00
Beniamino Galvani
9184418b2e device: introduce a global default value for ipv4.dhcp-timeout
This allows the ipv4.dhcp-timeout default value to be set from user
configuration.

https://bugzilla.gnome.org/show_bug.cgi?id=756423
2015-10-13 09:37:34 +02:00
Beniamino Galvani
5966e14abf ifcfg-rh: add support for 'LLDP' connection property 2015-10-12 14:44:31 +02:00
Beniamino Galvani
6f41f42533 ifcfg-rh: split out parsing of boolean values from svTrueValue()
Move the parsing code to new function svParseBoolean() and rename
svTrueValue() to svGetValueBoolean().
2015-10-12 14:44:31 +02:00
Beniamino Galvani
07a9364d9c device: export list of LLDP neighbors through D-Bus
This adds a LldpNeighbors property to the Device D-Bus interface
carrying information about devices discovered through LLDP. The
property is an array of hashes and each hash describes the values of
LLDP TLVs for a specific neighbor.
2015-10-12 14:44:30 +02:00
Jiří Klimeš
f70f098d21 ppp: do not pass NULL to g_variant_new ("(s)")
The string does not like it:
(NetworkManager:21031): GLib-CRITICAL **: g_variant_new_string: assertion 'string != NULL' failed
2015-10-12 09:08:12 +02:00