Commit Graph

936 Commits

Author SHA1 Message Date
Susant Sahani 0a9fb9bad8 network: Allow to set device's receive queues and transmit queues 2021-01-05 12:46:28 +09:00
Yu Watanabe 0b81225e57 network: drop unnecessary routing policy rules
networkd already drop foreign address, routes, and nexthops on startup,
except those created by kernel. However, previously, routing policy
rules were not. The logic of serialization/deserialization of rules only
works for rules created by previous invocation of networkd, and does not
work for one created by other tools like `ip rule`.

This makes networkd drop foreign routing policy rules except created by
kernel on startup. Also, remove rules created by networkd when the
corresponding links are dropped or networkd is stopping.
2020-12-29 16:13:54 +09:00
Susant Sahani 937e305e93 network: Allow to configure interface promiscuous mode 2020-12-15 20:25:08 +00:00
Zbigniew Jędrzejewski-Szmek f8dd40779a
network: adjust comments
Co-authored-by: Carlo Teubner <435950+c4rlo@users.noreply.github.com>
2020-12-11 11:39:16 +01:00
Yu Watanabe 8bceafa777 network: do not reconfigure interface when the link gains carrier but udev not initialized it yet
When an interface gains carrier but udev have not initialized the
interface or link_initialized_handler() has not been called yet,
then link_configure will be called twice. Thus LLDP client will be
configured twice, and triggers assertion.

Fixes #17929.
2020-12-11 12:27:27 +09:00
Yu Watanabe 59c31eba49 network: stop to assign UUID when reconfiguring link
This fixes the following race in reconfiguring link:
1. an interface requests UUID.
2. the interface is reconfigured and link_configure() is called.
3. sd-lldp client is started on the interface (it is enabled by default).
4. networkd acquires UUID, and get_product_uuid_handler() calls
   link_configure() for the link again.
5. link_lldp_rx_configure() fails to set ifindex for already running
   sd-lldp client.
6. the link enters failed state.
2020-12-02 20:31:39 +09:00
Yu Watanabe 0d0799daf4 network: treat IPv4LL is one of dynamic addressing protocol
This makes an IPv4LL address optional when multiple dynamic
addressing protocols are enabled.
2020-11-30 12:41:41 +09:00
Yu Watanabe 0b4b66cc53 network: simplify the condition about ipv4ll is enabled or not 2020-11-30 12:41:41 +09:00
Yu Watanabe d19b993983 network: shorten link_check_ready() a bit 2020-11-30 12:41:41 +09:00
Zbigniew Jędrzejewski-Szmek 0107b769b1 networkd: start ipv4ll when dhcp has trouble getting a lease
Fixes #13316.
2020-11-30 12:37:36 +09:00
Zbigniew Jędrzejewski-Szmek 3ca1fab70a networkd: merge ll addressing fallback modes into normal "boolean" values
They are not really boolean, because we have both ipv4 and ipv6, but
for each protocol we have either unset, no, and yes.

From https://github.com/systemd/systemd/issues/13316#issuecomment-582906817:
LinkLocalAddressing must be a boolean option, at least for ipv4:
- LinkLocalAddressing=no => no LL at all.

- LinkLocalAddressing=yes + Static Address => invalid configuration, warn and
  interpret as LinkLocalAddressing=no, no LL at all.

(we check that during parsing and reject)

- LinkLocalAddressing=yes + DHCP => LL process should be subordinated to the
  DHCP one, an LL address must be acquired at start or after a short N
  unsuccessful DHCP attemps, and must not stop DHCP to keeping trying. When a
  DHCP address is acquired, drop the LL address. If the DHCP address is lost,
  re-adquire a new LL address.

(next patch will move in this direction)

- LinkLocalAddressing=fallback has no reason to exist, because LL address must
  always be allocated as a fallback option when using DHCP. Having both DHCP
  and LL address at the same time is an RFC violation, so
  LinkLocalAdressing=yes correctly implemented is already the "fallback"
  behavior. The fallback option must be deprecated and if present in older
  configs must be interpreted as LinkLocalAddressing=yes.

(removed)

- And for IPv6, the LinkLocalAddress option has any sense at all? IPv6-LL
  address aren't required to be always set for every IPv6 enabled interface (in
  this case, coexisting with static or dynamic address if any)? Shouldn't be
  always =yes?

(good question)

This effectively reverts 29e81083bd. There is no
special "fallback" mode now, so the check doesn't make sense anymore.
2020-11-30 12:37:36 +09:00
Yu Watanabe dca63b5b46
Merge pull request #17474 from yuwata/network-drop-link-deserialization-logic
network: drop link deserialization logic
2020-11-27 09:08:01 +09:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Timo Rothenpieler 14b66dbc92 dhcp4: fix DHCP on InfiniBand interfaces
With these patches applied, networkd is successfully able to get an
address from a DHCP server on an IPoIB interface.

1)
Makes networkd pass the actual interface type to the dhcp client,
instead of hardcoding it to Ethernet.

2)
Fixes some issues in handling the larger (20 Byte) IB MAC addresses in
the dhcp code.

3)
Add a new field to networkds Link struct, which holds the interface
broadcast address.

3.1)
Modify the DHCP code to also expect the broadcast address as parameter.
On an Ethernet-Interface the Broadcast address never changes and is always
all 6 bytes set to 0xFF.
On an IB one however it is not neccesarily always the same, thus
fetching the actual address from the interface is neccesary.

4)
Only the last 8 bytes of an IB MAC are stable, so when using an IB MAC to
generate a client ID, only pass those 8 bytes.
2020-10-28 14:44:43 +01:00
Timo Rothenpieler b8162cd200 network: store full hardware address in Link struct
This passes the legacy ethernet address to functions in a lot of places,
which all will need migrated to handle arbitrary size hardware addresses
eventually.
2020-10-28 14:44:43 +01:00
Yu Watanabe 61eb77c4b6 network: drop link_load()
The link state file does not exist, as it is always removed on stop.
2020-10-28 18:16:01 +09:00
Yu Watanabe 6fdcef2174 network: do not serialize/deserialize routes
The same as the previous commit. These are not used.
2020-10-28 18:16:01 +09:00
Yu Watanabe 7b829a7b3b network: do not serialize/deserialize addresses
The link state file is always removed when networkd is stopping. So,
the deserialization logic does not work. Moreover, the ADDRESSES=
entry is not used by sd-network, so serialization is also not necessary.
2020-10-28 18:15:57 +09:00
Yu Watanabe ca97e7cda0 network: do not serialize/deserialize ipv4ll address
The link state file is always removed on stop. So, we cannot deserialize
the address from the file. Moreover, currently the IPv4 link-local address
is always dropped by link_drop_foreign_addresses() on restart. Let's
drop the serialize/deserialize logic for IPv4 LL address.
2020-10-28 15:46:09 +09:00
Yu Watanabe 3def88503a network: set previous DHCP4 address in link->addresses_foreign
Previously, the address was taken from the state file, but DHCP4_ADDRESS=
entry was dropped by 46986251d6.
Moreover, the link state file is always removed when networkd is
stopping. Let's take the address from the list of enumerated addresses.
2020-10-28 15:44:05 +09:00
Timo Rothenpieler d0c4275c21 network: actually update radv mac 2020-10-27 18:01:22 +01:00
Dan Streetman e16e4b3bed network: move set-MAC and set-nomaster operations out of link_up()
These should not be bundled into the link_up() operation, as that is
not (currently) called during interface configuration if the interface
already is IFF_UP, which is unrelated to the need to change the mac
to a user-defined value, or set 'nomaster' on the interface.

Additionally, there is no need to re-set the mac or re-assert nomaster
every time the interface is brought up; those should be only part of
normal initial interface configuration.

Fixes: #17391
2020-10-23 12:09:31 +09:00
Yu Watanabe 7abe175c00 network: also unref IPv4 ACD clients in Address objects
This should not change any behavior, as currently link_free_engines() is
always called after all addresses are dropped. But the function may be
used in other places in the future. So, let's also stop the clients.
2020-10-15 08:11:32 +09:00
Yu Watanabe 1c49487284 network: move link_lldp_emit_stop() to link_free_engines()
This should not change any behavior.
2020-10-15 08:06:04 +09:00
Yu Watanabe 9cc65242d7 network: also stop LLDP client in link_stop_engines() 2020-10-15 07:57:33 +09:00
Yu Watanabe 2a99eed02c network: stop DHCPv4 server in link_stop_clients()
Then, rename link_stop_clients() -> link_stop_engines().
2020-10-15 07:56:30 +09:00
Yu Watanabe 84add3cd2b network: drop conditions to check existence of each engine 2020-10-15 07:38:45 +09:00
Yu Watanabe fd8f865c9f
Merge pull request #17342 from yuwata/network-dhcp-ipv4-acd-fixes
network: fixes several issues in IPv4 DAD for DHCP4
2020-10-14 23:12:41 +09:00
Yu Watanabe 0e569a439a network: start dynamic addressing clients like DHCP after setting netdevs
The function link_acquire_conf() may make the link state 'configuring'
when DHCP6 PD is enabled. Previously link_acquire_conf() was called
before link_enter_join_netdev(), and thus the assertion in the function
might be triggered.

Fixes #17329.
2020-10-14 10:52:02 +02:00
Yu Watanabe a7df5cae54 network: also stop IPv4ACD client in link_stop_clients() 2020-10-14 15:38:29 +09:00
Yu Watanabe 10fa21c0dc network: move IPv4ACD client for DHCPv4 from Network to Link object
A .network file may matches multiple interfaces.
2020-10-14 15:38:29 +09:00
Yu Watanabe 8ff85383b4 network: voidify link_stop_clients() in link_enter_failed() 2020-10-14 15:38:29 +09:00
Yu Watanabe d93d655c40 network: update MAC address in IPv4 ACD clients
When the MAC address of a link is updated, an address on the link may
be under checking address duplication. Or, (currently such code is not
implemented yet, but) address duplication check may be restarted later.
For that case, the IPv4 ACD clients must use the new updated MAC address.
2020-10-07 02:59:34 +09:00
Yu Watanabe 490ccbd5e5 network: configure IPv4 DAD per link address
Previously, IPv4 DAD is configured in each Address object stored in
Network object. If a .network file matches multipe links, then it causes
an assertion. To prevent it, now IPv4 DAD is configured in each Address
object belogs to Link object.
2020-10-07 02:57:58 +09:00
Yu Watanabe 2ffd6d73f9 network: check feature is enabled in xxx_configure() 2020-10-07 02:50:51 +09:00
Yu Watanabe 51f5dfd8ba network: move link_enumerate_ipv6_tentative_addresses() 2020-10-07 02:50:51 +09:00
Yu Watanabe 5e0534f1c1 network: move sysctl related functions to networkd-sysctl.c 2020-10-07 02:50:51 +09:00
Yu Watanabe be9363ccab network: introduce radv_update_mac() 2020-10-07 02:50:51 +09:00
Yu Watanabe eebba6dc24 network: introduce dhcp6_update_mac() 2020-10-07 02:50:51 +09:00
Yu Watanabe d947f7f977 network: introduce dhcp4_update_mac() 2020-10-07 02:50:50 +09:00
Yu Watanabe a3adb4a6a2 network: introduce ipv4ll_update_mac() 2020-10-07 02:50:50 +09:00
Yu Watanabe 5460bde5c5 network: introduce link_serialize_dhcp6_client() 2020-10-07 02:50:50 +09:00
Yu Watanabe ca21a19a2e network: introduce link_serialize_ipv4ll() 2020-10-07 02:50:50 +09:00
Yu Watanabe daad60d19e network: introduce link_deserialize_ipv4ll() 2020-10-07 02:50:50 +09:00
Yu Watanabe 571eeba909 network: introduce link_deserialize_dhcp4() 2020-10-07 02:50:50 +09:00
Yu Watanabe f3a3ff2762 network: move link_configure_sr_iov() 2020-10-07 02:50:50 +09:00
Yu Watanabe 200543791a network: move link_configure_traffic_control() 2020-10-07 02:50:50 +09:00
Yu Watanabe 34d7f2c99e network: merge link_set_bridge_vlan() and br_vlan_configure() 2020-10-07 02:50:50 +09:00
Yu Watanabe 256c75fd1f network: move DUID related functions 2020-10-07 02:50:50 +09:00
Yu Watanabe 086b8853d1 network: move link_radv_enabled() 2020-10-07 02:50:50 +09:00