Commit Graph

218 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 072f9e4af4 networkd: turn UnicastFlood on by default
Looking at the kernel commit, "on" seems to be the default value:
commit 867a59436fc35593ae0e0efcd56cc6d2f8506586
Author: Vlad Yasevich <vyasevic@redhat.com>
Date:   Wed Jun 5 10:08:01 2013 -0400

    bridge: Add a flag to control unicast packet flood.

    Add a flag to control flood of unicast traffic.  By default, flood is
    on and the bridge will flood unicast traffic if it doesn't know
    the destination.  When the flag is turned off, unicast traffic
    without an FDB will not be forwarded to the specified port.

... and it seems to be the reasonable thing to do by default.
2015-07-24 23:44:42 -04:00
Zbigniew Jędrzejewski-Szmek 84c3409631 networkd: rename BPDUGuard to UseBPDU
Rename to follow the follow the style of other options.

In general "positive" options are preferred to "negative" ones,
because they are easier to describe and easier for humans to
parse (c.f. the shortening on the man page entry).
2015-07-24 23:44:42 -04:00
Susant Sahani a7d0ef446e networkd: DHCP override hostname
This patch enhances the DHCP client to send the hostname
reference
http://lists.freedesktop.org/archives/systemd-devel/2014-July/021550.html

Tested with
Example conf:

[Match]
Name=eth1

[Network]
DHCP=v4

[DHCP]
SendHostname=true
Hostname=test
2015-07-10 15:42:27 +05:30
Lennart Poettering 1f0d969512 networkd: various fixes for the IPv6 privacy extensions support
- Make sure that the IPv6PrivacyExtensions=yes results in
  prefer-temporary, not prefer-public.

- Introduce special enum value "kernel" to leave setting unset, similar
  how we have it for the IP forwarding settings.

- Bring the enum values in sync with the the strings we parse for them,
  to the level this makes sense (specifically, rename "disabled" to
  "no", and "prefer-temporary" to "yes").

- Make sure we really set the value to to "no" by default, the way it is
  already documented in the man page.

- Fix whitespace error.

- Make sure link_ipv6_privacy_extensions() actually returns the correct
  enum type, rather than implicitly casting it to "bool".

- properly size formatting buffer for ipv6 sysctl value

- Don't complain if /proc/sys isn't writable

- Document that the enum follows the kernel's own values (0 = off, 1 =
  prefer-public, 2 = prefer-temporary)

- Drop redundant negating of error code passed to log_syntax()

- Manpage fixes

This fixes a number of issues from PR #417
2015-07-06 20:37:22 +02:00
Susant Sahani 49092e22c2 networkd: Add support for ipv6 privacy extension
This patch add support for ipv6 privacy extensions.

The variable  /proc/sys/net/ipv6/conf/<if>/use_tempaddr

can be changed via the boolean

IPv6PrivacyExtensions=[yes/no/prefer-temporary]

When true enables privacy extensions, but prefer public addresses over
temporary addresses.
prefer-temporary  prefers temporary adresses over public addresses.
Defaults to false.

[Match]
Name=enp0s25

[Network]
IPv6PrivacyExtensions=prefer-temporary
2015-07-05 11:24:31 +05:30
Nick Owens 8add5f7970 networkd: create "kernel" setting for IPForwarding
In 5a8bcb674f, IPForwarding was introduced
to set forwarding flags on interfaces in .network files. networkd sets
forwarding options regardless of the previous setting, even if it was
set by e.g. sysctl. This commit creates a new option for IPForwarding,
"kernel", that preserves the sysctl settings rather than always setting
them.

See https://bugs.freedesktop.org/show_bug.cgi?id=89509 for the initial
bug report.
2015-06-11 12:09:21 -07:00
Nick Owens 37de250906 libsystemd-network: use domain validation instead of hostname validation for dhcp domain option
previously hostname_is_valid was used to validate domain names, which
would silently drop perfectly valid dns names that were longer than a
single dns label.
2015-06-10 11:15:46 -07:00
Lennart Poettering 958b66ea16 util: split all hostname related calls into hostname-util.c 2015-05-18 17:10:07 +02:00
Tom Gundersen 24c083dfcb networkd: network_get - allow udev_device to be NULL
In containers we never have udev devices, so drop the assert.

This fixes an assertion introduced in af3aa30274.
2015-05-12 00:43:45 +02:00
Susant Sahani 9011ce771f networkd: introduce vti6 tunnel
This patch add support to create vti6 tunnel

test:

vt6.network
[Match]
Name=wlan0

[Network]
Tunnel=ip6vti

vti6.netdev
[NetDev]
Name=ip6vti
Kind=vti6

[Tunnel]
Local=2a00:ffde:4567:edde::4987
Remote=2001:473:fece:cafe::5179

ip link

11: ip6_vti0@NONE: <NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT
group default
    link/tunnel6 :: brd ::
12: ip6vti@wlan0: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default
    link/tunnel6 2a00:ffde:4567:edde::4987 peer 2001:473:fece:cafe::5179
2015-04-29 21:54:00 +02:00
Lennart Poettering 6a7a4e4d0a networkd: improve how networkd logs things
This makes adds a couple of fixes:

- Introduces log_netdev_error_errno() and friends, which takes an error
  number, and matches what log_link_error_errno() and friends do.

- Replaces a lof ot strerror() usage with log_netdev_error_errno(),
  log_link_error_errno() and log_erro_errno()

- Uppercases the first character of many log messages, after all this is
  supposed to be english language

- Drops manual negating of error codes before passing them to log
  functions, the log functions all do that internally anyway.

Some other minor fixes.

Behaviour should not change really.
2015-04-21 17:43:55 +02:00
Tom Gundersen af3aa30274 network: don't pass NULL to udev_device_get_driver() 2015-03-27 16:23:46 +01:00
Zbigniew Jędrzejewski-Szmek dc75168823 Use space after a silencing (void)
We were using a space more often than not, and this way is
codified in CODING_STYLE.
2015-03-13 23:42:17 -04:00
Jan Janssen 3e43b2cd97 networkd: Make DHCP client ID creation configurable 2015-03-04 11:01:39 +01:00
Alin Rauta 0d4ad91dd4 networkd: add support for Uplink Failure Detection
Introduce BindCarrier= to indicate the set of links that determine if
the current link should be brought UP or DOWN.

[tomegun: add a bit to commit message]
2015-02-27 13:58:30 -05:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Tom Gundersen 60c3556660 networkd: network - rename ipv6token parser
Too generic name.
2015-02-14 00:32:56 +01:00
Tom Gundersen 5256e00e8b net: support globbing and disjunction in Match logic
Match{Name,OrginalName,Type,Driver,Path} can now take a space-separated glob of matches.
2015-02-10 22:30:35 +01:00
Torstein Husebø e2acdb6b0f treewide: correct typos and use consistent "MAC" spelling 2015-02-09 14:32:49 +01:00
Tom Gundersen 7f77697a17 networkd: add support for IPv6 tokens
This allows the admin to set the host-specific part of IPv6 addresses, but still
receive the prefix via SLAAC.

.network file snippet:

[Network]
IPv6Token=::12

gives:

$ ip token
token ::12 dev eth0

This closes https://bugs.freedesktop.org/show_bug.cgi?id=81177.
2015-02-09 12:20:10 +01:00
Tom Gundersen d0d6a4cd70 networkd: generalize IPv4LL to LinkLocal
This allows both IPv4 and IPv6 link-local addresses to be enabled or disabled. By default
we still enable IPv6LL and disable IPv4LL. The old config option is kept for backwards
compatibility, but removed from the documentation.
2015-02-09 12:20:10 +01:00
Tom Gundersen dbffab87f1 networkd: add network_get_by_name 2015-02-08 20:15:37 +01:00
Susant Sahani b16492f86f networkd: Introduce ip6gre and ip6gretap
This patch introduces ipv6 gre and gretap.

test:

ip6gre.netdev:
[NetDev]
Name=ip6gretap
Kind=ip6gretap

[Tunnel]
Local=2a00:ffde:4567:edde::4987
Remote=2001:473:fece:cafe::5179

ip6gre.network:
[Match]
Name=eno16777736

[Network]
Tunnel=ip6gretap

ip link

6: ip6gre@eno16777736: <POINTOPOINT,NOARP> mtu 1448 qdisc noop state
DOWN mode DEFAULT group default
    link/gre6 2a:00:ff🇩🇪45:67:ed🇩🇪00:00:00:00:00:00:49:87 peer
20:01:04:73:fe:ce:ca:fe:00:00:00:00:00:00:51:79
2015-01-22 21:29:42 +01:00
Susant Sahani 855ee1a1d2 networkd: Introduce IP6 tunnel
This patch enables networkd to create IP6 tunnels

example conf:

ipip6.netdev:
[NetDev]
Name=ipip6-tunnel
Kind=ip6tnl

[Tunnel]
Mode=ip4ipv6
Local=2a00:ffde:4567:edde::4987
Remote=2001:473:fece:cafe::5179

ipip6.network
[Match]
Name=wlan0

[Network]
Tunnel=ipip6-tunnel

23: ipip6-tunnel@wlan0: <POINTOPOINT,NOARP> mtu 1452 qdisc noop state
DOWN mode DEFAULT group default
    link/tunnel6 2a00:ffde:4567:edde::4987 peer 2001:473:fece:cafe::5179
2015-01-22 21:29:42 +01:00
Susant Sahani 1af2536acf networkd: introduce gretap
This patch introdeces gretap to networkd
2015-01-22 21:29:41 +01:00
Tom Gundersen c4a5ddc9f2 networkd: netdev - add ipvlan support 2015-01-19 23:25:16 +01:00
Lennart Poettering 769d324c99 networkd: make IP forwarding for IPv4 and IPv6 individually configurable 2015-01-13 20:17:07 +01:00
Lennart Poettering cb9fc36a12 networkd: introduce an AddressFamilyBoolean enum type
This introduces am AddressFamilyBoolean type that works more or less
like a booleaan, but can optionally turn on/off things for ipv4 and ipv6
independently. THis also ports the DHCP field over to it.
2015-01-13 20:17:06 +01:00
Lennart Poettering 5a8bcb674f networkd: add minimal IP forwarding and masquerading support to .network files
This adds two new settings to networkd's .network files:
IPForwarding=yes and IPMasquerade=yes. The former controls the
"forwarding" sysctl setting of the interface, thus controlling whether
IP forwarding shall be enabled on the specific interface. The latter
controls whether a firewall rule shall be installed that exposes traffic
coming from the interface as coming from the local host to all other
interfaces.

This also enables both options by default for container network
interfaces, thus making "systemd-nspawn --network-veth" have network
connectivity out of the box.
2015-01-13 13:55:15 +01:00
Alin Rauta b98b483bac networkd: add FDB support 2014-12-18 15:28:16 +01:00
Lennart Poettering 7303ec8f30 networkd: rename section [BridgePort] → [Bridge]
Let's stick to generic sections that describe the general technology,
instead of specific per-object sections, unless we really have a reason
to do that otherwise.
2014-12-10 19:07:48 +01:00
Tom Gundersen ca6038b896 udev: link-config - simplify net-match 2014-12-08 18:38:55 +01:00
Dave Reisner 285760fedf Check return value from reading name_assign_type attr
This file won't exist on kernels earlier than 3.17.
2014-12-08 18:38:55 +01:00
Tom Gundersen 32bc8adcd8 net_setup/networkd: warn if matching is done on possibly unstable ifname 2014-12-05 16:01:18 +01:00
Tom Gundersen c106cc36b9 networkd: add basic [Link] settings to .network files
This allows the default link settings (set in .link files) to be overridden per Network. Only MTU and MACAddress is supported for now.
2014-12-05 00:38:10 +01:00
Tom Gundersen 7eb08da4b3 udev: net_setup - allow matching on OriginalName=
This has been requested repeatedly, so let's give it a go. We explicitly do not allow matching
on names that have already been changed (from a previous udev run, or otherwise), and matching
on unpredictable names (ethX) is discouraged (but not currently disallowed).

We also currently allow:

[Match]
Name=veth0

[Link]
Name=my-name0
SomeOtherSetting=true

Which means that the link file will be applied the first time it is invoked, but
not on subsequent invocations, which may be surprising.
2014-12-04 18:53:47 +01:00
Susant Sahani e1853b00ef networkd: Add bridge port path cost
This patch add support to specify path cost of the
bridge port to be configured via conf file.

Exampe: conf

file: br.netdev

[NetDev]
Name=br-test
Kind=bridge

file: br.network
[Match]
Name=em1

[Network]
Bridge=br-test

[BridgePort]
Cost=332

 bridge link
2: em1 state UP : <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master
br-test state disabled priority 32 cost 332
2014-12-04 11:13:32 +01:00
Michal Schmidt f647962d64 treewide: yet more log_*_errno + return simplifications
Using:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
 'local $/;
  local $_=<>;
  s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg;
  print;'
 $f
done

And a couple of manual whitespace fixups.
2014-11-28 18:56:16 +01:00
Michal Schmidt da927ba997 treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
2014-11-28 13:29:21 +01:00
Michal Schmidt 0a1beeb642 treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:

find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'

Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno().
2014-11-28 12:04:41 +01:00
Michal Schmidt d5099efc47 hashmap: introduce hash_ops to make struct Hashmap smaller
It is redundant to store 'hash' and 'compare' function pointers in
struct Hashmap separately. The functions always comprise a pair.
Store a single pointer to struct hash_ops instead.

systemd keeps hundreds of hashmaps, so this saves a little bit of
memory.
2014-09-15 16:08:50 +02:00
Angus Gibson 84b5b79a8f networkd: allow specification of DHCP route metric
This lets the routing metric for links to be specified per-network,
still defaulting to DHCP_ROUTE_METRIC (1024) if unspecified. Hopefully
this helps with multiple interfaces configured via DHCP.
2014-09-08 15:09:08 +02:00
Tom Gundersen 2c36be2f4b networkd: fix use-after-free
Elements must be removed from the hashtable before they are freed.
2014-08-19 15:41:23 +02:00
Lennart Poettering 40274ed623 networkd: print nice warnings if people configure invalid domain names 2014-08-15 16:21:19 +02:00
Lennart Poettering 486d1a8148 networkd: fix minor memory leak 2014-08-15 16:02:42 +02:00
Lennart Poettering f15b6e5a8b networkd: remove "*" from domains list
Also, simplify things a bit and make sure we don't forget looking at one
of the entries.
2014-08-15 15:36:17 +02:00
Tom Gundersen 67272d157a sd-network: add support for wildcard domains 2014-08-15 15:15:24 +02:00
Tom Gundersen 6192b846ca networkd: add support for Domains= to .network files
This allows the search/routing domanis to be specified per link/network and be passed
on to resolved.
2014-08-15 15:15:24 +02:00
Tom Gundersen 1bd27a45d0 networkd: don't respect domainname from DHCP by default
Most routers will send garbage, so make this opt-in only.
2014-08-15 01:08:46 +02:00
Tom Gundersen ccf1c0299f networkd: disable ipv4ll default routes by default
This causes machines without connectivity to hang where they would otherwise fail. Keep it
opt-in for now, but consider whether we sholud just drop it.
2014-08-12 20:50:13 +02:00
Tom Gundersen 0b1831c20c networkd: split out networkd-link.h 2014-08-12 20:42:59 +02:00
Tom Gundersen bd8f653876 networkd: add and expose per-link LLMNR config option 2014-08-04 16:56:34 +02:00
Tom Gundersen 16aa63a00b networkd: route/address - use trivial hash functions 2014-07-28 12:21:51 +02:00
Tom Gundersen 6a0a2f860f networkd: unify handling of stacked netdevs 2014-07-28 12:16:40 +02:00
Tom Gundersen bfa695b5cc networkd: ipv4ll - default to setting up ipv4ll routes
This is necessary for non-ipv4ll hosts to communicate with ipv4ll-only hosts on the same link. Defaults
to being enabled, but can be opted out.

See: <http://avahi.org/wiki/AvahiAutoipd#Routes>
2014-07-25 02:14:23 +02:00
Tom Gundersen b0e39c8284 networkd: merge DNS and NTP entries when exporting
In the state files, do not distinguish where the various entries came from
(static or DHCP), but include them all in the same list.
2014-07-23 23:54:51 +02:00
Tom Gundersen aa9f114058 networkd: netdev - split NetDev struct into per-kind structs
Similarly to how unit types work.
2014-07-21 13:32:27 +02:00
Zbigniew Jędrzejewski-Szmek ed88bcfb7c Be more careful when checking for empty files
If we want to avoid reading a totally empty file, it seems better
to check after we have opened the file, not before.
2014-07-16 19:00:03 -04:00
Zbigniew Jędrzejewski-Szmek 36f822c4bd Let config_parse open file where applicable
Special care is needed so that we get an error message if the
file failed to parse, but not when it is missing. To avoid duplicating
the same error check in every caller, add an additional 'warn' boolean
to tell config_parse whether a message should be issued.
This makes things both shorter and more robust wrt. to error reporting.
2014-07-16 18:47:20 -04:00
Zbigniew Jędrzejewski-Szmek e9f3d2d508 Constify ConfigTableItem tables 2014-07-15 22:34:40 -04:00
Tom Gundersen 3be1d7e0c5 networkd: netdev - introduce vtable for netdev kinds
Split each netdev kind into its own .h/.c.
2014-07-14 16:49:41 +02:00
Susant Sahani edb85f0d8d networkd: dhcp add vendor class indentifier option 60
Vendor Class Identifier be used by DHCP clients to identify
their vendor type and configuration. When using this option,
vendors can define their own specific identifier values, such
as to convey a particular hardware or operating system
configuration or other identifying information.

Vendor-specified DHCP options—features that let administrators assign
separate options to clients with similar configuration requirements.
For example, if DHCP-aware clients for example we want to separate
different gateway and option for different set of people
(dev/test/hr/finance) in a org or devices for example web/database
servers or let's say in a embedded device etc and require a different
default gateway or DNS server than the rest of clients.
2014-07-14 11:39:20 +02:00
Steven Noonan c38d2eb828 networkd: accept section DHCP in systemd.network files 2014-07-04 11:34:43 +02:00
Eugene Yakubovich 4cc7a82c94 networkd: send hostname to dhcp server
Send hostname (option 12) in DISCOVER and REQUEST messages so the
DHCP server could use it to register with dynamic DNS and such.

To opt-out of this behaviour set SendHostname to false in [DHCP]
section of .network file

[tomegun: rebased, made sure a failing set_hostname is a noop and moved
          config from DHCPv4 to DHCP]
2014-07-01 22:02:25 +02:00
Eugene Yakubovich e1ea665eda Add support for DHCP static route options
This adds support for DHCP options 33 and 121: Static Route and
Classless Static Route. To enable this feature, set UseRoutes=true
in .network file. Returned routes are added to the routing table.
2014-06-29 15:18:21 +02:00
Susant Sahani 889a044ddc networkd: unref tunnel
Unref tunnel while shutting down
2014-06-16 20:38:22 +02:00
Susant Sahani 326cb4061a networkd: introduce vxlan
This patch enables netwokd to create vxlan

Changes:
Added:
	1. File networkd networkd-vxlan.c
	2. to netdev
	    bool learning
	    struct in_addr group
	    uint64_t vxlanid;
	3. VXLAN subsection and config
	   parameters
2014-06-16 20:38:22 +02:00
Tom Gundersen 97578344f3 networkd: link - left-align debug messages
Still add some whitespace betwen ifname and the message to get the
messages aligned (as I find it easier to spot specific messages this way).
2014-06-13 18:34:34 +02:00
Susant Sahani a613382bbf networkd: introduce vti tunnel
This patch enables vti tunnel support.

example conf:

file : vti.netdev
[NetDev]
Name=vti-tun
Kind=vti
MTUBytes=1480

[Tunnel]
Local=X.X.X.X
Remote=X.X.X.X

file: vti.network
[Match]
Name=em1

[Network]
Tunnel=vti-tun

TODO:

Add more attributes for vti tunnel
IFLA_VTI_IKEY
IFLA_VTI_OKEY
2014-06-02 16:20:44 +02:00
Tom Gundersen bcb7a07e0a networkd/sd-network: expose statically configured NTP servers 2014-05-19 18:42:14 +02:00
Tom Gundersen 091a364c80 resolved: add daemon to manage resolv.conf
Also remove the equivalent functionality from networkd.
2014-05-19 18:14:56 +02:00
Tom Gundersen d4920165fe networkd: network - store DNS servers in List rather than Set
This way we preserve the order of preference.
2014-05-16 19:48:25 +02:00
Tom Gundersen 3d3d425547 networkd: rename Address and Route list fields 2014-05-16 14:52:02 +02:00
Tom Gundersen 987efa17dd networkd: logging - align messages 2014-05-15 18:16:31 +02:00
Tom Gundersen af4e9e2c56 networkd: rename NetDev variable for consistency with Link 2014-05-15 18:15:21 +02:00
Susant Sahani 7951dea209 networkd: introduce ipip tunnel
This patch enables basic ipip tunnel support.
It works with kernel module ipip

example conf:

file: ipip.netdev

[NetDev]
Name=ipip-tun
Kind=ipip
MTUBytes=1480

[Tunnel]
Local=192.168.223.238
Remote=192.169.224.239
TTL=64

file: ipip.network

[Match]
Name=em1

[Network]
Tunnel=ipip-tun

[tomegun:
         - drop unused variable
         - take ref when enslaving]
2014-05-12 17:37:12 +02:00
Tom Gundersen 31d0ac36c6 networkd: network - fix leak 2014-05-10 20:56:37 +02:00
Tom Gundersen 47e2dc3168 networkd: network - do reference counting on netdevs 2014-05-09 14:41:27 +02:00
Tom Gundersen 69a93e7db4 networkd: network - merge all netdev parsing into one function 2014-05-09 14:41:27 +02:00
Tom Gundersen 6916ec29af network: implement masking of .link, .network and .netdev files 2014-04-19 19:05:37 +02:00
Tom Gundersen 505f8da732 networkd: tie links to rtnl rather than udev
This essentially swaps the roles of rtnl and udev in networkd. After this
change libudev is only used for waiting for udev to initialize devices and
to get udev-specific information needed for some [Match] attributes.

This in particular simplifies the code in containers where udev is not really
useful, but also simplifies things and reduces round-trips in the non-container
case.
2014-04-19 18:41:58 +02:00
Zbigniew Jędrzejewski-Szmek ecb08ec6a5 Fix a few return codes in error paths 2014-04-05 00:55:19 -04:00
Lennart Poettering 79e16ce3bf networkd: fix a couple of memory leaks 2014-03-24 23:46:13 +01:00
Tom Gundersen c6f7c917a1 libsystemd-network: move network-utils from src/shared
This does not belong in shared as it is mostly a detail of our networking subsystem.

Moreover, now we can use libudev here, which will simplify things.
2014-03-21 21:54:37 +01:00
Tom Gundersen 06f021a804 networkd: allow more than one static DNS server 2014-03-14 12:44:17 +01:00
Tom Gundersen a748b692dd network: link - simplify code a bit and remove some debug logging 2014-03-09 18:22:18 +01:00
Tom Gundersen fe6b2d55bc networkd: add basic support for MACVLANs 2014-02-25 21:19:08 +01:00
Tom Gundersen bf175aafd2 net-util: match on the driver as exposed by ethtool if DRIVER not set
Also fix a copy-paste error that broke matching on interface name.
2014-02-21 22:59:29 +01:00
Tom Gundersen edbb03e95a .network/.netdev/.link: allow to match on architecture 2014-02-21 16:05:02 +01:00
Tom Gundersen c0dda18697 networkd: netdev - allow filtering on kernel cmdline, host and virt 2014-02-20 22:12:25 +01:00
Tom Gundersen 2cc412b593 network/link: Match - filter on kernel cmdline, host and virt 2014-02-20 21:50:34 +01:00
Tom Gundersen 9b1c2626ce net-match: fix Driver= match
It should match on the driver of the parent device.
2014-02-18 22:34:26 +01:00
Tom Gundersen 672682a6b9 networkd: VLAN - allow multiple vlans to be created on a link
Also limit the range of vlan ids. Other implementations and
documentation use the ranges {0,1}-{4094,4095}, but we use
the one accepted by the kernel: 0-4094.

Reported-by: Oleksii Shevchuk <alxchk@gmail.com>
2014-02-10 19:00:17 +01:00
Tom Gundersen 1a43680949 networkd: netdev - rename Netdev to NetDev
Both in the configuration file format and everywhere else in the code.
2014-02-07 17:07:11 +01:00
Tom Gundersen 801bd9e859 net-util: verify the address family
Error out if the address family is already set to something incompatible with the
address being parsed.
2014-01-30 14:30:39 +01:00
Tom Gundersen 54abf461d6 networkd: add basic VLAN support 2014-01-25 11:25:17 +01:00
Tom Gundersen 52433f6b65 networkd: add basic bonding support
Refactor bridging support to be generic netdev support and extend it to
cover bonding as well.
2014-01-22 17:56:49 +01:00
Tom Gundersen 0de638530c networkd: dhcp - by default ignore the MTU 2014-01-18 21:19:09 +01:00
Tom Gundersen 039ebe6aeb sd-dhcp-client/networkd: add domainname support 2014-01-18 17:52:10 +01:00
Tom Gundersen 1346b1f038 sd-dhcp-client/networkd: add transient hostname support 2014-01-16 20:32:08 +01:00
Tom Gundersen 4f882b2a50 sd-dhcp-client/networkd: add interface MTU support 2014-01-16 01:44:19 +01:00
Tom Gundersen 5be4d38e31 networkd: DHCPv4 - allow opting out of using DNS servers
Setting UseDNS=no will ignore any received DNS servers.
2014-01-13 21:54:57 +01:00
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