Commit Graph

68 Commits

Author SHA1 Message Date
Andreas Rammhold
819e8bb35f
nixos/networkd: rename the networkd dhcpConfig option to dhcpV4Config
This follows upstreams change in documentation. While the `[DHCP]`
section might still work it is undocumented and we should probably not
be using it anymore. Users can just upgrade to the new option without
much hassle.

I had to create a bit of custom module deprecation code since the usual
approach doesn't support wildcards in the path.
2020-05-01 13:33:54 +02:00
Andreas Rammhold
bb9b61e2b7
nixos/networkd: introduce the DHCPv6 network section eqivalent
You can now specify option for the `[DHCPv6]` section with
`systemd.network.<name>.dhcpV6Config.…`. Previously you could only use
the combined legacy DHCP configuration.
2020-05-01 13:33:54 +02:00
Andreas Rammhold
fc960a0123
nixos/networkd: add MaxAttempts and SendRelease to the DHCP options 2020-05-01 13:33:54 +02:00
Andreas Rammhold
7b78f0f098
nixos/networkd: remove CriticalConnection= fields in favor of KeepConnection
Systemd upstream has deprecated CriticalConnection with v244 in favor of
KeepConnection as that seems to be more flexible:

  The CriticalConnection= setting in .network files is now deprecated,
  and replaced by a new KeepConfiguration= setting which allows more
  detailed configuration of the IP configuration to keep in place.
2020-05-01 13:33:53 +02:00
Andreas Rammhold
0bdc8d7a58 nixos/networkd: add RoutesToDNS to DHCP section 2020-04-30 01:15:40 +02:00
Arian van Putten
14395cc687 nixos/networkd: Fix restartTriggers
1d61efb7f1 accidentially changed the
restartTriggers of systemd-networkd.service` to point to the attribute
name (in this case, a location relative to `/etc`), instead of the
location of the network-related unit files in the nix store.

This caused systemd-networkd to not get restarted on activation of new
networking config, if the file name hasn't changed.

Fix this, by pointing this back to the location in the nix store.
2020-04-23 09:53:44 +02:00
Florian Klink
355c58e485 nixos/networkd: respect systemd.network.links also with disabled systemd-networkd
This mirrors the behaviour of systemd - It's udev that parses `.link`
files, not `systemd-networkd`.

This was originally applied in 36ef112a47,
but was reverted due to 1115959a8d causing
evaluation errors on hydra.
2020-03-19 14:15:32 +01:00
Vladimír Čunát
0729b8c55e
Revert Merge #82310: nixos/systemd: apply .link
...even when networkd is disabled

This reverts commit ce78f3ac70, reversing
changes made to dc34da0755.

I'm sorry; Hydra has been unable to evaluate, always returning
> error: unexpected EOF reading a line
and I've been unable to reproduce the problem locally.  Bisecting
pointed to this merge, but I still can't see what exactly was wrong.
2020-03-13 22:05:33 +01:00
Florian Klink
36ef112a47 nixos/networkd: respect systemd.network.links also with disabled systemd-networkd
This mirrors the behaviour of systemd - It's udev that parses `.link`
files, not `systemd-networkd`.
2020-03-11 10:21:37 +01:00
Félix Baylac-Jacqué
9897d83f58 nixos/networkd: test routingPolicyRules with a nixos vm test 2020-03-02 15:37:40 +01:00
Félix Baylac-Jacqué
611d765b76 nixos/networkd: Add the RoutingPolicyRule-related options 2020-03-01 14:52:36 -08:00
Maximilian Bosch
0f10495eb9
Merge pull request #74624 from Ma27/networkd-units-internal
nixos/networkd: mark `units` option as internal
2020-02-02 07:59:57 +01:00
Maximilian Bosch
bc130855a7
nixos/networkd: add vrfConfig option to netdevs 2020-01-25 17:38:15 +01:00
Francesco Zanini
9974bb16b0 systemd-networkd: add configuration for XFRM interfaces 2020-01-14 11:33:18 +01:00
rnhmjoj
1d61efb7f1 treewide: use attrs instead of list for types.loaOf options 2020-01-06 10:39:18 -05:00
Maximilian Bosch
4324419f9e
Merge pull request #72888 from fooker/pr-3
nixos/networkd: Add more valid values for RequiredForOnline
2019-12-06 18:04:34 +01:00
Florian Klink
2c1281eb7a nixos/networkd: add missing "Advertise" option
This is in systemd since v240.
2019-12-06 08:43:34 +01:00
Maximilian Bosch
60f2c59471
nixos/networkd: mark units option as internal
The options at `systemd.network` (`links`, `netdevs` and `networks`) are
directly mapped to the three different unit types of `systemd-networkd(8)`.

However there's also the option `systemd.network.units` which is
basically used as a container for generated unit-configs that are linked
to `/etc/systemd/networkd`[1].

This should not be exposed to the user as it's unclear whether or not it
should be used directly which can be pretty confusing which is why I decided to
declare this option as internal (including all sub-options as `internal`
doesn't seem to be propagated to submodules).

[1] 9db75ed88f/nixos/modules/system/boot/networkd.nix (L933-L937)
2019-11-29 12:50:51 +01:00
WilliButz
b79e3e615a
nixos/networkd: add systemd-network user to group systemd-network 2019-11-25 10:46:28 +01:00
Maximilian Bosch
b451612bd9
nixos/networkd: add missing dhcpv6 and static options to IPv6PrefixDelegation 2019-11-23 12:51:38 +01:00
Dustin Frisch
943508a7fa nixos/networkd: add Name as valid option to Link
This has been there since v209 [1]

```
The interface name to use. This option has lower precedence than NamePolicy=, so for this setting to take effect, NamePolicy= must either be unset, empty, disabled, or all policies configured there must fail. Also see the example below with "Name=dmz0".

Note that specifying a name that the kernel might use for another interface (for example "eth0") is dangerous because the name assignment done by udev will race with the assignment done by the kernel, and only one interface may use the name. Depending on the order of operations, either udev or the kernel will win, making the naming unpredictable. It is best to use some different prefix, for example "internal0"/"external0" or "lan0"/"lan1"/"lan3".
```

[1] 43b3a5ef61
2019-11-19 22:13:17 +01:00
Dustin Frisch
0aeaf4dfe0
nixos/networkd: Add more valid values for RequiredForOnline
`RequiredForOnline` allows for a boolean value or operational state.
This adds the values for all valid the operational states.
2019-11-06 13:12:34 +01:00
Maximilian Bosch
47724fc77c
nixos/networkd: add ipv4-fallback and fallback as valid options to LinkLocalAddressing
Both options were introduced in systemd v243[1]. Those options can be
used to ensure that LinkLocalAddressing is only configured for a given
interface if DHCPv4 fails. To quote `systemd.network(5)`:

```
If "fallback" or "ipv4-fallback" is specified, then an IPv4
link-local address is configured only when DHCPv4 fails. If "fallback", an IPv6 link-local
address is always configured, and if "ipv4-fallback", the address is not configured. Note
that, the fallback mechanism works only when DHCPv4 client is enabled, that is, it requires
"DHCP=yes" or "DHCP=ipv4".
```

[1] 8bc17bb3f7
2019-10-28 20:51:17 +01:00
Félix Baylac-Jacqué
0528816570 systemd-networkd: add tests
(cherry picked from commit ec073e41a0dc8273cd81cf61fa37004310120af2)
2019-08-21 11:11:28 +02:00
David Guibert
7fd91a898b systemd-networkd: add support for wireguard netdev. 2019-08-21 11:11:24 +02:00
Edmund Wu
aa251bbc3e
systemd-networkd: link: Name -> OriginalName 2019-08-15 21:58:24 -04:00
Frederik Rietdijk
e58f0f6c99 Merge master into staging-next 2019-06-10 10:35:50 +02:00
Roman Volosatovs
8e489018d3
systemd-networkd: Only generate [Match] if present 2019-06-09 19:09:10 +02:00
Andreas Rammhold
1b7b1dbe2f
nixos/networkd: rename GatewayOnlink to GatewayOnLink
This follows upstreams renaming of the option [1].

[1] 9cb8c55934
2019-06-03 15:05:17 +02:00
Alexander Shpilkin
ecf73103ab
nixos/networkd: do not require gateway for routes
A route via a tunnel interface does not require a gateway to be
specified, so do not check for the Gateway= field on routes at all.
2018-09-07 02:23:12 +03:00
Alexander Shpilkin
8fdb6fba30
nixos/networkd: fix handling of RequiredForOnline 2018-09-07 02:01:21 +03:00
Alexander Shpilkin
423e46a24f
nixos/networkd: support MULTICAST flag on links
Support Multicast= option in [Link] section of network units,
introduced in systemd/systemd#9118.
2018-09-07 01:56:46 +03:00
Ben Wolsieffer
442681cc2a nixos/networkd: fix range assertions on 32 bit Nix 2018-08-28 19:31:10 -04:00
Ben Wolsieffer
6897945879 nixos/networkd: replace range with assertRange 2018-08-22 00:11:14 +02:00
Johannes Frankenau
b2f1790070 nixos/networkd: add missing options 2018-08-16 10:27:34 +02:00
volth
2e979e8ceb [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00
xeji
1937b810b6
Merge pull request #39340 from xeji/interim-fix-39069
nixos/networkd: wait for udev to settle before starting networkd
2018-04-29 20:45:09 +02:00
Ben Gamari
65c1cfce3f nixos/networkd: Allow RequiredForOnline field in [Link] section
This was previously missing.
2018-04-27 16:41:16 +00:00
xeji
236703f9f3 nixos/systemd-networkd: wait for udev to settle
... to avoid race condition between udevd renaming and
networkd configuring interfaces (39069)
2018-04-22 21:02:57 +02:00
Jörg Thalheim
a5dcde1a6f Revert "networkd: also load builtin modules"
This reverts commit d514dc220e.

breaks unpredicable network interfaces: https://github.com/NixOS/nixpkgs/pull/29768#issuecomment-370172863
2018-03-04 06:29:08 +00:00
Jörg Thalheim
12422149a7
Merge pull request #29768 from Mic92/networkd
networkd: also load builtin modules
2018-03-01 09:16:18 +00:00
Joachim F
7bf049a54c
Merge pull request #34492 from rnhmjoj/privacy
nixos/networking-interfaces: add preferTempAddress option
2018-02-17 08:41:23 +00:00
Franz Pletz
eb862c48dd
systemd: 234 -> 237
Co-Authored-By: Florian Klink <flokli@flokli.de>
Co-Authored-By: Andreas Rammhold <andreas@rammhold.de>
2018-02-13 01:24:24 +01:00
rnhmjoj
1fec496f38
nixos/networking-interfaces: add preferTempAddress option 2018-02-01 13:14:09 +01:00
Peter Hoeg
0f486c46b2 Revert "networkd: only wait for network to be online if configured to do so"
This reverts commit 8f21e089a8.
2017-10-14 14:42:49 +08:00
Peter Hoeg
8f21e089a8 networkd: only wait for network to be online if configured to do so 2017-10-14 14:38:04 +08:00
Joerg Thalheim
d514dc220e networkd: also load builtin modules 2017-09-25 11:27:57 +01:00
Florian Jacob
3e69c650ab nixos/systemd-networkd: allow [Link] section in .network files 2017-07-29 21:25:21 +02:00
Florian Jacob
cd8a1a7ceb networkd: Allow new MulticastDNS setting
which gained an implementation in systemd v233
2017-07-05 13:48:18 +02:00
Profpatsch
bb797c1390 networking.networkd: adjust autmatic mapping of bonds
Since the bonds interface changed to a lot more possible values we create a
mapping of kernel bond attribute names and values to networkd attributes.
Those match for the most part, but have to transformed slightly.

There is also an assert that unknown options won’t slip through silently.
2017-02-16 21:24:40 +01:00