Commit Graph

790 Commits

Author SHA1 Message Date
Yu Watanabe 1678fbb3c5 network: split operational states into carrier and address states
This should not change any behavior. The new states will be exposed by
later commits.
2019-06-16 23:17:23 +09:00
Yu Watanabe 6a1af3d4ca network: split out DBus related prototypes to networkd-link-bus.h 2019-06-16 09:13:12 +09:00
Yu Watanabe bafa964144 network: read link specific sysctl value
This introduce link_sysctl_ipv6_enabled() and replaces
manager_sysctl_ipv6_enabled() with it.
2019-06-15 14:56:42 +02:00
Yu Watanabe 463797c104 network: skip to check dynamic addresses when ConfigureWithoutCarrier=yes
Otherwise, the interface cannot be in "configured" state, as ipv6 link local
addressing is enabled by default. Note that even if ConfigureWithoutCarrier=
is set, all dynamic configurations are checked when the interface has
carrier.
2019-06-14 05:25:35 +09:00
Yu Watanabe 7ef7e5509b network: ignore requested ipv6 routing policy rule when ipv6 is disabled by sysctl 2019-06-12 11:03:37 +09:00
Yu Watanabe c442331750 network: ignore requested ipv6 route when ipv6 is disabled by sysctl 2019-06-12 11:03:08 +09:00
Yu Watanabe 54a1a535bd network: ignore requested ipv6 addresses when ipv6 is disabled by sysctl 2019-06-12 11:02:33 +09:00
Yu Watanabe d03073ddcd network: assign new DHCP address before removing old lease address
Closes #12676.
2019-06-07 16:22:00 +09:00
Zbigniew Jędrzejewski-Szmek 2db18cdd46
Merge pull request #12738 from yuwata/network-routing-policy-cleanup
network: several cleanups for routing policy rule
2019-06-06 18:53:20 +02:00
Yu Watanabe db51778f85 network: make KeepConfiguration=static drop DHCP addresses and routes
Also, KeepConfiguration=dhcp drops static foreign addresses and routes.
2019-06-06 22:50:29 +09:00
Yu Watanabe 95355a281c network: add KeepConfiguration=dhcp-on-stop
The option prevents to drop lease address on stop.
By setting this, we can safely restart networkd.
2019-06-06 22:50:29 +09:00
Susant Sahani 7da377ef16 networkd: add support to keep configuration 2019-06-06 22:50:29 +09:00
Yu Watanabe 9f08a578a8 network: remove unused argument in routing_policy_rule_configure() 2019-06-04 16:23:18 +09:00
Zbigniew Jędrzejewski-Szmek c2babfc2f5 networkd: rewrite condition to make it easier to understand 2019-05-30 15:31:44 +02:00
Yu Watanabe d61e4c5b6e network: add nlmon support
nlmon is a Netlink monitor device.
2019-05-28 22:47:15 +09:00
Yu Watanabe cab042b843 network: make VXCAN devices go through LINK_STATE_CONFIGURING 2019-05-24 10:55:33 +09:00
Yu Watanabe 910feb787f network: unify link_ipv4ll_enabled() and link_ipv4ll_fallback_enabled() 2019-05-22 17:59:39 +09:00
Yu Watanabe a0ae96149a network: drop unused variable 2019-05-22 17:59:39 +09:00
Yu Watanabe bb262ef02b network: update master's ifindex in link_update()
And use it in link_is_enslaved().
2019-05-22 17:59:39 +09:00
Yu Watanabe 2292a4c6db network: drop duplicated logs
link_set_state() already logs about state change.
2019-05-22 17:58:46 +09:00
Yu Watanabe af9ba57aa2 network: make CAN devices go through LINK_STATE_CONFIGURING 2019-05-22 17:58:46 +09:00
Yu Watanabe f410d46358 network: disable IPv4LL for ipvlan with L3 or L3S mode
As L3 or L3S mode do not support ARP.
2019-05-22 17:58:46 +09:00
Yu Watanabe b26ea30801 network: tighten the condition whether link has carrier
ip command requires that IFF_RUNNING is set for that the link has
carrier.
2019-05-19 05:39:45 +09:00
Yu Watanabe a32a00831c
Merge pull request #12574 from yuwata/network-mtu-issue-12552
network: do not always bump MTU with additional 4bytes
2019-05-16 08:25:48 +02:00
Yu Watanabe fe0e16db09 network: do not use ordered_set_printf() for DOMAINS= or ROUTE_DOMAINS=
This partially reverts 5e2a51d588.

Fixes #12531.
2019-05-16 05:17:26 +02:00
Yu Watanabe f6fcc1c2a4 network: bump MTU bytes only when MTUByte= is not set 2019-05-16 11:51:03 +09:00
Yu Watanabe 933c70a0a4 network: honor MTUBytes= setting
Closes #12552.
2019-05-16 11:47:41 +09:00
Yu Watanabe af2fa2c116 network: disable link local addressing on ipip, gre, sit, and vti netdevs
Closes #12547.
2019-05-16 05:53:41 +09:00
Yu Watanabe 710ce9e537 network: link_check_ready() returns earlier if routes are not configured yet
link_request_set_routes() calls link_check_ready(), so it is not
necessary to continue that here.
2019-05-16 05:53:41 +09:00
Yu Watanabe d8f31d7d32
Merge pull request #12537 from yuwata/network-link-local-follow-ups
network: do not send ipv6 token to kernel
2019-05-14 02:22:18 +02:00
Yu Watanabe 9f6e82e6eb network: do not send ipv6 token to kernel
We disabled kernel RA support. Then, we should not send
IFLA_INET6_TOKEN.
Thus, we do not need to send IFLA_INET6_ADDR_GEN_MODE twice.

Follow-up for 0e2fdb83bb and
4eb086a387.
2019-05-12 07:32:00 +09:00
Yu Watanabe 86e2be7bc3 network: drop unnecessary initializations 2019-05-11 06:24:04 +09:00
Yu Watanabe 4799f19e30 network: move link_set_bond() to netdev/bond.c 2019-05-11 06:24:04 +09:00
Yu Watanabe 9a81f11956 network: move link_set_bridge to netdev/bridge.c 2019-05-11 06:24:04 +09:00
Yu Watanabe 3ddcbeea45 network: move CAN link related functions to networkd-can.c 2019-05-11 06:24:00 +09:00
Yu Watanabe 06d7cee589 network: make BindCarrier= work with CAN devices
If CAN device is set `BindCarrier=` then the interface could not be
down. This fixes the issue.
2019-05-11 06:21:43 +09:00
Yu Watanabe 8e54db83e2 network: make link_drop() can take custom handler
It will be used in the later commit.
2019-05-11 06:15:35 +09:00
Yu Watanabe 7f8539504c network: move sd_lldp related functions to networkd-lldp-rx.c 2019-05-11 06:14:39 +09:00
Susant Sahani be7468f07a LLDP: Fix logs for LLDP
```
May 10 11:08:54 test systemd-networkd[447]: wwan0: Failed to stop LLDP: Success
May 10 11:08:54 test systemd-networkd[447]: wwan0: Gained carrier
May 10 11:08:54 test systemd-networkd[447]: wwan0: Failed to start LLDP: Success
```
2019-05-11 06:14:39 +09:00
Yu Watanabe 0b20047244 network: move link_lldp_emit_enabled() to networkd-lldp-tx.c 2019-05-11 06:14:39 +09:00
Yu Watanabe 5af7bc6f4c
Merge pull request #12480 from ssahani/proxy-arp
network: bridge add support to configure proxy ARP/WIFI
2019-05-10 15:30:41 +02:00
Susant Sahani 8185ca6c0a networkd: Log error if LLDP fails to start/stop
Now LLDP does not log anything why it failed which
is hard to debug. Let's just add some logs.

https://github.com/systemd/systemd/issues/10881
2019-05-10 00:01:01 +02:00
Susant Sahani 0fadb2a46f network: add support to configure proxy ARP/WIFI 2019-05-09 15:03:04 +09:00
Susant Sahani 4eb086a387 networkd: fix link_up() (#12505)
Fillup IFLA_INET6_ADDR_GEN_MODE while we do link_up.

Fixes the following error:
```
dummy-test: Could not bring up interface: Invalid argument
```

After reading the kernel code when we do a link up
```
net/core/rtnetlink.c
IFLA_AF_SPEC
 af_ops->set_link_af(dev, af);
  inet6_set_link_af
   if (tb[IFLA_INET6_ADDR_GEN_MODE])
             Here it looks for IFLA_INET6_ADDR_GEN_MODE
```
Since link up we didn't filling up that it's failing.

Closes #12504.
2019-05-09 04:05:35 +02:00
Yu Watanabe 9aa5d8ba84 network: include glibc headers before including kernel headers 2019-05-09 03:21:31 +02:00
Yu Watanabe 004aadcacd network: replace inet_pton() with in_addr_from_string() 2019-05-09 01:44:31 +02:00
Susant Sahani 1087623bac networkd: Add support to configure proxy ARP and proxy ARP Wifi 2019-05-09 01:44:26 +02:00
Lennart Poettering b2adc2ae3a
Merge pull request #12501 from keszybz/silence-strncpy-warnings
Silence strncpy warnings
2019-05-08 01:39:32 +02:00
Yu Watanabe 2c448c8a17 network: fix use-after-free
The function sd_radv_add_prefix() in dhcp6_pd_prefix_assign() may
return -EEXIST, and in that case the sd_radv_prefix object allocated
in dhcp6_pd_prefix_assign() will be freed when the function returns.
Hence, the key value in Manager::dhcp6_prefixes hashmap is lost.
2019-05-07 16:55:19 +02:00
Yu Watanabe f535e35417 network: simplify link_free() 2019-05-07 16:55:19 +02:00
Yu Watanabe c9c908a60d network: make Link objects take references of Network objects 2019-05-07 16:55:19 +02:00
Zbigniew Jędrzejewski-Szmek c98b354500 network: remove redunant link name in message
Fixes #12454.

gcc was complaining that the link->ifname argument is NULL. Adding
assert(link->ifname) right before the call has no effect. It seems that
gcc is confused by the fact that log_link_warning_errno() internally
calls log_object(), with link->ifname passed as the object. log_object()
is also a macro and is does a check whether the passed object is NULL.
So we have a check if something is NULL right next an unconditional use
of it where it cannot be NULL. I think it's a bug in gcc.

Anyway, we don't need to use link->ifname here. log_object() already prepends
the object name to the message.
2019-05-07 13:46:55 +02:00
Susant Sahani 946f8e14d5 networkd: stop clients when networkd shuts down (#12463)
We not stopping the clients when networkd stops. They
should shut down cleanly and then we need to clean the DS.

One of requirements to implement
https://github.com/systemd/systemd/issues/10820.

```
^CBus bus-api-network: changing state RUNNING → CLOSED
DHCP SERVER: UNREF
DHCP SERVER: STOPPED
DHCP CLIENT (0x60943df0): STOPPED
veth-test: DHCP lease lost
veth-test: Removing address 192.168.5.31
NDISC: Stopping IPv6 Router Solicitation client
DHCP CLIENT (0x0): FREE
==24308==
==24308== HEAP SUMMARY:
==24308==     in use at exit: 8,192 bytes in 2 blocks
==24308==   total heap usage: 4,230 allocs, 4,228 frees, 1,209,732 bytes allocated
==24308==
==24308== LEAK SUMMARY:
==24308==    definitely lost: 0 bytes in 0 blocks
==24308==    indirectly lost: 0 bytes in 0 blocks
==24308==      possibly lost: 0 bytes in 0 blocks
==24308==    still reachable: 8,192 bytes in 2 blocks
==24308==         suppressed: 0 bytes in 0 blocks
==24308== Rerun with --leak-check=full to see details of leaked memory
==24308==
==24308== For lists of detected and suppressed errors, rerun with: -s
==24308== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==24308== could not unlink /tmp/vgdb-pipe-from-vgdb-to-24308-by-sus-on-Zeus
==24308== could not unlink /tmp/vgdb-pipe-to-vgdb-from-24308-by-sus-on-Zeus
==24308== could not unlink /tmp/vgdb-pipe-shared-mem-vgdb-24308-by-sus-on-Zeus

```
2019-05-06 16:06:50 +02:00
Yu Watanabe 6c0c041a8e network: make link_check_ready() handle LinkLocalAddressing=fallback 2019-05-04 16:46:02 +02:00
Yu Watanabe 552081a499 network: rewrite condition about DHCP in link_check_ready() 2019-05-04 16:46:02 +02:00
Susant Sahani 8bc17bb3f7 networkd: Option to use LinkLocalAddressing only when DHCP fails
When LinkLocalAddressing=fallback or LinkLocalAddressing=ipv4-fallback
then IPv4LL will be started only when DHCP fails.

Closes #9648.
2019-05-04 16:45:57 +02:00
Yu Watanabe b9ea3d2e47 network: fix assertion when link get carrier
This fixes a bug introduced by bd08ce5615.
When link is in LINK_STATE_INITIALIZED, `Link::network` may not be
set yet.

Fixes #12452.
2019-05-03 01:14:36 +02:00
Susant Sahani b5799eeb07 networkd: Add back static routes after DHCPv4 lease expires.
1. When the DHCPv4 lease expires kernel removes the route. So add it back
when we gain lease again.

Closes https://github.com/systemd/systemd/issues/12426

2. When UseRoutes=false do not remove router
2019-04-29 18:13:31 +02:00
Ben Boeckel 5238e95759 codespell: fix spelling errors 2019-04-29 16:47:18 +02:00
Yu Watanabe 51aba17b88 network: drop invalid assertion
The link may not have corresponding .network file.
Note that in that case, link_ipv4ll_enabled() and link_dhcp4_enabled()
returns false. So, it is safe to drop the assertion.

Fixes #12422.
2019-04-28 19:54:50 +02:00
Zbigniew Jędrzejewski-Szmek 4232cf049f network: drop "return 1" when the return value is ignored by all callers
The reader is tricked into thinking that this has some meaning...
2019-04-25 11:13:39 +02:00
Yu Watanabe 5f707e1280 network: fix ref/unref logic for Link object
- bridge or bonding master takes a reference of slave links.
- drop link from bridge or bonding master's slave list when slave link
  is removed.
- change type of Link::slaves to Set*,

Fixes #12315.
2019-04-25 10:47:17 +02:00
Yu Watanabe bd08ce5615 network: prevent interfaces to be initialized multiple times
When a uevent is received during the relevant interface is in
LINK_STATE_PENDING, then the interface may be initialized twice.
To prevent that, this introduces LINK_STATE_INITIALIZED.
2019-04-25 10:44:46 +02:00
Yu Watanabe 0beb9542e9 network: logs link state change 2019-04-17 19:41:50 +09:00
Zbigniew Jędrzejewski-Szmek 41f6e627d7 Make fopen_temporary and fopen_temporary_label unlocked
This is partially a refactoring, but also makes many more places use
unlocked operations implicitly, i.e. all users of fopen_temporary().
AFAICT, the uses are always for short-lived files which are not shared
externally, and are just used within the same context. Locking is not
necessary.
2019-04-12 11:44:56 +02:00
Lennart Poettering 6990fb6bc6 tree-wide: (void)ify a few unlink() and rmdir()
Let's be helpful to static analyzers which care about whether we
knowingly ignore return values. We do in these cases, since they are
usually part of error paths.
2019-03-27 18:09:56 +01:00
Yu Watanabe 7033af49df network: introduce new netdev create type NETDEV_CREATE_AFTER_CONFIGURED
It will be used to support L2TP tunnel in later commits.
2019-03-14 10:57:41 +09:00
Yu Watanabe 2b6db913e2 network: do not call link_joined() when not all netdevs are configured
If some of stacked netdevs are already configured, then link_joined()
is called before netdevs are fully configured.
2019-03-14 10:57:41 +09:00
Tobias Jungel 7f15b71460 networkd: Add bridge port capabilities
This PR adds the configuration switches for multicast flooding, neighbor
suppression and learning of a bridge port.
2019-03-13 16:27:22 +01:00
Yu Watanabe 4ac77d63e9 network: make RequiredForOnline= also take operational state
This will be used by systemd-networkd-wait-online.
2019-03-13 14:29:03 +09:00
Yu Watanabe c9cc038343 network: introduce 'degraded-carrier' operstate to order all states
Previously, 'degraded' state is ambiguous for bonding or bridge master:
1. one or more slave interfaces does not have carrier,
2. no link local address is assigned to the master,
3. combination of the above two.

This makes the above case 1 and 3 are in the new 'degraded-carrier'
state, and makes 'degraded' state as all slaves are active but no
link local address on master.
2019-03-13 14:29:00 +09:00
Yu Watanabe 2cd6b9326c network: move LinkOperationalState and relevant functions to network-util.[ch] 2019-03-13 14:28:38 +09:00
Clemens Gruber c423be28a0 network: introduce TripleSampling= option in CAN section
When enabled, three samples are used to determine the value of a
received bit by majority rule.

This patch adds support for the TripleSampling= option in the [CAN]
section of .network files.
2019-03-11 17:15:47 +01:00
Yu Watanabe 299ad32d48 network: do not configure interfaces under renaming 2019-03-05 10:33:42 +09:00
Yu Watanabe 30de2b89d1 network: always drop configs when interface is renamed
Before the renaming, wrong .network file may be assigned to the link.
So, let's always drop link configuration.
2019-03-05 10:33:27 +09:00
Yu Watanabe 40288ecea1 network: bump mtu if stacked vlan or macvlan requests larger size
Closes #5972.
2019-02-27 10:04:56 +09:00
Yu Watanabe 45e11abfff network: make bridge master also follow operstates of slave interfaces
If one of bridge slaves is in off, no-carrier, or dormant, then
operstate of the bridge master is set to degraded.
2019-02-25 09:34:14 +09:00
Yu Watanabe 34bf3c0051 network: extend 'enslaved' state to bridge slave interfaces
Currently, the interface's operstate is set to 'enslaved' only when
it is managed by networkd.
2019-02-25 09:34:14 +09:00
Yu Watanabe b102cdca6b network: do not disable dynamic addressing for bridge slaves
This effectively reverts 5971cb9de9 and
2b00a4e03d.

Usually, it is not necessary to assign addresses to bridge slaves,
but such functionality is supported by kernel. If users explicitly
request such configuration, networkd should support that.
2019-02-25 09:34:14 +09:00
Yu Watanabe 033295c188 network: fix invalid memory access
This fixes a bug introduced by 959f65d32e.
2019-02-25 09:34:14 +09:00
Lennart Poettering 953a1af082
Merge pull request #11776 from keszybz/networkd-ordered-sets
Store domains lists in OrderedSets in networkd
2019-02-21 15:15:11 +01:00
Zbigniew Jędrzejewski-Szmek 5e2a51d588 networkd: use OrderedSets instead of strvs to store lists of domains
We were already using OrderedSets in the manager object, but strvs in the
configuration parsing code. Using sets gives us better scaling when many
domains are used.

In oss-fuzz #13059 the attached reproducer takes approximately 30.5 s to be
parsed. Converting to sets makes this go down to 10s. This is not _vastly_
faster, but using sets seems like a nicer approach anyway. In particular, we
avoid the quadratic de-unification operation after each addition.
2019-02-21 12:04:27 +01:00
Yu Watanabe 4b600505dd network: check whether ipv6 is enabled in sysctl
Currently, the value is read only once.

Fixes #11711.
2019-02-21 10:55:13 +09:00
Yu Watanabe 826a3602d8 network: use sysctl_read_ip_property() 2019-02-21 10:38:10 +09:00
Yu Watanabe 62e021a95d network: use sysctl_write_ip_property() and friends 2019-02-21 10:38:10 +09:00
Thomas Haller 072320eab0 dhcp: move filtering of bogus DNS/NTP addresses out of DHCP client
The DHCP client should not pre-filter addresses beyond what RFC
requires. If a client's user (like networkd) wishes to skip/filter
certain addresses, it's their responsibility.

The point of this is that the DHCP library does not hide/abstract
information that might be relevant for certain users. For example,
NetworkManager exposes DHCP options in its API. When doing that, the
options should be close to the actual lease.

This is related to commit d9ec2e632d
(dhcp4: filter bogus DNS/NTP server addresses silently).
2019-02-18 13:34:22 +01:00
Lennart Poettering 1cfece4a45
Merge pull request #11681 from yuwata/network-link-enslaved-operstate
network: introduce new 'enslaved' operstate
2019-02-18 13:00:13 +01:00
Lennart Poettering 702451b038
Merge pull request #11698 from yuwata/fix-network-route-table
network: honor specified route table
2019-02-18 12:58:32 +01:00
Yu Watanabe 959f65d32e network: make bond master follow operstates of slaves
If one of bond slaves is in off, no-carrier, or dormant, then
bond master is set to degraded.
2019-02-18 18:04:11 +09:00
Yu Watanabe 25e992ba23 network: always drop configs when corresponding network file does not exist
Follow-up for 93b4dab57e.

Fixes #11724.
2019-02-18 06:11:50 +09:00
Yu Watanabe 89b9a97573 network: disable link local addressing on vrf
See the commment in vrf_link_scope_lookup() in drivers/net/vrf.c of
Linux kernel.
2019-02-17 01:15:23 +09:00
Yu Watanabe 14153d1b6e network: introduce new operational state 'enslaved'
If an interface has IFF_SLAVE flag, then its operational state becomes
not in 'degraded' or 'carrier', but the new 'enslaved' state.
2019-02-16 07:15:49 +09:00
Yu Watanabe 7fcee28417 network: introduce specific netlink async handler for link_set_bond()
This also rename link_bond_set() to link_set_bond().
2019-02-16 07:15:49 +09:00
Yu Watanabe f2bfcdb94a network: disable addressing on bond slave interface 2019-02-16 07:15:49 +09:00
Lennart Poettering 8e6b3f49fe
Merge pull request #11636 from yuwata/network-in-addr-is-null
network, sd-netlink: unify several functions and fixes coding style
2019-02-15 11:40:34 +01:00
Lennart Poettering 19df3047f3
Merge pull request #9262 from ssahani/ignore-carrier-9111
networkd: allow to retain configs even if carrier is lost
2019-02-15 11:35:43 +01:00
Yu Watanabe bdb9f58086 network: honor VRF table or explicitly specified route table 2019-02-15 11:45:39 +09:00
Susant Sahani 0e2fdb83bb networkd: honour LinkLocalAddressing
Closes #9890
2019-02-13 02:36:15 +09:00
Yu Watanabe 3f7cc0809d network: coding style fixes 2019-02-11 01:28:09 +09:00
Susant Sahani 93b4dab57e networkd: Allow to retain configs even if carrier is lost
When there is bad link in the network the carrier goes up/down.
This makes networkd stops all the clients and drop config.
But if the remote router/dhcpserver running a prevention
of DHCP Starvation attack or DHCP Flood attack it does not allow
networkd to take a DHCP lease resulting failure in configuration.
This patch allows to keep the client running and keep the conf
also for this scenario.

Closes #9111
2019-02-06 13:35:11 +01:00
Lennart Poettering 7c45deb20d
Merge pull request #11460 from yuwata/fix-11458
network: update address when static address was already configured by DHCP
2019-01-26 15:41:06 +01:00
Yu Watanabe 1cc84f3bb9 network: make link_up() static 2019-01-24 12:07:41 +09:00
Lennart Poettering a8ea2833cf
Merge pull request #11375 from daxtens/issue5882
network: Fix IPv6 PreferredSource routes
2019-01-17 18:08:01 +01:00
Yu Watanabe a47a6daebe network: update address when static address was already configured by DHCP
Fixes #11458.
2019-01-17 14:16:21 +09:00
Daniel Axtens 6aa5773bff Install routes after addresses are ready
If an IPv6 route is added with a source address that is still
tentative, the kernel will refuse to install it.

Previously, once we sent the messages to the kernel to add the
addresses, we would immediately proceed to add the routes. The
addresses would usually still be tentative at this point, so
adding static IPv6 routes was broken - see issue #5882.

Now, only begin to configure routes once the addresses are ready,
by restructuring the state machine, and tracking when addresses are
ready, not just added.

Fixes: #5882
Signed-off-by: Daniel Axtens <dja@axtens.net>
2019-01-16 12:54:06 +11:00
Yu Watanabe 9e2bbf9915 network: make Link and NetDev always have the valid poiter to Manager
c4397d94c3 introduces
link_detach_from_manager() and netdev_detach_from_manager(), and they
set Link::manager or NetDev::manager NULL.
But, at the time e.g. link is removed, hence link_drop() is called,
there may be still some asynchronous netlink call is waiting, and
their callbacks hit assertion.

This make {link,netdev}_detach_from_manager() just drop all references
from manager, but keep the pointer to manager.

Fixes #11411.
2019-01-15 14:48:53 +01:00
Daniel Axtens 6accfd3139 Move link_check_ready() to later in the file
We're about to need it to be later in the file for the next commit.
Moving it now means that when we change it in the next commit, it's
not intermingled with the move.

No functional change intended.

Signed-off-by: Daniel Axtens <dja@axtens.net>
2019-01-10 11:01:57 +11:00
Yu Watanabe 2428613f85 network: set *_configured flags to false before requesting addresses or freinds
Fixes #11272.
2019-01-02 18:37:10 +09:00
Yu Watanabe 47079967e6 network: rename link_set_routing_policy_rule() to link_request_set_routing_policy_rule()
For consistency to other functions.
2019-01-02 18:37:10 +09:00
Yu Watanabe f3ef324dfa network: do not ignore errors on link_request_set_neighbors() and link_set_routing_policy() 2019-01-02 18:37:10 +09:00
rogerjames99 7da7340afd Do not start server if it is already runnning (#11245) 2018-12-28 15:34:43 +09:00
Lennart Poettering 7ece6f5897 networkd: permit DNS "DefaultRoute" configuration in .network files 2018-12-21 12:10:07 +01:00
Thomas Haller 8217ed5ec3 network: fix handling of uninitialized and zero IAID setting
An earlier commit 0e408b82b (dhcp6-client: handle IAID with value zero)
introduced a flag to sd_dhcp6_client to distinguish between an unset
IAID and a value set to zero.

However, that was not sufficient and broke leaving the setting
uninitialized in networkd configuration. The configuration parsing
also must distinguish between the default, unset value and an
explict zero configuration.

Fixes: 0e408b82b8
2018-12-10 14:25:28 +01:00
William A. Kennington III e4a71bf36f networkd: Static neighbor support
When using networkd we currently have no way of ensuring that static
neighbor entries are set when our link comes up. This change adds a new
section to the network definition that allows multiple static neighbors
to be set on a link.
2018-12-09 16:56:37 -08:00
William A. Kennington III 289e6774d0 networkd: Use only a generic CONFIGURING state
This allows us to convey that we are performing multiple link
configuration changes in parallel. This is needed to support configuring
neighbors while simultaneously configuring addresses and routes.
2018-12-09 16:56:00 -08:00
William A. Kennington III c42ff3a1a7 networkd: Track address configuration
This will be useful to assert that our static route configuration always
happens after address configuration once our individual configure state
goes away.
2018-12-09 16:54:37 -08:00
Yu Watanabe f0a43eb821
Merge pull request #11063 from yuwata/update-missing-v3
missing: split missing.h into small pieces
2018-12-06 16:54:27 +01:00
Yu Watanabe ef118d00eb util: drop missing.h from socket-util.h 2018-12-06 13:31:16 +01:00
Susant Sahani d3aa8b49e5 networkd: bridge add support to configure multicast_to_unicast
closes #10649
2018-12-03 23:49:46 +05:30
Lennart Poettering a20f73221a
Merge pull request #10976 from yuwata/typesafe-netlink-call
netlink: introduce typesafe netlink functions
2018-12-03 17:55:00 +01:00
Lennart Poettering 686d13b9f2 util-lib: split out env file parsing code into env-file.c
It's quite complex, let's split this out.

No code changes, just some file rearranging.
2018-12-02 13:22:29 +01:00
Lennart Poettering e4de72876e util-lib: split out all temporary file related calls into tmpfiles-util.c
This splits out a bunch of functions from fileio.c that have to do with
temporary files. Simply to make the header files a bit shorter, and to
group things more nicely.

No code changes, just some rearranging of source files.
2018-12-02 13:22:29 +01:00
Yu Watanabe 302a796f5a network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
Yu Watanabe 4645ad47ac network: use route_remove_handler() as the default callback of route_remove() 2018-12-02 06:23:45 +01:00
Yu Watanabe 63ae056909 network: use address_remove_handler() as the default callback of address_remove() 2018-12-02 06:23:45 +01:00
Yu Watanabe 29889b4d24 network: set default callbacks for routing_policy_rule_configure() and routing_policy_rule_remove() 2018-12-02 06:23:45 +01:00
Yu Watanabe cccf9517f1 network: move address_label_handler() to networkd-address-label.c
And use it as the default callback function of address_label_configure().
2018-12-02 06:23:45 +01:00
Lennart Poettering bf61b05a06 networkd: slightly rework route establishment logic
Use a for() loop to merge the two very similar loops into one, and add
more comments explaining the logic behing this.

Follow-up for 0d34228fc0
2018-11-29 13:38:54 +09:00
Yu Watanabe fab57f7f13
Merge pull request #10948 from ssahani/iprule-port-proto
networkd: add support to configure ip rule port range and protocol.
2018-11-29 03:17:36 +09:00
Susant Sahani 926062f083 networkd: add support to configure ip rule port range and protocol.
Please see:

iprule: support for ip_proto, sport and dport match options
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=f686f764682745daf6a93b0a6330ba42a961f858

Closes 10622
2018-11-28 20:06:28 +05:30
Susant Sahani 0d34228fc0 fix: systemd-networkd reverse route ordering
We missing a default route. Add gateway first.

This fixes https://github.com/systemd/systemd/issues/5430
2018-11-28 23:19:00 +09:00
Lennart Poettering 13df9c398d fileio: automatically add NULL sentinel to parse_env_file()
Let's modernize things a bit.
2018-11-14 17:01:55 +01:00
Lennart Poettering aa8fbc74e3 fileio: drop "newline" parameter for env file parsers
Now that we don't (mis-)use the env file parser to parse kernel command
lines there's no need anymore to override the used newline character
set. Let's hence drop the argument and just "\n\r" always. This nicely
simplifies our code.
2018-11-14 17:01:54 +01:00
Yu Watanabe 17f9c355d5 network: use structured initializers 2018-11-12 16:32:10 +09:00
Lennart Poettering b992109b3e
Merge pull request #10633 from yuwata/sd-resolve-destroy
Another solution to fix wireguard issues
2018-11-06 19:30:59 +03:00
Lennart Poettering a0ca258adf
Merge pull request #10597 from toanju/fix-networkd-l3-loss
networkd: don't remove ip address or route
2018-11-06 17:44:24 +03:00
Tobias Jungel 7ecf0c3e17 networkd: don't remove route
In case networkd is restarted this prevents a removal of an already existing
route that would be configured using networkd. With the proposed changes the
route will be kept on the interface without removing. This happens only on
physical hosts or VMs since networkd handles interface configuration slightly
different in containers.
2018-11-06 13:28:12 +01:00
Tobias Jungel 30226d2718 networkd: don't remove ip address
In case networkd is restarted this prevents a removal of an already existing IP
address that would be configured using networkd. With the proposed changes the
IP address will be kept on the interface without removing. This happens only on
physical hosts or VMs since networkd handles interface configuration slightly
different in containers.
2018-11-06 13:26:37 +01:00
Yu Watanabe 57512c893e tree-wide: set WRITE_STRING_FILE_DISABLE_BUFFER flag when we write files under /proc or /sys 2018-11-06 21:24:03 +09:00
Yu Watanabe c4397d94c3 network: link_drop() and netdev_drop() remove reference from manager 2018-11-05 13:19:02 +09:00
Yu Watanabe e6b65ab760 network: fix return value of routing_policy_rule_get()
To distinguish source of rule.
2018-11-01 23:38:11 +09:00
Yu Watanabe 5a937ea2f6 sd-device: make sd_device_get_is_initialized() returns is_initialized by return value 2018-10-29 17:33:33 +09:00
Tobias Jungel cbff717048 networkd: keep bond slave up if already attached
There is no need to disable an already correct enslaved interface.

relates to #10118
2018-10-19 23:00:52 +02:00
Yu Watanabe 8190a388a6 sd-netlink: make sd_netlink_slot take its description 2018-10-16 18:42:23 +09:00
Yu Watanabe ee38400bba sd-netlink: introduce sd_netlink_slot 2018-10-15 18:10:04 +09:00
Yu Watanabe 0ae286e697 network: make netlink callbacks return 1
This is not necessary. But most of netlink callbacks in networkd
return 1.
2018-10-10 14:43:05 +09:00
Yu Watanabe 26d6b2147e network: drop break line in comment 2018-10-10 14:43:05 +09:00
Yu Watanabe e6bf77744a network: make netlink callback not return negative value
Fixes #10320.
2018-10-10 14:43:05 +09:00
Yu Watanabe 1046bf9b1a network: add destroy callbacks for asynchronous netlink calls 2018-10-10 14:43:05 +09:00
Yu Watanabe 545bab1f0a sd-netlink: add destroy_callback argument to sd_netlink_call_async() 2018-10-10 14:43:05 +09:00