Commit Graph

1203 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 5afe558cfd
Merge pull request #12818 from yuwata/network-issue-8726
network: disable kernel creating prefix route when RouteTable= is set
2019-10-03 15:21:35 +02:00
Zbigniew Jędrzejewski-Szmek 6e2d361d53
Merge pull request #13696 from keszybz/keep-dhcp-on-restart
Add a way to differentiate restart from stop and keep dhcp config on restart
2019-10-03 11:25:12 +02:00
Zbigniew Jędrzejewski-Szmek a232ebcc2c core: add support for RestartKillSignal= to override signal used for restart jobs
v2:
- if RestartKillSignal= is not specified, fall back to KillSignal=. This is necessary
  to preserve backwards compatibility (and keep KillSignal= generally useful).
2019-10-02 14:01:25 +02:00
Zbigniew Jędrzejewski-Szmek c78c095b1e nspawn: rename UNIFIED_CGROUP_HIERARCHY to SYSTEMD_NSPAWN_UNIFIED_HIERARCHY
We should never have used an unprefixed environment variable name.
All other systemd-nspawn variables have the "SYSTEMD_NSPAWN_" prefix,
and all other systemd variables have the "SYSTEMD_" prefix.

The new variable name takes precedence, but we fall back to checking the
old one. If only the old one is found, a warning is emitted.

In addition, SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="" is accepted as an override
to avoid looking for the old variable name.

We have a variable with the same name ($UNIFIED_CGROUP_HIERARCHY) in tests,
which governs both systemd-nspawn and qemu behaviour. It is not renamed.
2019-10-01 10:21:13 -07:00
Susant Sahani 2805536bff network: DHCPv6 client add support for prefix delegation hint
Add support for prefix hint lenth and prefix hint address
```
Frame 43: 177 bytes on wire (1416 bits), 177 bytes captured (1416 bits) on interface 0
Ethernet II, Src: f6:c1:08:4d:45:f1 (f6:c1:08:4d:45:f1), Dst: IPv6mcast_01:00:02 (33:33:00:01:00:02)
Internet Protocol Version 6, Src: fe80::d250:c82:7f6e:28d6, Dst: ff02::1:2
User Datagram Protocol, Src Port: 546, Dst Port: 547
DHCPv6
    Message type: Solicit (1)
    Transaction ID: 0x5c7902
    Rapid Commit
    Identity Association for Non-temporary Address
    Fully Qualified Domain Name
    Identity Association for Prefix Delegation
        Option: Identity Association for Prefix Delegation (25)
        Length: 41
        Value: 1b97b1690000000000000000001a0019ffffffffffffffff…
        IAID: 1b97b169
        T1: 0
        T2: 0
        IA Prefix
            Option: IA Prefix (26)
            Length: 25
            Value: ffffffffffffffff3c000000000000000000000000000000…
            Preferred lifetime: infinity
            Valid lifetime: infinity
            Prefix length: 60
            Prefix address: ::
    Option Request
    Client Identifier
    Elapsed time
```
2019-10-01 23:52:40 +09:00
Frantisek Sumsal 501deda1ce test: allow use of nested KVM
Introduce TEST_NESTED_KVM variable, which allows use of nested KVM for
QEMU VMs (which is disabled by default by KVM autodetection).
2019-09-27 15:42:38 -07:00
Siddharth Chandrasekara afe42aef39 dhcp4: make IPServiceType configurable
IPServiceType set to CS6 (network control) causes problems on some old
network setups that continue to interpret the field as IP TOS.

Make DHCP work on such networks by allowing this field to be set to
CS4 (Realtime) instead, as this maps to IPTOS_LOWDELAY.

Signed-off-by: Siddharth Chandrasekaran <csiddharth@vmware.com>
2019-09-26 11:39:46 +09:00
Susant Sahani 224ded670f link: Add support to configure NIC ring buffer size 2019-09-24 16:33:35 +02:00
Susant Sahani 299d578f7f network: DHCP server Add support to transmit SIP server
1. DHCP server trasmit
2. Client parses and saves in leases
Implements http://www.rfc-editor.org/rfc/rfc3361.txt

```
Frame 134: 348 bytes on wire (2784 bits), 348 bytes captured (2784 bits) on interface 0
Ethernet II, Src: 42:65:85:d6:4e:32 (42:65:85:d6:4e:32), Dst: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4)
Internet Protocol Version 4, Src: 192.168.5.1, Dst: 192.168.5.11
User Datagram Protocol, Src Port: 67, Dst Port: 68
Dynamic Host Configuration Protocol (ACK)
    Message type: Boot Reply (2)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0x7cc87cb4
    Seconds elapsed: 0
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 192.168.5.11
    Next server IP address: 0.0.0.0
    Relay agent IP address: 0.0.0.0
    Client MAC address: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type (ACK)
        Length: 1
        DHCP: ACK (5)
    Option: (51) IP Address Lease Time
        Length: 4
        IP Address Lease Time: (3600s) 1 hour
    Option: (1) Subnet Mask (255.255.255.0)
        Length: 4
        Subnet Mask: 255.255.255.0
    Option: (3) Router
        Length: 4
        Router: 192.168.5.1
    Option: (6) Domain Name Server
        Length: 4
        Domain Name Server: 192.168.5.1
    Option: (42) Network Time Protocol Servers
        Length: 4
        Network Time Protocol Server: 192.168.1.1
    Option: (120) SIP Servers <=====here
        Length: 9
        SIP Server Encoding: IPv4 Address (1)
        SIP Server Address: 192.168.1.1
        SIP Server Address: 192.168.5.2
    Option: (101) TCode
        Length: 13
        TZ TCode: Europe/Berlin
    Option: (54) DHCP Server Identifier (192.168.5.1)
        Length: 4
        DHCP Server Identifier: 192.168.5.1
    Option: (255) End
        Option End: 255
```

```
cat /run/systemd/netif/state                                                                                                   ✔    3148  16:40:51
OPER_STATE=routable
CARRIER_STATE=carrier
ADDRESS_STATE=routable
DNS=192.168.94.2 192.168.5.1
NTP=192.168.5.1
SIP=192.168.1.1 192.168.5.2

```

aa
2019-09-20 21:22:23 +09:00
Susant Sahani 5bc945bec4 network dhcp4: Add support send request options in a generic manner 2019-09-20 21:05:48 +09:00
Susant Sahani 98f0e10429 test-network: Drop start dnsmasq 2019-09-20 08:09:25 +00:00
Yu Watanabe 0eb5e6d3f0 dhcp6: use unaligned_read_be32()
Closes #13591.
2019-09-20 08:04:15 +00:00
Yu Watanabe 6ffe71d0e2 dhcp6: add missing option length check
Closes #13578.
2019-09-17 18:29:20 +00:00
Anita Zhang 898fc00e79 core: add ExecXYZEx= bus hook ups to all exec command properties
The "Ex" variant was originally only added for ExecStartXYZ= but it makes
sense to have feature parity for the rest of the exec command properties
as well (e.g. ExecReload=, ExecStop=, etc).
2019-09-17 15:48:44 +00:00
Frantisek Sumsal 8813a8c332 test: rename TEST-EXECRELOAD to avoid name conflict 2019-09-18 00:14:43 +09:00
Yu Watanabe edfbf051e1
Merge pull request #13559 from ssahani/ipv6ra-route
network: make networkd able to advertise IPv6 routes on links
2019-09-18 00:13:08 +09:00
Susant Sahani 9633f977ea Add test for IPv6 Route advertisement 2019-09-17 12:10:19 +02:00
Susant Sahani 203d4df573 network: Add support to advertie ipv6 route
Implements https://tools.ietf.org/html/rfc4191

cat veth99.network
```
[Match]
Name=veth99

[Network]
DHCP=no
IPv6PrefixDelegation=yes
Address=2001:db8:0:1::1/64

[IPv6Prefix]
Prefix=2001:db8:0:1::4/64

[IPv6RoutePrefix]
Route=2001:db0:fff::/48

```
Wireshark

```
Frame 481: 142 bytes on wire (1136 bits), 142 bytes captured (1136 bits) on interface 0
Ethernet II, Src: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4), Dst: IPv6mcast_01 (33:33:00:00:00:01)
Internet Protocol Version 6, Src: fe80::1c04:f8ff:feb8:2fd4, Dst: ff02::1
Internet Control Message Protocol v6
    Type: Router Advertisement (134)
    Code: 0
    Checksum: 0xec77 [correct]
    [Checksum Status: Good]
    Cur hop limit: 0
    Flags: 0x00, Prf (Default Router Preference): Medium
    Router lifetime (s): 0
    Reachable time (ms): 0
    Retrans timer (ms): 0
    ICMPv6 Option (Source link-layer address : 1e:04:f8:b8:2f:d4)
        Type: Source link-layer address (1)
        Length: 1 (8 bytes)
        Link-layer address: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4)
    ICMPv6 Option (MTU : 1500)
        Type: MTU (5)
        Length: 1 (8 bytes)
        Reserved
        MTU: 1500
    ICMPv6 Option (Prefix information : 2001:db8:0:1::4/64)
        Type: Prefix information (3)
        Length: 4 (32 bytes)
        Prefix Length: 64
        Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A)
        Valid Lifetime: 2592000
        Preferred Lifetime: 604800
        Reserved
        Prefix: 2001:db8:0:1::4
    ICMPv6 Option (Route Information : Medium 2001:db0:fff::/48)
        Type: Route Information (24)
        Length: 3 (24 bytes)
        Prefix Length: 48
        Flag: 0x00, Route Preference: Medium
            ...0 0... = Route Preference: Medium (0)
            000. .000 = Reserved: 0
        Route Lifetime: 604800
        Prefix: 2001:db0:fff::
```
2019-09-17 12:09:59 +02:00
Zbigniew Jędrzejewski-Szmek 69cebea78a
Merge pull request #13300 from mrc0mmand/test-execreload
test: introduce TEST-37-EXECRELOAD
2019-09-17 10:54:18 +02:00
Yu Watanabe 7b3770a75f test-network: add one more test case for LinkLocalAddressing= 2019-09-17 09:45:22 +09:00
Yu Watanabe 2aa7d367ec network: do not create default route for ipv4 link local addressing
When nspawn container with private network starts, networkd creates
the default route for the interface. The route may cause problem on
the host side, and it can be created with DefaultRouteOnDevice= now.
Hence, this makes networkd not create the route implicitly any more.

Closes #13418.
2019-09-15 22:33:11 +09:00
Zbigniew Jędrzejewski-Szmek de5ae832f2
Merge pull request #13439 from yuwata/core-support-systemctl-clean-more
core: support systemctl clean more
2019-09-13 16:15:02 +02:00
Yu Watanabe 48d26c9085 test: add test cases for empty string match 2019-09-11 09:06:15 +09:00
Fabian Henneke d45ee2f31a udev: Add id program and rule for FIDO security tokens
Add a fido_id program meant to be run for devices in the hidraw
subsystem via an IMPORT directive. The program parses the HID report
descriptor and assigns the ID_SECURITY_TOKEN environment variable if a
declared usage matches the FIDO_CTAPHID_USAGE declared in the FIDO CTAP
specification. This replaces the previous approach of whitelisting all
known security token models manually.

This commit is accompanied by a test suite and a fuzzer target for the
descriptor parsing routine.

Fixes: #11996.
2019-09-07 02:23:58 +09:00
Yu Watanabe a3f8e4d94a test: add more tests for "systemctl clean" 2019-08-31 09:30:12 +02:00
Zbigniew Jędrzejewski-Szmek 6b4f7fb08c
Merge pull request #13385 from yuwata/core-remove-private-directories-13355
core: also remove private directories by systemctl clean
2019-08-31 09:28:39 +02:00
Zbigniew Jędrzejewski-Szmek 3a5a08bbb4
Merge pull request #13384 from yuwata/core-runtime-directory-preserve
core: make RuntimeDirectoryPreserve= works with non-service units
2019-08-30 13:00:57 +02:00
Yu Watanabe c238b616cf test: add tests for systemctl clean with DynamicUser=yes 2019-08-28 23:09:54 +09:00
Yu Watanabe 6c431a16c3
Merge pull request #13382 from keszybz/network-ipv6-enable
Network ipv6 enable
2019-08-28 00:29:29 +09:00
Zbigniew Jędrzejewski-Szmek 57ad760746 network: drop all checks of ipv6_disabled sysctl
*We* control the sysctl setting. If the user configured IPv6, then we apply the
settings, and just make sure that at some point during the configuration the
sysctl is disabled (i.e. ipv6 enabled) if we have IPv6 configured.

Replaces #13283.
2019-08-27 15:31:48 +02:00
Dan Streetman 58c1a34437 test/TEST-10-ISSUE-2467: remove testsuite.service TimeoutStartSec
This test runs under qemu, which may run on some testbeds without
acceleration; in those cases, a 10s timeout is frequently too short.

Simply removing the timeout to allow the default timeoutsec should
be enough time for the test to finish, even on very slow testbeds.
2019-08-26 12:47:15 +09:00
Dan Streetman 65c5f3d074 test/TEST-18-FAILUREACTION: fix typo to actually run firstphase action
The if test for running the firstphase of the test should be negated
so the firstphase is actually executed.
2019-08-26 12:46:39 +09:00
Dan Streetman adcc450f46 test/test-functions: use truncate instead of dd to create testbed image
This avoids unnecessary noise in the stderr logs which dd always produces,
such as:

0+0 records in
0+0 records out
0 bytes copied, 0.000155284 s, 0.0 kB/s

Using truncate should not result in any functional change; the image will
still be created as a sparse file of the size specified.
2019-08-25 15:37:51 +09:00
Dan Streetman 84c49ad197 test/test-functions: use binaries from $BUILD_DIR or installed system
In Ubuntu CI, we test binaries from the installed system, not from
$BUILD_DIR, so use the appropriate binary.  Most of the calls to the
binaries are part of checking/processing asan-built binaries, and so
did not apply to Ubuntu CI, except for generating noise in the stderr
log like:

objdump: '/tmp/autopkgtest.83yGoI/build.fHB/src/test/TEST-01-BASIC/systemd-journald': No such file

However this also applies to the call to systemd-nspawn, which the debian
upstream test wrapper was sed-adjusting to use the installed binary
instead of the binary in $BUILD_DIR.  This commit allows removing that
sed processing of the test-functions file during Ubuntu CI test.
2019-08-25 15:36:47 +09:00
Yu Watanabe 8246bb204c test: add tests for RuntimeDirectoryPreserve=yes 2019-08-23 00:22:54 +09:00
Zbigniew Jędrzejewski-Szmek 4eaa2486b8
Merge pull request #13235 from yuwata/network-routing-policy-rule-family-13233
network: add RoutingPolicyRule.Family= setting
2019-08-19 10:08:23 +02:00
Zbigniew Jędrzejewski-Szmek 165df4dcda
Merge pull request #13345 from yuwata/network-fix-preferred-lifetime-zero-13341
network: fix PreferredLifetime=0
2019-08-19 09:59:16 +02:00
Yu Watanabe 134075bf30
Merge pull request #13344 from ddstreet/test-functions
Minor/cosmetic changes to test/test-functions, some test.sh
2019-08-19 00:34:35 +09:00
Dan Streetman e24619fddd test: increase qemu timeout for TEST-18 and TEST-19
These tests runs under qemu, and on some testbeds, without acceleration.
On those systems, the current 180 second overall test timeout is too
short to run the test.

Increasing the timeout to 600s should be enough, even for slow
non-accelerated qemu testbeds.
2019-08-19 00:30:22 +09:00
Yu Watanabe e4783b548a test-network: update test for PreferredLifetime=0 2019-08-19 00:06:50 +09:00
Dan Streetman 8c03df36fe test/test-functions: add mkdir to import_initdir
This dir is created by create_empty_image_rootdir, as well as indirectly
by some other functions, but it should be created by import_initdir so
the newly-exported $initdir exists and can be used immediately without
relying on other functions to create it.
2019-08-17 12:29:15 -04:00
Dan Streetman 0036ce06cb test: replace $TESTDIR/root with $initdir
The $initdir var is already set to $TESTDIR/root, it should be used
instead of direct use of $TESTDIR/root.
2019-08-17 12:29:08 -04:00
Dan Streetman f422967529 test: TEST-33 and TEST-36 should use create_empty_image_rootdir
This recently added function handles mkdir and mounting of the empty image,
as well as umounting after test_setup.
2019-08-17 12:28:57 -04:00
Dan Streetman 9e19a8b028 test/test-functions: avoid stderr noise, only umount on cleanup if mountpoint
Only umount it during cleanup if the $TESTDIR/root dir is a mountpoint.
This avoids adding noise to the stderr log such as:

mountpoint: /var/tmp/systemd-test.waLOFT/root: No such file or directory
2019-08-17 12:28:41 -04:00
Yu Watanabe 65c24cd087 test-network: add tests for RoutingPolicyRule.Family=ipv6 and both 2019-08-16 22:02:17 +09:00
Yu Watanabe f6c6ff97f5 network: add RoutingPolicyRule.Family= setting
Closes #13233.
2019-08-16 22:02:17 +09:00
Daniel Black f364a17dd1 test: ppc64* qemu is qemu-system-ppc64 2019-08-14 07:43:29 +00:00
Frantisek Sumsal 215bffe1b8 test: store coredumps in journal
To make debugging much easier, especially for crashes in tests under
QEMU, let's store the entire coredump bundle in the systemd journal,
which is usually kept around by various CIs. Right now, we usually end
up with a journal, but without the coredump itself, which is pretty
useless.
2019-08-13 07:09:57 +00:00
William A. Kennington III d1bdafd214 networkd: Keep track of static neighbors
We need to keep track of the static neighbors that are configured on the
interface so that we can delete stale entries that were removed.
2019-08-12 20:28:19 +09:00
Frantisek Sumsal 67c434b03f test: drop the missed || exit 1 expression
...as we've already done in the rest of the testsuite, see
cc469c3dfc
2019-08-11 09:38:49 +02:00