Recent automake versions switched to not creating empty directories,
but at the moment NetworkManager g_warning()s on startup if it doesn't
find $(pkglibdir). So let's make it.
https://bugzilla.gnome.org/show_bug.cgi?id=688806
Broken by commit 5003153297
(core: move DNS change handling to the policy and optimize DNS updates (bgo #676778))
It consolidated DNS update handling, but mistakenly removed hostname changing
from NM_DEVICE_STATE_ACTIVATED state handler.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
When enumerating devices, libgudev's matching by default will return
devices which udev has not yet finished initializing.
This was frequently causing boot-time races on the OLPC XO, where
NetworkManager would bring a device up before udev had renamed it,
causing the later rename to fail.
To solve this, filter the enumeration matches to only include
initialized devices. The devices that are present but uninitialized
at this time will arrive a short time later, via a uevent.
https://bugs.freedesktop.org/show_bug.cgi?id=56929
(dcbw: update gudev version check in configure.ac)
Until we remove libnl-1.x and libnl-2.x support, it should be
possible to choose the libnl version at build time. This is
mostly important for testing legacy libnl support but it also
helps distributions that ship other tools built agains them.
(https://bugs.gentoo.org/show_bug.cgi?id=441750)
Instead of a 'modem#' identifier, use the primary port of the modem as unique
identifier. The modem UID will be set afterwards as the Device Iface, which is
then used by libnm-glib to gather vendor/product string from the udev device
associated with the Device Iface; so it really needs to be a real port.
Trying to ARP with no other machines in the broadcast domain
is pretty pointless, and in many cases doesn't work (ZTE MF691
/T-Mobile Rocket 2), so turn it off.
The only case where this was being used was in PPP-based connections, as the
ppp0 interface was reported by pppd once the IP setup was done. Instead, just
update the 'NM_MODEM_DATA_PORT' property, as the NMDevices already listen for
changes in that property.
The new ModemManager1-based `NMModemBroadband' objects will set the data port
information only after having created the bearer as part of the connection
process. The devices, therefore, need to listen to changes in the `data-port'
property, so that the `ip-iface' in the `NMDevice' is set before finishing the
stage1 of the activation. This is required in order to have a proper ifup of the
data port.
G_TYPE_INSTANCE_GET_PRIVATE() is known to be slow, so just call it once when
the private data is created, and keep a 'priv' pointer around for easy access.
The new `MMManager' object takes care of notifying modems added or removed from
the ModemManager1 interface.
We will listen to both the old and new ModemManager implementations, but as soon
as the first ModemManager implementation is found, the other one gets cleared,
so that we don't wait forever to appear.
The new ModemManager comes with its own headers, and defines its own symbols to
name e.g. each interface. In order not to collide with the new ones, rename the
existing ones with a 'MM_OLD_DBUS' prefix instead of just 'MM_DBUS'.
Previously, when a new bond or VLAN connection was created, NM would
always create the virtual device right away. But on startup, it only
creates virtual devices for connections that can autoconnect. Fix
connection_added() to make that check as well.
This patch makes DHCPv6 support more or less equivalent to that
one of IPv4 DHCP.
(dcbw: fix some formatting, rearrange code so it's less convoluted,
fix up writing hostname to ifcfg files)
For NetworkManager, dhclient is a runtime dependency. Distribution dhclient
configuration is either put directly into /etc or in /etc/dhcp. It is much
safer to check this at runtime than to guess the location from distribution
name.
Additionally, the distribution dhclient configuration files can be overriden
by a configuration file in /etc/NetworkManager.
TODO: Functions get_dhclient_config() and merge_dhclient_config() should
be also used for IPv6.
DHCP lease file names are built by NetworkManager and contain connection UUID
which makes them NM-specific. Their new location belongs to NetworkManager and
doesn't have to be guessed. With no guessing, we don't need distribution-specific
conditionals.
Note: This change may require modifications to the selinux policy. But after all
these files actually belong to NetworkManager as well as the instance of dhclient
that uses them.
Use --enable-doc and --enable-tests instead of --with-docs and
--with-tests. This is consistent with other features and with
--enable-gtk-doc option. Support current variants as fallback.
Don't build tests unless --enable-tests is specified.
You can now use 'address=' even for IPv6 and it's the encouraged way
to set up a single address manually. For multiple addresses,
'address0=', 'address1=', etc, should be preferred.
Example:
address=10.0.0.15/24/10.0.0.1
address0=192.168.0.1/24
address1=10.0.0.16/32
Example (backward compatibility):
addresses=10.0.0.15/24/10.0.0.1
addresses0=192.168.0.1/24
addresses1=10.0.0.16/32
IPv4 and IPv6 address configuration is now handled together and supports
the following syntax (slashes can be replaced with semicolons):
address/plen
address/plen,gateway
IPv4 and IPv6 route configuration is also handled uniformly and supports
the following syntax:
address/plen (for device routes)
address/plen,gateway (for gateway routes)
address/plen,gateway,metric (for gateway routes with metric)
For compatibility reasons, slash (/), comma (,) and semicolon (;) are
considered equal by the parser. The /plen part is optional for both
addresses and routes for compatibility reasons.
Leaving out the prefix length is not considered a good idea. IPv6
addresses default to 64 and IPv4 now defaults to 24 which is the closest
possible IPv4 counterpart. Routes default to single addresses.
Example 1:
[ipv4]
method=manual
addresses1=192.168.56.5/24,192.168.56.1
addresses2=192.168.57.5/24
routes1=4.5.6.0/24
routes2=1.2.3.0/24,4.5.6.7
routes3=7.8.9.0/24,4.5.6.7,99
[ipv6]
method=manual
addresses1=2001:db8:a🅱️:3/64,2001:db8:a🅱️:1
addresses2=2001:db8:c:d::3/64
routes1=2001:db8:e:f::/64,2001:db8:a🅱️:4
Example 2 (equivalent):
[ipv4]
method=manual
addresses1=192.168.56.5;24;192.168.56.1
addresses2=192.168.57.5;24
routes1=4.5.6.0;24
routes2=1.2.3.0;24;4.5.6.7
routes3=7.8.9.0;24;4.5.6.7;99
[ipv6]
method=manual
addresses1=2001:db8:a🅱️:3;64;2001:db8:a🅱️:1
addresses2=2001:db8:c:d::3;64
routes1=2001:db8:e:f::;64;2001:db8:a🅱️:4
For writing, I have arbitrarily chosen one of the formats 'reader'
can parse. Address and prefix length are separated by slash (/),
everything else is separated by comma (,).
addresses1=address/plen,gateway
routes1=address/plen,gateway,metric
Note: The modified 'reader' exposes a bug in the 'writer' and ignores
out badly-formatted routes. This problem is also fixed by this
commit. Keyfile tests now pass.
New option --with-suspend-resume=[upower|systemd] which defaults
to systemd if you have systemd >= 183 with the inhibit support,
otherwise upower. Allows you to use systemd session tracking
simultaneously with upower for suspend/resume if you don't have
system >= 183.
It is emitted in nm_settings_connection_remove() called by plugins when the
connection was removed.
This prevents the signal from appearing twice on D-Bus.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
Use autoconf/automake variables for NetworkManager paths. Use
NetworkManager subdirectory where appropriate.
Files in /var/run (or /run on some distros) are moved into a separate
directory as is usual with other daemons. It makes the filesystem
more readable and file prefixing unnecessary.
/var/run/NetworkManager.pid -> /var/run/NetworkManager/NetworkManager.pid
/var/run/nm-dns-dnsmasq.pid -> /var/run/NetworkManager/dnsmasq.pid
/var/run/nm-dns-dnsmasq.conf -> /var/run/NetworkManager/dnsmasq.conf
The /var/run/NetworkManager directory is created at runtime, if it doesn't
exist.
Note: Path-based security policies like SELinux and AppArmor may need to
be adapted.
When determining the system hostname, /etc/hostname should override
/etc/sysconfig/network, so monitor both files.
When setting the hostname, set it in /etc/hostname, and delete the
/etc/sysconfig/network HOSTNAME entry if present.
https://bugzilla.redhat.com/show_bug.cgi?id=831735
When updating connections, it is less confusing to reuse the existing file
instead of renaming files according to connection's ID. That reduces surprises
of moving connection files when a connection is edited.
We had separate checks for glib-2.0, gobject-2.0, gmodule-2.0, and
gio-unix-2.0. It doesn't make sense to link a binary against all 4
because gio-unix-2.0 depends on glib-2.0 and gobject-2.0. Doing this
actually breaks things in unusual circumstances.
Generally, few bits of NM actually just use glib, and not gio. We
might as well coalesce those requirements together, even if it means
in some cases we "overlink". Additionally, I chose for now to fold
gmodule-2.0 in as well, even though many fewer programs need it. The
cost of overlinking is quite small.
The benefit of this is less repeated junk in Makefile.am, as well as
more centralized control over GLib. A followup patch will allow us to
set -DGLIB_VERSION_MIN_REQUIRED in just one place, rather than having
to replicate it 4 times.
The NM configure is still suboptimal - for example, libpolkit-1
depends on gio-2.0, so really we should determine the compiler flags
all in one pass. But it doesn't matter too much for now.
This functionality is (mostly) obsoleted by the newer
GLIB_VERSION_MIN_REQUIRED and GLIB_VERSION_MAX_ALLOWED defines. With
this, your build doesn't all of a sudden blow up if we deprecate
something in GLib - you have to explicitly opt-in to the newer
version.
G_DISABLE_DEPRECATED does still apply for macros and things that can't
take __attribute__((deprecated)), but it's not really worth the pain
and cargo culting around just for that.
The logic behind the `iface' property (which actually is removed) gets split
into three new properties, as follows::
* `uid': Just defines a new string property which must contain a unique ID of
the modem, mainly for logging.
* `control-port': a string property defining which is the control port the
modem uses. This property is actually optional and may be specified as NULL.
The main purpose of this property is to allow the easy integration of the
new ModemManager into the `NMDeviceBt' object. The bluetooth device needs
to know the port used by the modem; and we cannot use the Data port
information as that is only available until the bearer is created. Instead,
for the new ModemManager we will use the control port information exposed.
* `data-port': a string property defining which is the data port to use in the
connection. This property is always defined in the `NMModemGsm' and
`NMModemCdma' objects.