Commit graph

1025 commits

Author SHA1 Message Date
Torstein Husebø 61233823aa treewide: fix typos and remove accidental repetition of words 2016-07-11 16:18:43 +02:00
0xAX 03fb333458 networkd: use strv_fnmatch() (#3605) 2016-06-26 17:37:24 +02:00
Lennart Poettering 3f0083a264 tree-wide: some work-arounds for gcc false positives regarding uninitialized variables 2016-06-21 14:15:23 +02:00
Lennart Poettering 5733d88dc1 networkd: fix bad memory access when parsing DNSSECNegativeTrustAnchors= 2016-06-21 13:20:47 +02:00
Andreas Rammhold 6cb955c6a1 networkd: vrf: add support for enslaving devices to VRFs 2016-06-16 00:25:06 +02:00
Andreas Rammhold 20897a0d6e networkd: added support for vrf interfaces (#3316) 2016-06-16 00:25:06 +02:00
Lennart Poettering 8e38570ebe tree-wide: htonl() is weird, let's use htobe32() instead (#3538)
Super-important change, yeah!
2016-06-15 01:26:01 +02:00
Susant Sahani 1d7100298c networkd: Tunnel add support to configure key for VTI/VTI6 (#3532)
fixes #3298
2016-06-14 19:11:57 +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
Susant Sahani 1c4b11794b networkd: route priority replace parsing config_parse_uint32 with safe_atou32 (#3522) 2016-06-13 15:57:17 +02:00
Tobias Jungel 0e83e7a5a2 networkd: more vlan cleanup (#3506)
use config_parse_vlanid to parse vlan for BridgeFDB entries
2016-06-12 20:01:14 +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
Lennart Poettering e373507d25 networkd: fix bad memory access for routes that are note attached to a link yet (#3499)
Corrects: 1b566071

Also see: https://github.com/systemd/systemd/pull/3478#issuecomment-225008542
2016-06-10 23:26:24 +02:00
Lennart Poettering 1edce01965 Merge pull request #3428 from toanju/networkd/brvlan
networkd: add support to configure VLAN on bridge ports
2016-06-10 13:04:44 +02:00
Andrew Jeddeloh 174306cf08 networkd: fix dbus matchmac interface (#3485)
Fix issue where the *Network passed via userdata is being offset
by offsetof(Network, matchmac) leading to incorrect values being
exposed in dbus.
2016-06-10 12:35:43 +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 d643a60a9e Merge pull request #3456 from poettering/ipv6-ra-rename
networkd: rename IPv6AcceptRouterAdvertisements to IPv6AcceptRA
2016-06-09 21:28:40 +02:00
Lennart Poettering 267fabd2ab networkd: clean up vlan handling a bit (#3478)
Let's add a generic parser for VLAN ids, which should become handy as
preparation for PR #3428. Let's also make sure we use uint16_t for the vlan ID
type everywhere, and that validity checks are already applied at the time of
parsing, and not only whne we about to prepare a netdev.

Also, establish a common definition VLANID_INVALID we can use for
non-initialized VLAN id fields.
2016-06-09 18:55:16 +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 f921f5739e networkd: rename IPv6AcceptRouterAdvertisements to IPv6AcceptRA
The long name is just too hard to type. We generally should avoid using
acronyms too liberally, if they aren't established enough, but it appears that
"RA" is known well enough. Internally we call the option "ipv6_accept_ra"
anyway, and the kernel also exposes it under this name. Hence, let's rename the
IPv6AcceptRouterAdvertisements= setting and the
[IPv6AcceptRouterAdvertisements] section to IPv6AcceptRA= and [IPv6AcceptRA].

The old setting IPv6AcceptRouterAdvertisements= is kept for compatibility with
older configuration. (However the section [IPv6AcceptRouterAdvertisements] is
not, as it was never available in a published version of systemd.
2016-06-07 11:24:30 +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
Tobias Jungel 45819e7cbf networkd: remove unused variable (#3447)
this patch solves the following waring:

../src/network/networkd-ndisc.c:197:13: warning: unused variable ‘r’
[-Wunused-variable]
         int r;

fixes acac5b2f
2016-06-06 14:03: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 889b550f2d networkd: constify more things 2016-06-03 19:54:35 +02:00
Lennart Poettering 1b56607157 networkd: also enforce limit on total number of address/routes
This covers the address/routers acquire dynamically.
2016-06-03 19:53:43 +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
Lennart Poettering 8c34b96307 networkd: enforce a limit on the number of statically assigned addresses/routes/fdb entries
We should put a limit on everything, hence also on these resources.
2016-06-03 19:14:12 +02:00
Tom Yan acac5b2f51 networkd-ndisc: do not start DHCPv6 when after NDISC timeout
For it's silly and unnecessary. Although it was apparently mandated by RFC 2462 in [5.5.2. Absence of Router Advertisements], that has been changed in the same section of RFC 4862, which obsoleted the former RFC.
2016-06-02 01:05:50 +08: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
Tobias Jungel c6f8d17de0 networkd: bridge add support to configure VLAN filtering (#3344)
This patch implements support for IFLA_BR_VLAN_FILTERING configuration.
2016-05-30 17:00:16 +02: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 662c7e5073 Merge pull request #3326 from tomty89/update-2
networkd: IPv6 fixes
2016-05-28 15:28:51 -04: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
Lennart Poettering 38958cd66e ipv4ll: change "seed" parameter to be uint64_t
Let's make clear this always has the same size, since otherwise it's not useful
for reproducible runs, which this is really about however.
2016-05-26 15:34:43 +02:00
Lennart Poettering 2f8e763376 sd-network: rename "index" field of the various clients to "ifindex"
A field "index" is not particularly precise and also might conflict with libc's
index() function definition. Also, pretty much everywhere else we call this
concept "ifindex", including in networkd, the primary user of these libraries.
Hence, let's fix this up and call this "ifindex" everywhere here too.
2016-05-26 15:34:42 +02: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
Zbigniew Jędrzejewski-Szmek 3a74d4fc90 networkd-ndisc: do not return value from void function
Fixup for #3304.

Only warn, and not return, because that's what sd_dhcp6_client_start()
does right below the call to sd_dhcp6_client_set_local_address().
2016-05-21 18:31:29 -04:00
Tom Gundersen e4de3d23bb Merge pull request #3304 from tomty89/master
[networkd] ndisc DHCPv6 triggering fixes
2016-05-20 19:00:08 +02:00
Tom Gundersen e506f43666 Merge pull request #3276 from ssahani/issue-3264
networkd: Drop IPv6LL address when link is down.
2016-05-20 18:54:49 +02:00
Tom Gundersen 51e0b25077 Merge pull request #3235 from dkg/hwaddr-cleanup
minor improvements for dealing with MAC Addresses
2016-05-20 17:27:58 +02:00
tomty89 59bc1530b8 [networkd-dhcp6] do not call sd_dhcp6_client_start() from dhcp6_request_address()
Starting the DHCP client doesn't seem like dhcp6_request_address()'s responsibility anyway. Whenever it's called, sd_dhcp6_client_start() is unconditionally called outside of it as well. See ndisc_router_handler() and ndisc_handler() in networkd-ndisc.c.
2016-05-20 18:28:30 +08:00
tomty89 9243aa45fa [networkd-ndisc] set IPv6LL address in DHCP client
Fix issue #3256 and probably #1982. Referenced link_acquire_ipv6_conf() in networkd-link.c.
2016-05-20 18:20:24 +08:00
Susant Sahani f150100ad4 networkd: Drop IPv6LL address when link is down
Now we are not dropping the IPv6LL address when link is down.
So next time when link is up and before kernel acquired this address
we are using the old address.

When the link is down kernel tells us that this address is no longer
valid . Let's remove this address and again when kernel tells us
that the address is added let's use it.

fixes #3264
2016-05-18 18:19:40 +05:30
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
Susant Sahani fe7ca21acf networkd: add route expiration handler (#3242)
Fix for #3232.
2016-05-17 21:36:43 -04:00