Commit Graph

790 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek d5e172d2fb networkd: unfoobar serialization of links
We'd start writing an entry line, then another one, then another one,
and then output the rest of the first one, and then some other random
stuff, and the rest of some other lines... Results were ...eh... random.

Let's define a helper to avoid some of the copy&paste madness, and separate
blocks that output a single line with /**********************************/.

This rework doesn't change what data is written, it only tries to fix the
format of the output. The fact that some entries only write data from
link->network, and some from either link->network or link, some stuff only
for dhpc4 leases while some for both dhpc4 and dhcp6, etc, looks rather
suspicious too, but I didn't touch this.
2020-05-26 10:08:54 +02:00
Zbigniew Jędrzejewski-Szmek 00813316b0 sd-dhcp6: constify output arguments in get_{ntp,nds}_addr
This matches what we do for ipv4 and is in general better.
2020-05-26 09:47:45 +02:00
Zbigniew Jędrzejewski-Szmek dddc8d1e1e sd-network: reduce scope of some variables 2020-05-26 09:47:45 +02:00
Zbigniew Jędrzejewski-Szmek 2206aa5c35 sd-network: fix inverted error message
We get -ENOMSG when there is no lease.
2020-05-25 11:14:54 +02:00
Susant Sahani 89fe653544 network: Add support to group links.
Link groups are similar to port ranges found in managed switches.
You can add network interfaces to a numbered group and perform operations
on all the interfaces from that group at once.
2020-05-15 15:27:07 +02:00
Susant Sahani d361b3730a network: Add support send and receive LPR servers 2020-04-22 14:49:27 +02:00
Susant Sahani f6269fe7bb network: DHCP - add support to emit and receive SMTP server information 2020-03-29 22:59:11 +02:00
Susant Sahani 284e8fd0d7 DHCP: Add support to emit and retrieve POP3 server 2020-03-28 03:34:27 +01:00
Dan Streetman 1b43e24602 network: attach sd-event in link_load() when creating link dhcp_client or ipv4ll
Commit 08c588d18b moved attachment of the
sd-event into creation of the dhcp_client or ipv4ll in dhcp4_configure()
or ipv4ll_configure(), but these can also be created in link_load(),
so that creation needs to also perform sd-event attachment.

Without this, dhcp_client or ipv4ll created in link_load() will not have
an ->event and will fail assertion, causing networkd to fail, e.g.:

Assertion 'client->event' failed at src/libsystemd-network/sd-dhcp-client.c:1283, function client_start_delayed(). Ignoring.
ens2: Could not acquire DHCPv4 lease: Invalid argument
ens2: Failed
2020-03-24 17:49:08 +01:00
Yu Watanabe bba1f90ff5
Merge pull request #14890 from yuwata/network-tc-next
network: tc-next
2020-03-07 01:44:15 +09:00
Susant Sahani cd305af1fe network: Allow DHCPv6 client to start without router's managed flag. 2020-03-07 01:38:26 +09:00
Chris Down 5bb67b107f
Merge pull request #14956 from ssahani/delegated-prefix-14474
nettwork: introduce delegated prefix assign
2020-03-06 16:13:13 +00:00
Yu Watanabe ef62949a23 network: make Type=ether match based on iftype
This makes Type= can match the type shown in networkctl.

Closes #14952.
2020-03-02 08:52:18 +01:00
Yu Watanabe 34658df256 network: introduce TrafficControlKind to prepare for supporting tc class 2020-03-02 15:46:28 +09:00
Susant Sahani bd6379ec57 network: introduce IPv6 prefix assign
Expose a boolean flag to automatically add an address from the delegated prefix to the interface
2020-03-01 00:49:19 +09:00
Yu Watanabe 8956caf333 network: fix typo in comment 2020-02-28 16:52:33 +01:00
Yu Watanabe ab119e6338 network: append period if error message provided by kernel does not contain it 2020-02-07 13:49:01 +09:00
Zbigniew Jędrzejewski-Szmek 239bf9409d
Merge pull request #14536 from DaanDeMeyer/wait-online-max-operstate
wait-online: add maximum operational state option
2020-02-05 10:16:29 +01:00
Yu Watanabe fd3ef936ed network,radv: make DNS= in [IPv6PrefixDelegation] section take special value 'linklocal'
Closes #13639.
2020-02-04 13:56:30 +09:00
Yu Watanabe 2c0d7ed393 network: do nothing if link is in pending or linger state on reconfiguring 2020-01-22 16:08:12 +09:00
Yu Watanabe 8ae7b8a1e1 network: set dirty flag when link is being reconfigured 2020-01-22 16:08:12 +09:00
Daan De Meyer 75cd4a5d92 wait-online: Add maximum operational state option 2020-01-18 18:17:22 +01:00
Zbigniew Jędrzejewski-Szmek 191a3f1634 basic/strv: drop flags argument from strv_fnmatch() 2020-01-14 13:10:29 +01:00
Dan Streetman 4c64965257 network: drop foreign config after addr_gen_mode has been set
Interfaces may come up at any time, even during our initialization of
them, for various reasons; e.g. the kernel will raise VLAN when its
parent is raised; or we will raise an interface if configured with
BindCarrier and its associated interfaces come up.

When LinkLocalAddressing has been disabled for ipv6, we disable
addr_gen_mode in the kernel, so it will not automatically create a
ipv6ll address when the interface is raised.  However, we currently
drop all foreign addresses before disabling addr_gen_mode.

If the link has been up for a long time, then its kernel-created ipv6ll
address will be correctly dropped.  If the link is down, and stays
down until we raise it after finishing configuration, the addr_gen_mode
setting will be disabled when the interface is raised and the kernel
will not create any ipv6ll address.

However, if the interface is raised after dropping foreign config,
but before we have disabled addr_gen_mode, the kernel will create a
ipv6ll tentative address that will eventually finish DAD and become a
working ipv6ll address, even though we have been configured to disable
ipv6ll.

Moving our call to drop foreign addresses to after we have successfully
set addr_gen_mode closes this window; after we disable addr_gen_mode,
we can safely remove foreign ipv6ll addresses (including tentative ones)
and be sure that the kernel will not create any more.

Fixes: #13882.
2020-01-09 15:19:19 -05:00
Dan Streetman 0917a27178 network: if ipv6ll is disabled, enumerate tentative ipv6 addrs before dropping foreign addrs
The kernel will create an ipv6ll tentative address immediately when an
interface is raised if addr_gen_mode is not disabled; and, the kernel does
not notify netlink listeners about any tentative addresses.  So it's
possible for an interface to contain tentative ipv6 link-local address(es)
that networkd doesn't know about when all foreign addresses are dropped.

In this case, networkd is later notified about the new ipv6ll address(es)
after they finish DAD and are no longer tentative; but since that's after
networkd has already dropped foreign addresses, they are incorrectly left
on the interface.
2020-01-09 15:19:19 -05:00
Dan Streetman 9524014ee6 network: add link->setting_genmode flag
Similar to the link->setting_mtu flag, this delays continued configuration
until after the genmode has been successfully set; this is important
because we do not want networkd to raise the interface before the genmode
has been set, as if we're disabling the genmode, raising the interface
before we have successfully disabled the genmode will result in the kernel
creating a ipv6ll address, even though we don't want that.
2020-01-09 15:19:19 -05:00
Dan Streetman 3a390124b7 network: rename linux_configure_after_setting_mtu() to linux_configure_continue()
This is a simple rename to make the function name more generic;
the next commit expands its usage to more than only the mtu handler.
2020-01-09 15:19:08 -05:00
Yu Watanabe 125c7814fa
Merge pull request #14523 from keszybz/refactorings
Refactorings inspired by recent pull requests
2020-01-09 12:50:11 +09:00
Zbigniew Jędrzejewski-Szmek 6666c4faee network: do not require ethtool_get_permanent_macaddr() to get an fd 2020-01-08 17:14:56 +01:00
Lennart Poettering 0aa9bffe10
Merge pull request #14448 from yuwata/network-permanent-mac-address
network, udev: support permanent mac address
2020-01-08 15:36:27 +01:00
Yu Watanabe 4bb7cc8287 network, udev: introduce PermanentMACAddress= setting in [Match] section
Closes #13983.
2020-01-08 17:54:54 +09:00
Yu Watanabe 1985c54ff3 network: static routes via DHCP gateway
This makes Gateway= also take "DHCP". If "DHCP" is set, then the gateway
address provided by DHCP or IPv6 RA is used.

Closes #8213.
2020-01-07 19:10:54 +09:00
Lennart Poettering dc5737470e
Merge pull request #14194 from yuwata/network-multipath-routing-12541
network: introduce multipath routing
2020-01-03 15:38:03 +01:00
Yu Watanabe 40681e5cdc network: add one more log message 2019-12-23 21:34:31 +01:00
Yu Watanabe 6ff5cc6b7a network: introduce multipath route
Closes #12541.
2019-12-18 22:12:57 +09:00
Yu Watanabe 572b21d96c network: make Name= in [Match] support alternative names of interfaces 2019-12-16 10:55:56 +09:00
Yu Watanabe 2e048b14eb
Merge pull request #13915 from ddstreet/ipv6_mtu
Set ipv6 mtu after link-up or device mtu change
2019-12-13 18:33:04 +09:00
Susant Sahani 051e77cac1 network: introduce DAD for static address
Closes #2527.
2019-12-06 23:29:07 +09:00
Yu Watanabe 2c7b826ddf network: do not drop foreign config if interface is in initialized state
If the interface is in initialized state, no network file is assigned to
the interface. If an interface is not managed by networkd, previously,
the foreign configs of the interface was dropped.

Fixes #14250.
2019-12-06 12:27:47 +01:00
Dan Streetman d236718c16 network: set ipv6 mtu after link-up or device mtu change
The kernel resets the ipv6 mtu after NETDEV_UP or NETDEV_CHANGEMTU event,
so we must reset the ipv6 mtu to our configured value after we detect
IFF_UP flag set or after we set the device mtu.

Fixes: #13914.
2019-12-05 17:49:47 -05:00
Yu Watanabe ec34e7d1ab
Merge pull request #14229 from yuwata/nspawn-network-interface-14223
nspawn: do not fail if udev is not running
2019-12-05 16:10:29 +09:00
Yu Watanabe bf331d8717 network: if /sys is rw, then udev should be around
This switches detect_container() to path_is_read_only_rw("/sys"), as if
systemd-udevd.service is conditionalized with that way.

This also updates the log message.
2019-12-05 08:22:52 +09:00
Yu Watanabe edc54f2f75 network: rename QDiscs to QDisc 2019-12-04 20:57:01 +09:00
Yu Watanabe 5ecb131d94 network: include NLMSGERR_ATTR_MSG attribute in error message 2019-11-30 16:14:02 +09:00
Yu Watanabe 737f140546 network: cleanup header inclusion 2019-10-30 22:23:43 +09:00
Yu Watanabe 4ecdcb07c9 network: wait for QDiscs to be configured 2019-10-30 09:33:51 +09:00
Susant Sahani 0f5bd7fe24 network: introduce TrafficControl
Add network delay to a interface
2019-10-30 09:33:51 +09:00
Yu Watanabe 78404d22cc network: support matching based on wifi interfece type 2019-10-25 16:43:18 +09:00
Yu Watanabe 99b8517ca7 network: introduce Reconfigure() bus method 2019-10-24 14:20:48 +09:00
Yu Watanabe 277ba8d1ab network: add support matching based on BSSID= 2019-10-15 01:59:56 +09:00