Commit Graph

516 Commits

Author SHA1 Message Date
Tom Gundersen 3bef724f7e networkd: generate resolv.conf
This adds support to generate a basic resolv.conf in /run/systemd/network.
This file will not take any effect unless a symlink is created from
/etc/resolv.conf.

Nameservers received over DHCP takes precedence over statically configured ones.

Note: /etc/resolv.conf is severely limited, so in the future we will likely
rather provide a much more powerfull nss plugin (or something to that effect),
but this should allow current users to function without any loss of
functionality.
2014-01-12 15:37:21 +01:00
Tom Gundersen f46685a4c0 networkd: don't automatically reload config at runtime
We don't know if the config will be consistent, so do as systemd itself and only
load config when the daemon starts (and possibly, in the future, when explicitly requested).
2014-01-12 15:37:21 +01:00
Zbigniew Jędrzejewski-Szmek 2ad8416dd0 No need to canonicalize fixed paths 2014-01-08 22:15:27 -05:00
Tom Gundersen b3070dc025 networkd: refuse to use .network files with missing Address/Gateway key
These keys are mandatory in [Address]/[Route] sections. Otherwise, we
hit an assert:

ens3: setting addresses
Assertion 'address->family == 2 || address->family == 10' failed at /build/amd64-generic/tmp/portage/sys-apps/systemd-9999-r1/work/systemd-9999/src/network/networkd-address.c:137, function address_configure(). Aborting.

Reported-by: Alex Polvi <alex.polvi@coreos.com>

At the same time make sure Route's Destination and Gateway uses the same address family.
2014-01-05 00:32:31 +01:00
Zbigniew Jędrzejewski-Szmek 477e73b531 networkd: fix memory leak in error path 2014-01-02 19:49:49 -05:00
Zbigniew Jędrzejewski-Szmek 7384fa923e networkd: do not deference null pointer in cleanup 2014-01-02 19:49:43 -05:00
Tom Gundersen 449f755492 networkd: improve logging
Remove redundant messages, add some debugging ones and make wording more uniform.
2014-01-02 15:49:23 +01:00
Tom Gundersen f048a16b46 networkd: distinguish between static and dynamic addresses/routes
Static addresses/routes are associated with a network. Dynamic
addresses/routes are associtade with links (as the corresponding network
may be shared by several links).
2014-01-01 16:23:00 +01:00
Thomas Hindoe Paaboel Andersen bf1bc67015 network: more asserts to shut up scan-build 2013-12-16 18:55:59 +01:00
Tom Gundersen 02b59d57e0 networkd: add bridge support
A bridge is specified in a .netdev file with a section [Bridge]
and at least the entry Name=.

A link may be joined to a bridge if the .network applied to it has
a Bridge= entry giving the name of the bridge in its [Network] section.

We eagerly create all bridges on startup, and links are added to
bridges as soon as they both appear.
2013-11-26 01:32:25 +01:00
Dave Reisner a9bc6d2df1 networkd: use correct printf formatter
uint64_t can be formatted correctly with %ju, rather than casting to
unsigned and potentially losing accuracy.
2013-11-25 18:19:49 -05:00
Tom Gundersen 6ae115c1fe networkd: add support for [Address] sections
This will allow specifying more options per address than the
simple Address= entry in the [Network] section.

Preliminary support for the same functionality for [Route] sections
are added, but not yet hooked up, as more testing is needed.
2013-11-25 19:35:44 +01:00
Tom Gundersen 5a3eb5a77d networkd: make sure Network and Link can always be freed
Also, don't fail a link just because we can't find its MAC address.
2013-11-21 21:04:04 +01:00
Tom Gundersen 0617ffabe8 networkd: make sure Links and Networks are freed 2013-11-19 14:39:19 +01:00
Tom Gundersen f882c247ad networkd: make all calls async 2013-11-17 23:12:27 +01:00
Tom Gundersen f579559b3a networkd: add a basic network daemon
This daemon listens for and configures network devices tagged with
'systemd-networkd'. By default, no devices are tagged so this daemon
can safely run in parallel with existing network daemons/scripts.

Networks are configured in /etc/systemd/network/*.network. The first .network
file that matches a given link is applied. The matching logic is similar to
the one for .link files, but additionally supports matching on interface name.

The mid-term aim is to provide an alternative to ad-hoc scripts currently used
in initrd's and for wired setups that don't change much (e.g., as seen on
servers/and some embedded systems).

Currently, static addresses and a gateway can be configured.

Example .network file:

[Match]
Name=wlp2s0

[Network]
Description=My Network
Gateway=192.168.1.1
Address=192.168.1.23/24
Address=fe80::9aee:94ff:fe3f:c618/64
2013-11-09 23:41:17 +01:00