Commit graph

438 commits

Author SHA1 Message Date
Mantas Mikulėnas c436d55397
networkd: do not drop config for unmanaged interfaces
Flushing foreign configuration for unmanaged interfaces is outright
evil, especially when it's a regular occurence with Wi-Fi.

Fixes: 3104883ddc "networkd: remove route if carrier is lost"
Ref: #3831
2016-08-25 13:25:08 +03:00
Zbigniew Jędrzejewski-Szmek b68d26b8cd networkd: fix typo (#4013) 2016-08-21 19:15:26 +02:00
Zbigniew Jędrzejewski-Szmek 1ed1f50f82 networkd: do not set NOARP unconditionally (#3891)
Fixes #3890.
2016-08-05 10:37:10 +02:00
Tobias Jungel ffff9abe1d networkd: apply bridge vlan configuration correct
bridge vlan configuration was applied even if it wasn't configured.

fixes #3876
2016-08-04 17:14:18 +02:00
Susant Sahani 99d2baa2ca networkd: add support to configure NOARP/ARP for interface (#3854)
https://lists.freedesktop.org/archives/systemd-devel/2016-August/037268.html
2016-08-04 10:00:58 -04:00
Susant Sahani 3104883ddc networkd: remove route if carrier is lost (#3831)
Fixes #3669.
2016-08-04 09:56:39 -04:00
Zbigniew Jędrzejewski-Szmek 2d37cd5356 Add enable_disable() helper
In this patch "enabled" and "disabled" is used exclusively, but "enable" and
"disable" forms are need for the following patch.
2016-07-31 22:48:22 -04:00
Michael Biebl 595bfe7df2 Various fixes for typos found by lintian (#3705) 2016-07-12 12:52:11 +02:00
Torstein Husebø 61233823aa treewide: fix typos and remove accidental repetition of words 2016-07-11 16:18:43 +02:00
Andreas Rammhold 6cb955c6a1 networkd: vrf: add support for enslaving devices to VRFs 2016-06-16 00:25:06 +02:00
Susant Sahani 357bb46af6 networkd: fix NULL pointer (#3523)
Not every link has kind associated with it.

(gdb) r
Starting program: /home/sus/tt/systemd/systemd-networkd
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.23.1-7.fc24.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
vboxnet0: Gained IPv6LL
wlp3s0: Gained IPv6LL
enp0s25: Gained IPv6LL
Enumeration completed

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6e27ade in __strcmp_sse2_unaligned () from /lib64/libc.so.6
(gdb) bt
src/network/networkd-link.c:2008
src/network/networkd-link.c:2059
src/network/networkd-link.c:2442
m=0x555555704a30, userdata=0x55555570bfe0) at src/network/networkd-link.c:2497
at src/libsystemd/sd-netlink/sd-netlink.c:347
src/libsystemd/sd-netlink/sd-netlink.c:402
src/libsystemd/sd-netlink/sd-netlink.c:432
userdata=0x5555556f7470) at src/libsystemd/sd-netlink/sd-netlink.c:739
src/libsystemd/sd-event/sd-event.c:2275
src/libsystemd/sd-event/sd-event.c:2626
timeout=18446744073709551615) at src/libsystemd/sd-event/sd-event.c:2685
bus=0x5555556f9af0, name=0x555555692315 "org.freedesktop.network1",
timeout=30000000,
    check_idle=0x55555556ac84 <manager_check_idle>, userdata=0x5555556f6b20) at
src/shared/bus-util.c:134
src/network/networkd-manager.c:1128
src/network/networkd.c:127
(gdb) f 1
src/network/networkd-link.c:2008
2008            if (link->network->bridge || streq("bridge", link->kind)) {
(gdb) p link->kind
$1 = 0x0
2016-06-13 15:57:38 +02:00
Tobias Jungel ceac40781b networkd: cleanup of bridge vlan code (#3505)
cleanup minor nitpicks mentioned in #3428
2016-06-12 19:59:21 +02:00
Tobias Jungel 13b498f967 networkd: add support to configure VLAN on bridge ports 2016-06-10 09:10:41 +02:00
Tobias Jungel 6cad256dbe networkd-link: parse linkinfo to get kind 2016-06-09 21:42:05 +02:00
Tom Gundersen d9c11f2b01 Merge pull request #3431 from poettering/network-fixes
put limits on addresses and routers per link and per network
2016-06-08 23:10:16 +02:00
Lennart Poettering 1e7a0e21c9 network: beef up ipv6 RA support considerably
This reworks sd-ndisc and networkd substantially to support IPv6 RA much more
comprehensively. Since the API is extended quite a bit networkd has been ported
over too, and the patch is not as straight-forward as one could wish. The
rework includes:

- Support for DNSSL, RDNSS and RA routing options in sd-ndisc and networkd. Two
  new configuration options have been added to networkd to make this
  configurable.

- sd-ndisc now exposes an sd_ndisc_router object that encapsulates a full RA
  message, and has direct, friendly acessor functions for the singleton RA
  properties, as well as an iterative interface to iterate through known and
  unsupported options. The router object may either be retrieved from the wire,
  or generated from raw data. In many ways the sd-ndisc API now matches the
  sd-lldp API, except that no implicit database of seen data is kept. (Note
  that sd-ndisc actually had a half-written, but unused implementaiton of such
  a store, which is removed now.)

- sd-ndisc will now collect the reception timestamps of RA, which is useful to
  make sd_ndisc_router fully descriptive of what it covers.

Fixes: #1079
2016-06-06 20:11:38 +02:00
Lennart Poettering fc6a313b5b lldp: add proper ref counting to sd_lldp object and a separate call for setting the ifindex
Let's make sd-lldp a bit more like sd-ndisc ant the other APIs, and add proper
ref counting and a separate call for setting the ifindex.

This also adds a new lldp_reset() call we can use at various places to close
all fds. This is also similar to how sd-ndisc already does it.
2016-06-06 19:59:07 +02:00
tomty89 3fb1ac5d57 networkd-link: fix handler typo for route_remove() (#3433)
Obviously we've been using the wrong handler here. Fixes #3352.
2016-06-04 12:31:07 +02:00
Lennart Poettering a60a720c7e networkd: drop weird "const" usage in function parameters
We generally only use "const" to constify the destination of pointers, but not
the pointers themselves, as they are copied anyway during C function
invocation. Hence, drop this usage of "const".
2016-06-03 19:20:46 +02:00
Tom Yan 720bec40e9 networkd-dhcp6: generalize DHCPv6 client (re)starting
dhcp6_request_address() was merely a function to switch the DHCPv6 client from "stateless" mode to "stateful" mode. It was also a one-way switch. Also, to (re)start the client, we would need to repeat separate function calls.

In this patch, dhcp6_request_address() is made a general starter/manager of the DHCPv6 client. It now takes an extra parameter so we will be specifying which mode the DHCPv6 client should be started in. Also it will keep track of the current mode and compare with the newly requested mode, and only restart the client in case there is a difference between them.

This also makes sure that the DHCPv6 client will be (re)started accordingly as per the Router Advertisement flags.
2016-06-01 14:54:46 +08:00
Lennart Poettering 8d76eea87b Merge pull request #3378 from keszybz/unit-write-drop-in-newline-removal
Remove newlines from drop in format strings + some formatting fixes
2016-05-29 18:42:40 +02:00
Zbigniew Jędrzejewski-Szmek 0053598f36 Typo fix: s/advertisment/advertisement/ 2016-05-28 11:50:37 -04:00
Tom Yan 2b00a4e03d networkd: disable IPv6 for bridge slave
If an interface is managed as a bridge slave, we don't want any IP configuration for it. Therefore, disable IPv6 in such case.
2016-05-28 13:35:01 +08:00
Tom Yan 2b2d8603ce networkd: unset master if not enslaved with networkd
When we manage an interface with networkd but not as a slave (i.e. no `Bridge=` or `Bond=` set in its .network), we do not want it to remain slaved.
2016-05-28 13:31:41 +08:00
Tom Yan 4cef7fe3d1 networkd: Disable IPv6 when DHCPv6 is only enabled
DHCPv6 requires an IPv6 link-local address to work. The client will not be started (even when enabled explicitly with `DHCP=`) if none is configured (either by autoconfiguration or manually). Therefore, disable IPv6 in such case.
2016-05-25 20:40:48 +08:00
Tom Yan fbc38f230b networkd: set IFLA_INET6_ADDR_GEN_MODE as per stable_secret
Although networkd has option (LinkLocalAddressing=) to toggle IPv6LL autoconfiguration, when it is enabled, the address is autoconfigured by the kernel, but not networkd.

Therefore, we do not statically set IFLA_INET6_ADDR_GEN_MODE to IN6_ADDR_GEN_MODE_EUI64, but dynamically depending on whether stable_secret is set, just as what the kernel does by default.

Note that this does NOT affect the global addresses configured by networkd.
2016-05-25 20:04:01 +08:00
Susant Sahani 7209086d8a networkd: do not update state or IPv6LL address if link is failed or lingering
This is partial fix for #2228 and #2977, #3204.

bridge-test: netdev ready
docker0: Gained IPv6LL
wlan0: Gained IPv6LL
eth0: Gained IPv6LL
Enumeration completed
bridge-test: netdev exists, using existing without changing its
parameters
vboxnet0: IPv6 enabled for interface: Success
lo: Configured
docker0: Could not drop address: No such process
vboxnet0: Gained carrier
wlan0: Could not drop address: No such process
eth0: Could not drop address: No such process
eth0: Could not drop address: No such process
eth0: Could not drop address: No such process
vboxnet0: Gained IPv6LL
vboxnet0: Could not set NDisc route or address: Invalid argument
vboxnet0: Failed
[New Thread 0x7ffff6505700 (LWP 1111)]
[Thread 0x7ffff6505700 (LWP 1111) exited]
Assertion 'link->state == LINK_STATE_SETTING_ROUTES' failed at
src/network/networkd-link.c:672, function link_enter_configured().
Aborting.

Program received signal SIGABRT, Aborted.
0x00007ffff6dc6a98 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install
iptables-1.4.21-15.fc23.x86_64 libattr-2.4.47-14.fc23.x86_64
libidn-1.32-1.fc23.x86_64 pcre-8.38-7.fc23.x86_64

Debugging

(gdb) bt
"link->state == LINK_STATE_SETTING_ROUTES", file=0x5555556a34c8
"src/network/networkd-link.c", line=672,
    func=0x5555556a56d0 <__PRETTY_FUNCTION__.14850>
"link_enter_configured") at src/basic/log.c:788
src/network/networkd-link.c:672
src/network/networkd-link.c:720
flags=0 '\000', scope=0 '\000', cinfo=0x7fffffffe020) at
src/network/networkd-address.c:344
(rtnl=0x5555556eded0, message=0x55555570ff20, userdata=0x5555556ec590)
at src/network/networkd-manager.c:604
m=0x55555570ff20) at src/libsystemd/sd-netlink/sd-netlink.c:365
at src/libsystemd/sd-netlink/sd-netlink.c:395
ret=0x0) at src/libsystemd/sd-netlink/sd-netlink.c:429
revents=1, userdata=0x5555556eded0) at
src/libsystemd/sd-netlink/sd-netlink.c:723
src/libsystemd/sd-event/sd-event.c:2268
src/libsystemd/sd-event/sd-event.c:2629
timeout=18446744073709551615) at src/libsystemd/sd-event/sd-event.c:2688
bus=0x5555556eeba0, name=0x55555568a2f5 "org.freedesktop.network1",
timeout=30000000,
    check_idle=0x55555556adb6 <manager_check_idle>,
userdata=0x5555556ec590) at src/shared/bus-util.c:134
src/network/networkd-manager.c:1130
src/network/networkd.c:127

(gdb) f 3
src/network/networkd-link.c:672
672         assert(link->state == LINK_STATE_SETTING_ROUTES);
(gdb) p link->state
$1 = LINK_STATE_FAILED

We should not be in this state .

even if vboxnet0 failed we went into this state.

vboxnet0: Could not set NDisc route or address: Invalid argument
vboxnet0: Failed
2016-05-17 22:59:56 -04:00
Clemens Gruber 77ff6022fa networkd: Add EmitRouter= option for DHCP Server (#3251)
Add an option to disable appending DHCP option 3 (Router) to the DHCP
OFFER and ACK packets.
This commit adds the boolean option EmitRouter= for the [DHCPServer]
section in .network files.

Rationale: On embedded devices, it is very useful to have a DHCP server
running on an USB OTG ethernet gadget interface to avoid manual setup on
the client PCs, but it should only serve IP addresses, no route(r)s.
Otherwise, Windows clients experience network connectivity issues, due
to them using the address set in DHCP option 3 as default gateway.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
2016-05-17 19:34:25 -04:00
Zbigniew Jędrzejewski-Szmek 483d099e16 tree-wide: drop spurious "&"s when passing functions around
Also adjust indentation in various places.
2016-05-15 19:56:59 -04:00
Lennart Poettering 7272b25e16 networkd: reworkd LLDP emission to allow control of propagation level
This allows selecting the propagation level of emitted LLDP packets
(specifically: the destination MAC address of the packets). This is useful
because it allows generating LLDP packets that optionally cross certain types
of bridges.

See 802.11ab-2009, Table 7-1 for details.
2016-05-09 15:45:31 +02:00
Zbigniew Jędrzejewski-Szmek 8341a5c381 networkd: rework duid_{type,duid_type,duid,duid_len} setting
Separate fields are replaced  with a struct.

Second second duid type field is removed. The first field was used to carry
the result of DUIDType= configuration, and the second was either a copy of
this, or contained the type extracted from DuidRawData. The semantics are changed
so that the type specified in DUIDType is always used. DUIDRawData= no longer
overrides the type setting.

The networkd code is now more constrained than the sd-dhcp code:
DUIDRawData cannot have 0 length, length 0 is treated the same as unsetting.
Likewise, it is not possible to set a DUIDType=0. If it ever becomes necessary
to set type=0 or a zero-length duid, the code can be changed to support that.
Nevertheless, I think that's unlikely.

This addresses #3127 § 1 and 3.

v2:
- rename DUID.duid, DUID.duid_len to DUID.raw_data, DUID.raw_data_len
2016-05-03 12:23:01 -04:00
Zbigniew Jędrzejewski-Szmek 634f0f983c networkd: rework headers to avoid circular includes
Header files were organized in a way where the includer would add various
typedefs used by the includee before including it, resulting in a tangled
web of dependencies between files.

Replace this with the following logic:

          networkd.h
         /          \
networkd-link.h      \
networkd-ipv4ll.h--\__\
networkd-fdb.h         \
networkd-network.h    netword-netdev-*.h
networkd-route.h           \
                      networkd-netdev.h

If a pointer to a structure defined in a different header file is needed,
use a typedef line instead of including the whole header.
2016-04-29 19:01:28 -04:00
Lennart Poettering e0a24179c0 Merge pull request #3137 from keszybz/dirent-simplification
Various small cleanups in shared code
2016-04-29 10:40:15 +02:00
Susant Sahani 6fc2549711 networkd: reconfigure IPv6 and static address after link up event (#3105)
Now we are not setting static address, start dhcp6 client and
discovering IPv6 routers after link gained carrier.

This fixes #2912.
2016-04-28 19:03:29 -04:00
Zbigniew Jędrzejewski-Szmek b1e02ee7cf networkd: drop unnecessary stmt 2016-04-27 09:05:42 -04:00
Lennart Poettering fa7099927c networkd: consider various IPv6 features as disabled if IPv6 is not available in the kernel 2016-04-22 16:06:20 +02:00
Susant Sahani 0c241a378d networkd: When link gets dirty mark manager dirty too (#3080)
If we not marking manager dirty when link is dirty then
the state file is not updated. This is a side effect of
issue 2850
setting CriticalConnection=yes

timesyncd NTP servers given by DHCP server are ignored.
2016-04-21 16:08:07 +02:00
Susant Sahani 439689c6ec networkd: bump MTU to 1280 for interfaces which have IPv6 enabled (#3077)
IPv6 protocol requires a minimum MTU of 1280 bytes on the interface.
This fixes #3046.

Introduce helper link_ipv6_enabled() to figure out whether IPV6 is enabled.
Introduce network_has_static_ipv6_addresses() to find out if any static
ipv6 address configured.
If IPv6 is not configured on any interface that is SLAAC, DHCPv6 and static
IPv6 addresses not configured, then IPv6 will be automatically disabled for that
interface, that is we write "1" to /proc/sys/net/ipv6/conf//disable_ipv6.
2016-04-20 20:34:13 -04:00
Susant Sahani 23d8b221c0 networkd: Add support to configure proxy arp support to interfaces (#3020)
Fixes: #2889
2016-04-14 11:56:57 +02:00
Zbigniew Jędrzejewski-Szmek 1db30aeab1 Merge pull request #2915 from vinaykul/master 2016-03-31 00:52:23 -04:00
Vinay Kulkarni 413708d106 DHCP DUID, IAID configuration options 2016-03-30 16:33:55 -07:00
Beniamino Galvani 6afa676780 lldp: move public macros to sd-lldp.h and namespace them
lldp.h contains definitions of LLDP types, subtypes and capabilities which
should be exposed in public headers. Get rid of the file and move those
definitions to sd-lldp.h with the SD_ prefix.
2016-03-24 16:41:48 +01:00
Zbigniew Jędrzejewski-Szmek afec45395f Revert "DHCP DUID and IAID configurability" 2016-03-21 18:24:24 -04:00
Vinay Kulkarni c83321e6d4 DHCP DUID and IAID configurability 2016-03-09 21:58:44 -08:00
Vito Caputo 9ed794a32d tree-wide: minor formatting inconsistency cleanups 2016-02-23 14:20:34 -08:00
Vito Caputo 313cefa1d9 tree-wide: make ++/-- usage consistent WRT spacing
Throughout the tree there's spurious use of spaces separating ++ and --
operators from their respective operands.  Make ++ and -- operator
consistent with the majority of existing uses; discard the spaces.
2016-02-22 20:32:04 -08:00
Lennart Poettering 90dffb2241 sd-lldp: beef up callback logic
Instead of just notifying about the fact that something changed in the
database, actually inform the callback what precisely changed. This is useful,
so that the LLDP tx logic can be put into "fast" mode as soon as a previously
unknown peer appears, as suggested by the LLDP spec.
2016-02-21 20:58:59 +01:00
Lennart Poettering 8e1ad1eaf7 networkd: add basic LLDP transmission support
Let's add some minimalistic LLDP sender support. The idea is that this is
either on or off, and all fields determined automatically rather than
configured explicitly.
2016-02-21 20:58:59 +01:00
Lennart Poettering b553a6b13c sd-lldp: filter out LLDP messages coming from our own MAC address
Let's not get confused should we be connected to some bridge that mirrors back
our packets.
2016-02-21 20:40:58 +01:00
Lennart Poettering b9d74c40c6 networkd: make a couple of functions static
These functions are nowadays used only within networkd-link.c, hence ther's no
point in littering our public namespace with them.
2016-02-21 20:40:57 +01:00