Commit Graph

516 Commits

Author SHA1 Message Date
Yu Watanabe acb71754e1 network: use fix invalid free function
Fixes #13938.
2019-11-05 09:40:55 +09:00
Susant Sahani 564ca98484 networkd: dhcp server Support Vendor specific 43
Implementes https://tools.ietf.org/html/rfc2132

```
[DHCPServer]
SendRawOption=26:uint32:1400
SendRawOption=23:uint8:10

```
Frame 448: 350 bytes on wire (2800 bits), 350 bytes captured (2800 bits) on interface 0
Linux cooked capture
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: 0x71f8de9d
    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.5.1
    Option: (101) TCode
        Length: 13
        TZ TCode: Europe/Berlin
    Option: (43) Vendor-Specific Information
        Length: 9
        Value: 1701311a0431343030
    Option: (54) DHCP Server Identifier (192.168.5.1)
        Length: 4
        DHCP Server Identifier: 192.168.5.1
    Option: (255) End
        Option End: 255

```
2019-10-31 09:03:43 +09:00
Susant Sahani 0f5bd7fe24 network: introduce TrafficControl
Add network delay to a interface
2019-10-30 09:33:51 +09:00
Yu Watanabe 78404d22cc network: support matching based on wifi interfece type 2019-10-25 16:43:18 +09:00
Yu Watanabe 7f06b3e1b9 network: add Reload() dbus method 2019-10-24 14:18:09 +09:00
Zbigniew Jędrzejewski-Szmek 510c4bb31f
Merge pull request #13142 from yuwata/network-wifi-ssid-support-nl80211
network: wifi ssid support with nl80211
2019-10-23 14:51:23 +02:00
Zbigniew Jędrzejewski-Szmek c8966bffdd
Merge pull request #13663 from ssahani/dhcp-send-option-data
network: DHCPv4 client- add support to send arbitary option and data
2019-10-16 11:31:22 +02:00
Yu Watanabe 277ba8d1ab network: add support matching based on BSSID= 2019-10-15 01:59:56 +09:00
Yu Watanabe 8d968fdd99 network: support matching based on wifi SSID 2019-10-15 01:59:06 +09:00
Susant Sahani cb29c15605 network: DHCPv4 client: add support to send arbitary option and data 2019-10-15 00:14:02 +09:00
Yu Watanabe 4abcdaa08c network: update comment as DHCP is deprecated now 2019-10-14 21:33:22 +09:00
Susant Sahani c16c780804 network: introduce ip nexthop routing
Used to manipulate entries in the kernel's nexthop tables.
Example:
```
[NextHop]
Id=3
Gateway=192.168.5.1
```
2019-10-14 21:32:48 +09:00
Zbigniew Jędrzejewski-Szmek 5f3b5f190f networkd: change SendRelease default to true
Now that we don't drop DHCP config on restart, this seems appropriate.
2019-10-02 14:01:42 +02:00
Zbigniew Jędrzejewski-Szmek 800603524a networkd: drop DHCPv4 config on stop, keep on restart, by default
This partially reverts 95355a281c.

It seems that other parts of link_stop_clients() should be skipped
when restarting, but I don't know enough about those other clients to have
an opinion if it is better to stop&start them on restart or not.
Anyway, that can be done in later patches now that the support for restarts
is there.

Fixes #13625.
2019-10-02 14:01:42 +02: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
Yu Watanabe 714a199e48 network: add one more section validty check
Follow-up for 203d4df573.
2019-09-21 20:17:15 +09:00
Chris Down de307e199b networkd: Fix SIP double-free
This is already strv_freed right above
2019-09-20 15:15:04 +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 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 3af900718e
Merge pull request #13405 from yuwata/network-ipv6-privacy-extensions-cleanup
Network ipv6 privacy extensions cleanup
2019-09-13 18:03:29 +02:00
Yu Watanabe be7110826e network: do not abort execution when a config file cannot be loaded
Closes #13516.
2019-09-11 21:15:22 +09:00
Yu Watanabe 44013aa4f5 network: add more warnings in network_verify() 2019-08-27 23:53:46 +09:00
Yu Watanabe adfeee49c5 network: enable ipv6 when the network has static ipv6 configurations 2019-08-27 23:53:46 +09:00
Yu Watanabe b146ad71cc network: use DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN() macro at one more place 2019-08-26 16:19:02 +09:00
Yu Watanabe 2d79289525 network: rename AddressFamilyBoolean -> AddressFamily
We usually do not call an extended boolean as XxxBoolean.
2019-08-16 22:02:17 +09:00
Yu Watanabe 0aabccc87d network: refuse the case To= and From= are in different address family 2019-08-16 22:01:17 +09:00
Yu Watanabe 044d4b4067 network: drop invalid [Neighbor] section earlier 2019-07-11 22:22:29 +09:00
Lennart Poettering 7e82b4059b
Merge pull request #13006 from yuwata/network-split-dhcp-12917
networkd: DHCPv6 - separate DHCPv6 options from DHCPv4 options
2019-07-11 10:28:03 +02:00
1848 98d20a17a9 Added support for xfrm interfaces 2019-07-10 23:02:19 +09:00
Susant Sahani caa8ca4286 networkd: DHCPv6 - separate DHCPv6 options from DHCPv4 options
Closes https://github.com/systemd/systemd/issues/12917
2019-07-10 16:59:29 +09:00
Zbigniew Jędrzejewski-Szmek 8fabb625ac
Merge pull request #12912 from yuwata/network-move-functions
network: move functions
2019-07-02 09:46:38 +02:00
Yu Watanabe 44005bfb4e network,udev: add Property= setting in [Match] section
Closes #5665.
2019-07-01 01:24:42 +09:00
Yu Watanabe b38de0e9cc network,udev: make net_match_config() take sd_device 2019-07-01 01:24:42 +09:00
Yu Watanabe 8fcf1d6180 network: move DHCP server related functions to networkd-dhcp-server.c 2019-06-30 04:46:27 +09:00
Yu Watanabe ca5ad760a5 network: move conf parsers and function prototypes 2019-06-30 04:45:56 +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
Susant Sahani e520ce6440 networkd: Ability to selectively ignore IPv6 prefixes supplied via router advertisement
Closes https://github.com/systemd/systemd/issues/10647
2019-05-19 22:23:06 +09:00
Yu Watanabe cdd22d5129 network: set_put() here does not returns -EEXIST 2019-05-18 12:46:02 +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 933c70a0a4 network: honor MTUBytes= setting
Closes #12552.
2019-05-16 11:47:41 +09:00
Susant Sahani 69c317a07f networkd: introduce netdev ipvtap
This patch adds netdev ipvtap that is based on the
IP-VLAN network interface, called ipvtap. An ipvtap device can be created
in the same way as an ipvlan device, using 'kind ipvtap', and then accessed
using the tap user space interface.
2019-05-16 09:48:53 +09:00
Yu Watanabe 5d5003ab35 network: add DefaultRouteOnDevice= setting in [Network] section
When enabled, then default route bound to the interface will be created.
This is useful when adding routes on point-to-point interfaces.

Closes #788.
2019-05-15 12:44:30 +09:00
Yu Watanabe 8e2cb51ce0 network: move MulticastRouter to netdev/bridge.[ch] 2019-05-11 06:24:04 +09:00
Yu Watanabe 7f8539504c network: move sd_lldp related functions to networkd-lldp-rx.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 727b573418 networkd: Add support for blacklisting servers
closes #6260

fuzzer: Add DHCP support for blacklisting servers
2019-05-10 15:29:55 +02:00
Susant Sahani 0fadb2a46f network: add support to configure proxy ARP/WIFI 2019-05-09 15:03:04 +09: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
Zbigniew Jędrzejewski-Szmek 717e8eda77
Merge pull request #12475 from yuwata/network-fix-12452
network: add network_ref/_unref() and make Link object take a reference of Network object
2019-05-07 20:03:22 +02:00
Susant Sahani 715cedfbf0 networkd: Allow DHCP4 client to set the number to attempt to reconfigure.
Otherwise current value is 6 and after 6 it will give up.
2019-05-07 17:12:04 +02:00
Yu Watanabe 715d398e61 network: drop list fields in Network object 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
Yu Watanabe 35ac3b7664 network: introduce reference counter for Network object 2019-05-07 16:55:19 +02:00
Yu Watanabe 810ae0dc95 network: warn about Network.IPv4LL= is deprecated 2019-05-04 16:46:02 +02:00
Yu Watanabe 29e81083bd network: disable fallback IPv4ll address assignment when DHCPv4 is disabled 2019-05-04 16:46:02 +02:00
Ben Boeckel 5238e95759 codespell: fix spelling errors 2019-04-29 16:47:18 +02:00
Yu Watanabe 84ea567eb4 udev,network: warn when .link or .network file has no [Match] section
Closes #12098.
2019-04-25 08:41:10 +02:00
Susant Sahani 81962db798 network: Introduce MACsec
Media Access Control Security (MACsec) is an 802.1AE IEEE
industry-standard security technology that provides secure
communication for all traffic on Ethernet links.
MACsec provides point-to-point security on Ethernet links between
directly connected nodes and is capable of identifying and preventing
most security threats, including denial of service, intrusion,
man-in-the-middle, masquerading, passive wiretapping, and playback attacks.

Closes #5754
2019-04-12 10:12:41 +09:00
Yu Watanabe 01234e1fe7 tree-wide: drop several missing_*.h and import relevant headers from kernel-5.0 2019-04-11 19:00:37 +02:00
Yu Watanabe 9282f75bf4 network: make erspan netdev can be specified in Network.Tunnel= 2019-03-30 03:52:25 +09:00
Yu Watanabe c4f58deab5 network,udev: split static condition tests from net_match_config() 2019-03-21 23:37:39 +09:00
Susant Sahani 3a56e697c8 networkd: Introduce l2tp tunnel
This works allows networkd to configure l2tp tunnel.
See http://man7.org/linux/man-pages/man8/ip-l2tp.8.html
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
Lennart Poettering 96c45cc697
Merge pull request #11861 from yuwata/network-verify-2
network: config parser updates and wireguard refactoring
2019-03-13 10:15:27 +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 96db641250 test: make network_verify() public and use it in test-networkd-conf 2019-03-13 11:59:18 +09:00
Yu Watanabe fcbf4cb727 network: drop sections contain invalid settings in network_verify()
If e.g., an [Address] section has an invalid setting, then
previously assigned settings in the section is freed, and
only later settings are stored. That may cause partially broken
section stored in Network object.

This makes if an invalid setting is found, then set 'invalid' flag
instead of freeing it. And invalid sections are dropped later by
network_verify().
2019-03-13 11:59:18 +09:00
Yu Watanabe fa7cd7117f network: add IPv4LL route right after .network file is parsed
Previously, the route is added when the .network config is assigned
to a Link. So, if multiple links match the .network file, the route
entry becomes duplicated in the corresponding Network object.
2019-03-13 11:59:18 +09:00
Yu Watanabe 48315d3dca network: move NetworkConfigSection and related functions to networkd-util.[ch] 2019-03-13 11:59:18 +09:00
Yu Watanabe 95dba43542 network: use ltype to determine netdev kind in config_parse_stacked_netdev() 2019-03-13 11:59:18 +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 4912ab7774 network: enable GatewayOnLink= if Gateway= without static address configured
And warn about that.

But this only done if GatewayOnLink= is not specified. When it is
explicitly disabled, then the flag will not be set.
2019-02-28 10:34:21 +09:00
Yu Watanabe 4bec2f237b network: relax the .network file check
Previously, if a .networ file contains invalid [Address] or [Route]
section, then the file is completely dropped. This makes networkd
just drops invalid sections.
2019-02-28 10:01:56 +09:00
Lennart Poettering 200fb167a2
Merge pull request #11844 from keszybz/networkd-fuzzer-fixes
Networkd fuzzer fixes
2019-02-27 17:45:55 +01:00
Zbigniew Jędrzejewski-Szmek 4b151b7132
Merge pull request #11807 from yuwata/test-vlan-mtu
network: increase MTU if VLAN= or MACVLAN= requests higher value
2019-02-27 17:15:29 +01:00
Zbigniew Jędrzejewski-Szmek c448459d56 networkd: refuse more than 128 NTP servers
This test case is a bit silly, but it shows that our code is unprepared to
handle so many network servers, with quadratic complexity in various places.
I don't think there are any valid reasons to have hundres of NTP servers
configured, so let's just emit a warning and cut the list short.

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13354
2019-02-27 14:52:33 +01:00
Zbigniew Jędrzejewski-Szmek 83ec459276 networkd: fix memleak when the same NetDev is specified twice
hashmap_put() returns 0 if the (key, value) pair is already present in the
hashmap, and -EEXIST if the key exists, but the value is different.

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13433
2019-02-27 14:31:28 +01:00
Zbigniew Jędrzejewski-Szmek 3772cfde03 network: wrap some long lines 2019-02-27 13:35:19 +01:00
Yu Watanabe 80be3de31f network: fix error code in log 2019-02-27 16:48:19 +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 102bc043bb network: assign Network::manager when it is listed to the manager object.
Now Network::manager is not necessary during parsing configs.

C.f. 838b2f7a30.
2019-02-26 10:06:27 +09:00
Yu Watanabe cebe12571d network: make resolving NetDev names delayed and moved to network_verify()
And before resolving NetDev names, check conditions in .network,
and if they do not match the system environment, drop the network
unit earlier.

Fixes #4211.
2019-02-26 10:06:23 +09:00
Yu Watanabe 8f1918016f network: disable LinkLocalAddressing= and IPv6AcceptRA= on bridge slaves by default
If they are not explicitly configured, then let's disable these
functionality on bridge slaves.
2019-02-25 09:34:14 +09: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
Zbigniew Jędrzejewski-Szmek ab24039ff9 networkd: wrap long log lines 2019-02-20 21:30:06 +01:00
Yu Watanabe 0321cea7b7 network: introduce network_verify()
Some settings cannot set simultaneously. Let's warn and drop
incompatible settings.

Currently, it is not comprehensive. But this may be a good first step.
2019-02-20 06:12:54 +09:00
Yu Watanabe 41f62accad network: warn about deprecated value in DHCP= 2019-02-20 06:12:53 +09:00
Lennart Poettering bde06abd4f
Merge pull request #10408 from keszybz/analyze-cat-presets
systemd-analyze cat-presets
2019-02-18 16:02:45 +01:00
Lennart Poettering 9c5675af76
Merge pull request #11729 from yuwata/fix-11721
sd-device: also store properties read from udev database to sd_device::properties_db
2019-02-18 16:02:26 +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
Zbigniew Jędrzejewski-Szmek dc0d407851 udev,network: use standard paths for .network and .link files
This centralizes the configuration to one header file.
/usr/local/lib is now included in the search list, and documentation is
updated accordingly.
2019-02-18 10:29:33 +01:00
Yu Watanabe 4f4daf418f udev,network: drop unused parent_driver argument from net_match_config()
The argument has never been used.
2019-02-17 00:47:49 +09:00
Lennart Poettering 84e4b0b893
Merge pull request #11716 from ssahani/drop-autoconf-address
networkd: ipv6ra allow to ignore addresses
2019-02-15 12:17:46 +01:00
Yu Watanabe d5fa333960 network: introduce Network::ipv6_accept_ra_route_table_set flag
It will be used in later commit.
2019-02-15 10:58:22 +09:00
Susant Sahani 062c2eea3a networkd: ipv6ra allow to ignore addresses
Allows to ignore prefixes.

```
UseAutonomousPrefix=
UseOnLinkPrefix=
```

closes #9582
2019-02-14 21:05:17 +05:30
Yu Watanabe c606db69ab network: fix errno in log_syntax()
in_addr_is_null() returns boolean if the first argument is valid.
So, passing the return value to log_syntax() as errno is wrong.
2019-02-11 01:28:09 +09:00
Yu Watanabe 838b2f7a30 network: unset Network::manager when loading .network file fails
Otherwise, LIST_REMOVE() in network_free() fails.

This fixes the following assertion:
```
systemd-networkd[2595]: Bus bus-api-network: changing state UNSET → OPENING
systemd-networkd[2595]: Bus bus-api-network: changing state OPENING → AUTHENTICATING
systemd-networkd[2595]: timestamp of '/etc/systemd/network' changed
systemd-networkd[2595]: /etc/systemd/network/10-hoge.network:1: Invalid section header '[Network]Address=192.168.0.1'
systemd-networkd[2595]: /etc/systemd/network/10-hoge.network:1: Failed to parse file: Bad message
systemd-networkd[2595]: Assertion '*_head == _item' failed at ../../home/watanabe/git/systemd/src/network/networkd-network.c:378, function network_free(). Aborting.
valgrind[2595]: ==2595==
valgrind[2595]: ==2595== Process terminating with default action of signal 6 (SIGABRT): dumping core
valgrind[2595]: ==2595==    at 0x4BCA53F: raise (in /usr/lib64/libc-2.28.so)
valgrind[2595]: ==2595==    by 0x4BB4894: abort (in /usr/lib64/libc-2.28.so)
valgrind[2595]: ==2595==    by 0x4955F09: log_assert_failed_realm (log.c:795)
valgrind[2595]: ==2595==    by 0x417101: network_free (networkd-network.c:378)
valgrind[2595]: ==2595==    by 0x415E99: network_freep (networkd-network.h:282)
valgrind[2595]: ==2595==    by 0x416AB2: network_load_one (networkd-network.c:101)
valgrind[2595]: ==2595==    by 0x416C39: network_load (networkd-network.c:293)
valgrind[2595]: ==2595==    by 0x414031: manager_load_config (networkd-manager.c:1502)
valgrind[2595]: ==2595==    by 0x40B258: run (networkd.c:82)
valgrind[2595]: ==2595==    by 0x40B74A: main (networkd.c:117)
valgrind[2595]: ==2595==
valgrind[2595]: ==2595== HEAP SUMMARY:
valgrind[2595]: ==2595==     in use at exit: 32,621 bytes in 201 blocks
valgrind[2595]: ==2595==   total heap usage: 746 allocs, 545 frees, 241,027 bytes allocated
valgrind[2595]: ==2595==
valgrind[2595]: ==2595== LEAK SUMMARY:
valgrind[2595]: ==2595==    definitely lost: 0 bytes in 0 blocks
valgrind[2595]: ==2595==    indirectly lost: 0 bytes in 0 blocks
valgrind[2595]: ==2595==      possibly lost: 0 bytes in 0 blocks
valgrind[2595]: ==2595==    still reachable: 32,621 bytes in 201 blocks
valgrind[2595]: ==2595==         suppressed: 0 bytes in 0 blocks
valgrind[2595]: ==2595== Reachable blocks (those to which a pointer was found) are not shown.
valgrind[2595]: ==2595== To see them, rerun with: --leak-check=full --show-leak-kinds=all
valgrind[2595]: ==2595==
valgrind[2595]: ==2595== For counts of detected and suppressed errors, rerun with: -v
valgrind[2595]: ==2595== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
systemd-coredump[2600]: Process 2595 (memcheck-amd64-) of user 192 dumped core.
```
2019-01-21 15:53:12 +01:00
Lennart Poettering 7ece6f5897 networkd: permit DNS "DefaultRoute" configuration in .network files 2018-12-21 12:10:07 +01:00
Lennart Poettering 09451975df networkd: small simplification 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
Lennart Poettering ec68d13789
Merge pull request #10897 from keszybz/etc-fstab-parsing
Forbid dashes in hostnames and /etc/fstab parsing improvements
2018-12-10 12:31:30 +01:00
Zbigniew Jędrzejewski-Szmek 7470cc4c73 resolve: reject host names with leading or trailing dashes in /etc/hosts
https://tools.ietf.org/html/rfc1035#section-2.3.1 says (approximately)
that only letters, numbers, and non-leading non-trailing dashes are allowed
(for entries with A/AAAA records). We set no restrictions.

hosts(5) says:
> Host names may contain only alphanumeric characters, minus signs ("-"), and
> periods (".").  They must begin with an alphabetic character and end with an
> alphanumeric character.

nss-files follows those rules, and will ignore names in /etc/hosts that do not
follow this rule.

Let's follow the documented rules for /etc/hosts. In particular, this makes us
consitent with nss-files, reducing surprises for the user.

I'm pretty sure we should apply stricter filtering to names received over DNS
and LLMNR and MDNS, but it's a bigger project, because the rules differ
depepending on which level the label appears (rules for top-level names are
stricter), and this patch takes the minimalistic approach and only changes
behaviour for /etc/hosts.

Escape syntax is also disallowed in /etc/hosts, even if the resulting character
would be allowed. Other tools that parse /etc/hosts do not support this, and
there is no need to use it because no allowed characters benefit from escaping.
2018-12-10 09:56:56 +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
Yu Watanabe 801503d22b
Merge pull request #10988 from ssahani/IFLA_BRPORT_MCAST_TO_UCAST
networkd: bridge add support to configure multicast_to_unicast
2018-12-06 14:32:52 +01:00
Yu Watanabe 36dd5ffd5d util: drop missing.h from util.h 2018-12-04 10:00:34 +01:00
Susant Sahani d3aa8b49e5 networkd: bridge add support to configure multicast_to_unicast
closes #10649
2018-12-03 23:49:46 +05:30
Yu Watanabe 7a08d314f2 tree-wide: make hash_ops typesafe 2018-12-02 07:53:27 +01:00
Yu Watanabe 3e5700428e network: allocate hashmap objects when they are required 2018-11-12 16:32:11 +09:00
Yu Watanabe 17f9c355d5 network: use structured initializers 2018-11-12 16:32:10 +09:00
Yu Watanabe 1a75764a32 network: use NetworkConfigSection in fdb entries 2018-11-12 16:32:10 +09:00
Yu Watanabe fa6f1e54e3 network: use hashmap_free_with_destructor() in network_free() 2018-11-11 11:36:16 +09:00
Yu Watanabe cdd7812b12 network: fix missing free() in network_free()
Fixes oss-fuzz#11345.
2018-11-11 11:21:31 +09:00
Yu Watanabe e512c6c1aa network: fix potential segfault in network_free() 2018-11-09 11:45:12 +09:00
Yu Watanabe 28c3428df0 network: adds missing strv_free()
Fixes oss-fuzz#11285.
2018-11-08 12:30:03 +09:00
Yu Watanabe 7a99f98b50 network: make config_parse_radv_search_domains() log error in dns_name_apply_idna() 2018-11-08 12:29:38 +09:00
Evgeny Vereshchagin 212bd73c78 networkd: make network_load_one "public" and add a fuzzer for it 2018-11-06 19:01:32 +01:00
Evgeny Vereshchagin 0621f03b13 networkd: remove a weird assertion from network_load_one
The assertion was added in dbffab87f1 but I'm not exactly sure
why. Now it just crashes a fuzzer I wrote. I, of course, could fix the fuzzer
so that it would generate names ending in ".network" if anyone would tell
me why the assertion should be kept here.
2018-11-06 19:01:32 +01:00
Yu Watanabe 25ed70f76f network: fix possible memleak caused by multiple setting of Bridge=, Bond= or VRF= 2018-11-04 00:31:46 +09:00
Yu Watanabe 727ba17f55 network: fix memleak around Network.dhcp_vendor_class_identifier 2018-09-27 17:48:34 +09:00
Zbigniew Jędrzejewski-Szmek 9d0798a2ed
Merge pull request #9832 from yuwata/fix-9831
network: fixes related to setting MTU
2018-09-08 17:17:07 +02:00
Zbigniew Jędrzejewski-Szmek c07fe6d0df Merge pull request #9406 from yuwata/rfe-9228
Trivial conflict solved in merge and include net/if_arp.h added.
2018-08-23 11:11:13 +02:00
Yu Watanabe 51517f9e09 network: replace udev_device by sd_device 2018-08-23 04:57:39 +09:00
Yu Watanabe 7169cdc8b9 network: prohibit to set MTUBytes= and UseMTU= simultaneously 2018-08-13 16:14:56 +09:00
Yu Watanabe 27dfc98275 network: request product UUID when DUIDType=uuid but DUIDRawData= is not set
Closes #9228.
2018-08-08 10:15:00 +09:00
Filipe Brandenburger 26cdf3e50b network: Use CMP() macro for comparison.
Follow up for PRs #9764 and #9760.
2018-08-06 19:19:12 -07:00
Yu Watanabe 19f9e4e2c8 network: use free_and_replace() 2018-08-06 10:46:05 +09:00
Yu Watanabe 6528693a94 network: also check that Hostname= is a valid DNS domain name 2018-08-06 10:46:05 +09:00
Yu Watanabe ca52812a94 network: make compare functions safe
As the variable 'line' is unsigned.
2018-08-02 17:06:03 +09:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Iwan Timmer c9299be2f5 resolve: rename PrivateDNS to DNSOverTLS
PrivateDNS is not considered a good name for this option, so rename it to DNSOverTLS
2018-06-14 09:57:56 +02:00
Iwan Timmer d050561ac3 resolve: make PrivateDNS configurable per link
Like with DNSSec, make PrivateDNS configurable per link, so you can have trusted and untrusted links.
2018-06-11 21:35:58 +02:00
Hiram van Paassen 06828bb617 networkd-link: add support to configure CAN interfaces
This patch adds support for kind "can". Fixes: #4042.
2018-06-09 15:12:31 +02:00
Susant Sahani 866e6b7a12 networkd: enable to set IFF_ALLMULTI to network device (#9146)
networkd: allow setting set IFF_ALLMULTI flag on network devices
2018-06-01 16:22:12 +02:00
Susant Sahani e6ebebbe6a networkd: Add ability to set MULTICAST flag on interface
Closes #9113

fix ARP toggling flag
2018-05-30 12:59:24 +02:00
Mike Gilbert 089fb8653f basic: add log_level argument to timezone_is_valid 2018-05-12 15:20:13 -04:00
Yu Watanabe e90d037411 network,udev: make MACAddress= in [Match] section take multiple MAC addresses 2018-05-09 11:59:18 +09:00
Susant Sahani af1c0de0e1 networkd: add support to send DHCP user class option (#7499)
This patch add support to enables to send User Class option code 77
RFC 3004.

This option MAY carry multiple User Classes.

The format of this option is as follows:

         Code   Len   Value
        +-----+-----+---------------------  . . .  --+
        | 77  |  N  | User Class Data ('Len' octets) |
        +-----+-----+---------------------  . . .  --+

   where Value consists of one or more instances of User Class Data.
   Each instance of User Class Data is formatted as follows:

         UC_Len_i     User_Class_Data_i
        +--------+------------------------  . . .  --+
        |  L_i   | Opaque-Data ('UC_Len_i' octets)   |
        +--------+------------------------  . . .  --+

UserClass=
A DHCPv4 client can use UserClass option to identify the type or category of user or applications
it represents. The information contained in this option is an string that represents the user class
of which the client is a member. Each class sets an identifying string of information to be used by the DHCP service to classify clients. Takes a whitespace-separated list.

UserClass= hello world how are you

Closes: RFC: #5134
2018-05-07 14:21:02 +02:00
Susant Sahani 7f9915f0de networkd: Bridge Property Use kernel defaults. (#8825)
Rather than choosing to set or unset any of these flag
use kernel defaults. This patch makes following properties to unset.

UseBPDU = unset
HairPin = unset
FastLeave = unset
AllowPortToBeRoot = unset
UnicastFlood = unset
2018-04-27 10:32:28 +02:00
Lennart Poettering 4e964aa05c networkd,udev: clean up MTU handling
This cleans up handling of MTU values across the codebase. Previously
MTU values where stored sometimes in uint32_t, sometimes in uint16_t,
sometimes unsigned and sometimes in size_t. This now unifies this to
uint32_t across the codebase, as that's what netlink spits out, and what
the majority was already using.

Also, all MTU parameters are now parsed with config_parse_mtu() and
config_parse_ipv6_mtu() is dropped as it is now unneeded.

(Note there is one exception for the MTU typing: in the DCHPv4 code we
continue to process the MTU as uint16_t value, as it is encoded like
that in the protocol, and it's probably better stay close to the
protocol there.)
2018-04-26 13:51:44 +02:00
Lennart Poettering 8e766630f0 tree-wide: drop redundant _cleanup_ macros (#8810)
This drops a good number of type-specific _cleanup_ macros, and patches
all users to just use the generic ones.

In most recent code we abstained from defining type-specific macros, and
this basically removes all those added already, with the exception of
the really low-level ones.

Having explicit macros for this is not too useful, as the expression
without the extra macro is generally just 2ch wider. We should generally
emphesize generic code, unless there are really good reasons for
specific code, hence let's follow this in this case too.

Note that _cleanup_free_ and similar really low-level, libc'ish, Linux
API'ish macros continue to be defined, only the really high-level OO
ones are dropped. From now on this should really be the rule: for really
low-level stuff, such as memory allocation, fd handling and so one, go
ahead and define explicit per-type macros, but for high-level, specific
program code, just use the generic _cleanup_() macro directly, in order
to keep things simple and as readable as possible for the uninitiated.

Note that before this patch some of the APIs (notable libudev ones) were
already used with the high-level macros at some places and with the
generic _cleanup_ macro at others. With this patch we hence unify on the
latter.
2018-04-25 12:31:45 +02:00
Susant Sahani 11102cba69 networkd: add support to configure IPv6 MTU (#8664)
This patch supports to configure IPv6 MTU.

Closes #8632
2018-04-20 11:38:39 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Lennart Poettering ae2a15bc14 macro: introduce TAKE_PTR() macro
This macro will read a pointer of any type, return it, and set the
pointer to NULL. This is useful as an explicit concept of passing
ownership of a memory area between pointers.

This takes inspiration from Rust:

https://doc.rust-lang.org/std/option/enum.Option.html#method.take

and was suggested by Alan Jenkins (@sourcejedi).

It drops ~160 lines of code from our codebase, which makes me like it.
Also, I think it clarifies passing of ownership, and thus helps
readability a bit (at least for the initiated who know the new macro)
2018-03-22 20:21:42 +01:00
Yu Watanabe dace710c4a dhcp4: introduce new option 'duid-only' for ClientIdentifier= (#8350)
This makes users can configure DHCPv4 client with ClientIdentifier=duid-only.
If set so, then DHCP client sends only DUID as the client identifier.
This may not be RFC compliant, but some setups require this.

Closes #7828.
2018-03-12 17:18:07 +01:00
Lennart Poettering 62d74c78b5 coccinelle: add reallocarray() coccinelle script
Let's systematically make use of reallocarray() whereever we invoke
realloc() with a product of two values.
2018-03-02 12:39:07 +01:00
Zbigniew Jędrzejewski-Szmek 87ac8d998f tree-wide: use "cannot" instead of "can not"
This is the usual spelling, and a bit shorter.
2018-02-08 10:34:52 +01:00
Susant Sahani fb5c821664 networkd: DHCPv6 client allow to configure Rapid Commit (#6930)
The DHCPv6 client can obtain configuration parameters from a
DHCPv6 server through a rapid two-message exchange solicit and reply).
When the rapid commit option is enabled by both the DHCPv6 client and
the DHCPv6 server, the two-message exchange is used, rather than the default
four-method exchange (solicit, advertise, request, and reply). The two-message
exchange provides faster client configuration and is beneficial in environments
in which networks are under a heavy load.

Closes #5845
2018-01-22 17:09:18 +09:00
Lennart Poettering 5022f08a23 core,udev,networkd: add ConditionKernelVersion=
This adds a simple condition/assert/match to the service manager, to
udev's .link handling and to networkd, for matching the kernel version
string.

In this version we only do fnmatch() based globbing, but we might want
to extend that to version comparisons later on, if we like, by slightly
extending the syntax with ">=", "<=", ">", "<" and "==" expressions.
2017-12-26 17:39:44 +01:00
Mathieu Trudel-Lapierre c1a3890410 Add a "RequiredForOnline=" Link attribute for .network files (#7347)
RequiredForOnline= denotes a link/network that does/does not require being up
for systemd-networkd-wait-online to consider the system online; this makes it
possible to ignore devices without modifying parameters to wait-online.
2017-11-30 18:03:50 +01:00
Zbigniew Jędrzejewski-Szmek 53e1b68390 Add SPDX license identifiers to source files under the LGPL
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-19 19:08:15 +01:00
Lennart Poettering bcde742e78 conf-parser: turn three bool function params into a flags fields
This makes things more readable and fixes some issues with incorrect
flag propagation between the various flavours of config_parse().
2017-11-13 10:24:03 +01:00
juga0 28522b0d8c networkd: set dhcp_use_routes to true when dhcp_anonymize is true (#7209)
It does not send duplicated options in the PRL.
Fix #7048.
2017-11-10 16:03:43 +01:00
Patrik Flykt 9e25315caa networkd: Add EmitDNS and EmitDomains configuration options
Add EmitDNS= and EmitDomains= options to the IPv6PrefixDelegation
network configuration file section so that sending DNS servers
and DNS search domains can be configured independent of each other.

The default values for both are set to true.
2017-10-06 12:30:27 +03:00
Andrew Jeddeloh 95ab9eff1e Revert "networkd: change UseMTU default to true. (#6837)" (#6950)
This reverts commit 22043e4317.
UseMTU is broken on real hardware and should not be enabled by default.
2017-10-05 12:58:02 +02:00
Zbigniew Jędrzejewski-Szmek d29ad81e3b Minor line wrapping adjustment 2017-10-02 14:52:12 +02:00
Andreas Rammhold ec2ce0c5d7
tree-wide: use `!IN_SET(..)` for `a != b && a != c && …`
The included cocci was used to generate the changes.

Thanks to @flo-wer for pointing this case out.
2017-10-02 13:09:56 +02:00
Lennart Poettering cd4826e0e6 Merge pull request #6924 from andir/vrf-dhcpv4
networkd: use VRFs routing table for DHCP routes
2017-09-28 09:46:03 +02:00
Andreas Rammhold fc1ba79d65 networkd: use VRFs routing table for DHCP routes
When an interface has been enslaved to a VRF the received routes should
be added to the VRFs RT instead of the main table.

This change modifies the default behaviour of routes in the case where a
network belongs to an VRF.  When the user does not configure a
`DHCP.RouteTable` in a `systemd.network` file and the interface belongs
to a VRF, the VRFs routing table is used instead of RT_TABLE_MAIN.

When the user has configured a custom routing table for DHCP the VRFs
table is ignored and the users preference takes precedence.
2017-09-27 20:02:15 +02:00
Dimitri John Ledkov 22043e4317 networkd: change UseMTU default to true. (#6837)
Typically when DHCP server sets MTU it is a lower one. And a lower than usual
MTU is then thus required on said network to have operational networking. This
makes networkd's dhcp client to work in more similar way to other dhcp-clients
(e.g. isc-dhcp). In particular, in a cloud setting, without this default
instances have resulted in timing out talking to cloud metadata source and
failing to provision.

This does not change this default for the Annonymize code path.
2017-09-19 10:26:17 +02:00
Patrik Flykt 700f1186e3 networkd: Parse DNS search domain information for Router Advertisement
Parse DNS search domains from .network files so that they are included
in Router Advertisement DNSSL options.

DNS search domains are added to the [IPv6PrefixDelegation] section using
the following syntax:

    Domains=foo.example.com bar.example.com

If IDNA libraries are enabled in systemd, international domain names
are supported.
2017-09-15 10:34:57 +03:00
Susant Sahani bce67bbee3 networkd: add support to configure IP Rule (#5725)
Routing Policy rule manipulates rules in the routing policy database control the
route selection algorithm.

This work supports to configure Rule
```
[RoutingPolicyRule]
TypeOfService=0x08
Table=7
From= 192.168.100.18

```

```
ip rule show
0:	from all lookup local
0:	from 192.168.100.18 tos 0x08 lookup 7
```

V2 changes:

1. Added logic to handle duplicate rules.
2. If rules are changed or deleted and networkd restarted
   then those are deleted when networkd restarts next time

V3:

1. Add parse_fwmark_fwmask
2017-09-14 21:51:39 +02:00
Lennart Poettering b50846055e exec-util,conf-files: skip non-executable files in execute_directories()
Fixes: #6787
2017-09-13 11:42:31 +02:00
Lennart Poettering 9ecf63a457 Merge pull request #6616 from pfl/rdnss
networkd: RDNSS option for systemd-networkd prefix delegation
2017-09-07 19:01:57 +02:00
Patrik Flykt 88295a05db networkd: Parse DNS IPv6 information for Router Advertisement
Parse DNS IPv6 addresses and DNS server lifetime from .network files
so that they can be included in Router Advertisement RDNSS options.

RDNSS address and lifetime information is added to the
[IPv6PrefixDelegation] section according to the following syntax:

DNS=2001:db8:🅰️b 2001:db8::c:d
DNSLifetimeSec=1042
2017-09-07 09:51:26 +03:00
juga0 add8d07d91 networkd: RFC7844, add network variable and function
to initialize Network variables when Anonymize is true.

* do not send hostname
* client identifier set to MAC
* do not send vendor class identifier
* do not send other PRL options
2017-09-06 19:03:25 +02:00
Susant Sahani 499d555a79 networkd: fix spell DCHPClientIdentifier (DCHP => DHCP) 2017-08-15 10:20:25 +05:30
Patrik Flykt 7d5cac19b5 networkd: Add Router Advertisement variables
Add variables for enabling Router Advertisements, router lifetime as
well as managed and other information flags indicating use of DHCPv6.
Add configuration of default router preferences as defined in RFC 4191.

IPv6PrefixDelegation in the [Network] section has to be set in order
to enable prefix delegation. The rest of the prefix delegation values
are stored in the [IPv6PrefixDelegation] section. The host will act as
a default router if it is given a non-zero lifetime with
RouterLifetimeSec. Managed and OtherInformation booleans set the level
of DHCPv6 support, and the RouterPreference configures the router's
preference between low, medium and high. Words 'normal' and 'default'
are added as synonyms for 'medium' just to make configuration simpler.

This adds a section like the following to .network configuration files:
[Network]
IPv6PrefixDelegation=true

[IPv6PrefixDelegation]
RouterLifetimeSec=2000
Managed=false
OtherInformation=true
RouterPreference=medium
2017-05-15 14:49:50 +03:00
Patrik Flykt 9d5d0090ca networkd: Add IPv6Prefix sections to the network configuration files
Support zero or more [IPv6Prefix] sections in the network configuration
files. Each section can have one Prefix=<subnet>[/<prefixlength>]
option, with the preferred and valid lifetimes specified by
ValidLifetimeSec and PreferredLifetimeSec measured in seconds, and
with onlink and address autoconfiguration booleans specified by
OnLink and AddressAutoconfiguration variables.

This adds a section like the following to .network configuration files:
[IPv6Prefix]
Prefix=2001:db8:dead:beef::/64
OnLink=true
AddressAutoconfiguration=true
ValidLifetimeSec=1500
PreferredLifetimeSec=1000
2017-05-15 14:49:50 +03:00
Patrik Flykt 057abfd88a networkd: Add initial prefix handling for network configuration
Add initial code for handling prefixes in network configuration files.
Add hash map and list storing the information in systemd-networkd.
2017-05-15 14:49:50 +03:00
Hristo Venev 465dfe59fc networkd: add IPv6ProxyNDP (#5913)
This allows enabling proxy_ndp even if no addresses are configured in
networkd, as well as disabling proxy_ndp from a drop-in.
2017-05-09 20:04:55 +02:00
Susant Sahani 95b74ef6ea networkd: add support for address label
IPv6 address labels are used for address selection; they are described in RFC 3484.
Precedence is managed by userspace, and only the label itself is stored in the kernel.

enp0s25.network

[Match]
Name=enp0s25

[Network]
DHCP=yes
Address = 2001:db8:f00:baa::b

[AddressLabel]
Label=199
Prefix=2001:db8:41::/64

[AddressLabel]
Label=11
Prefix=2001:db8:31::/64

[AddressLabel]
Label=123
Prefix=2001:db8:21::/64

[AddressLabel]
Label=124
Prefix=2001:db8:11::/64
[sus@maximus label]$ ip addrlabel list

prefix ::1/128 label 0
prefix ::/96 label 3
prefix ::ffff:0.0.0.0/96 label 4
prefix 2001:db8:41::/64 dev enp0s25 label 199
prefix 2001:db8:31::/64 dev enp0s25 label 11
prefix 2001:db8:21::/64 dev enp0s25 label 123
prefix 2001:db8:11::/64 dev enp0s25 label 124
prefix 2001::/32 label 6
prefix 2001:10::/28 label 7
prefix 3ffe::/16 label 12
prefix 2002::/16 label 2
prefix fec0::/10 label 11
prefix fc00::/7 label 5
prefix ::/0 label 1
2017-04-26 16:00:44 +05:30
Dimitri John Ledkov b56be2966a networkd: Add bridge port priority setting (#5545)
Allow setting bridge port priority in the Bridge section of the network file,
similar to e.g. port path cost setting.

Set the default to an invalid value of 128, and only set the port priority when
it's not 128. Unlike e.g. path cost, zero is a valid priority value.

Add a networkd-test.py to check that bridge port priority is correctly set.

Incidently, fix bridge port cost type and document valid ranges.
2017-04-11 23:17:31 +02:00
Susant Sahani 0b180d754c networkd: fix route_new_static assert when IPv4LLRoute=true (#5676)
fixes: #5664
2017-03-31 08:29:20 +02:00
Susant Sahani f4859fc74c networkd: fix drop-in conf directory configs overwriting each other
Now we track the sections for example [Address] via line number.
Which was fine till we din't had dropins dir. If we have multiple
sections which have the ideantical line number in diffrent files
we are overwriting these since line number is the key.

This patch fixes this by taking filename and line number as key.
This fixes [Address] and [Route] section overwriting.

fixes: #5141
2017-02-16 10:31:42 +05:30
Florian Klink a0e5c15d4f networkd: add IPv6ProxyNDPAddress support (#5174)
IPv6 Neighbor discovery proxy is the IPv6 equivalent to proxy ARP for IPv4.
It is required when ISPs do not unconditional route IPv6 subnets
to their designated target, but expect neighbor solicitation messages
for every address on a link.

A variable IPv6ProxyNDPAddress= is introduced to the [Network] section,
each representing a IPv6 neighbour proxy entry in the neighbour table.
2017-02-11 00:47:55 +01:00
Lennart Poettering 5512a96316 networkd: store DNS servers configured per-network as parsed addresses
DNS servers must be specified as IP addresses, hence let's store them as that
internally, so that they are guaranteed to be fully normalized always, and
invalid data cannot be stored.
2016-11-21 22:58:26 +01:00
Lennart Poettering fa105ce6b7 networkd: minor word extraction fixes
Let's make the loops around extract_first_word() be more alike.
2016-11-21 22:58:26 +01:00
Lennart Poettering 265759908d networkd: validate NTP server strings configured in .network files
Let's be a bit stricter, and make sure users only configure proper DNS names or
IP addresses, but not any other strings.
2016-11-21 22:58:26 +01:00
Tom Gundersen 23f53b99b1 networkd: clean up main header file a bit
Rename networkd.h to networkd-manager.h, to more accurately describe what it
contains.
2016-11-14 01:05:06 +01:00
Tom Gundersen 7d342c0332 networkd: network - apply() does not need to take the manager object 2016-11-13 01:02:46 +01:00
Zbigniew Jędrzejewski-Szmek 9a82ab9592 tree-wide: drop unneded WHITESPACE param to extract_first_word
It's the default, and NULL is shorter.
2016-11-05 15:35:51 -04:00
Susant Sahani 5325382440 networkd : verify dns ip address when parsing configuration (#4492)
Invalid IP addresses would be passed through as-is:
$ networkctl status wlp3s0:
● 2: wlp3s0
       Link File: /usr/lib/systemd/network/99-default.link
    Network File: /etc/systemd/network/wlp3s0.network
            Type: wlan
           State: routable (configured)
            Path: pci-0000:03:00.0
          Driver: iwlwifi
          Vendor: Intel Corporation
           Model: Centrino Advanced-N 6205 [Taylor Peak] (Centrino Advanced-N 6205 AGN)
      HW Address: XXXXXXXXXX (Intel Corporate)
         Address: 192.168.2.103
                  XXXXXXXXXXX
         Gateway: 192.168.2.1 (Arcadyan Technology Corporation)
             DNS: 127.0.0.5553

Instead verify that DNS= has a valid list of addresses when parsing configuration.

Fixes #4462.
2016-10-26 19:31:04 -04:00
Jason Kölker 2ba31d29a5 networkd: Allow specifying RouteTable for RAs 2016-09-19 03:27:46 +00:00
Jason Kölker f594276b86 networkd: Allow specifying RouteTable for DHCP 2016-09-19 03:27:42 +00:00
Martin Pitt 6ac288a990 Merge pull request #4123 from keszybz/network-file-dropins
Network file dropins
2016-09-17 10:00:19 +02:00
Zbigniew Jędrzejewski-Szmek 23bb31aa0a shared/conf-parser: add config_parse_many which takes strv with dirs
This way we don't have to create a nulstr just to unpack it in a moment.
2016-09-16 10:32:03 -04:00
Zbigniew Jędrzejewski-Szmek 43688c49d1 tree-wide: rename config_parse_many to …_nulstr
In preparation for adding a version which takes a strv.
2016-09-16 10:32:03 -04:00
Jean-Sébastien Bour 047a0dacde networkd: support drop-in directories for .network files
Fixes #3655.

[zj: Fix the tests.]
2016-09-16 10:31:58 -04:00
Susant Sahani a4820c463a networkd: network fix log message 2016-09-15 10:19:26 +05:30
Susant Sahani 92c918b06d networkd: add support to configure virtual CAN device (#4139)
1. add support for kind vcan
2. fixup indention netlink-types.c, networkd-netdev.c
2016-09-14 18:15:16 +02:00
Susant Sahani 2ad6b61049 networkd: remove duplicate call to manager_dirty (#3917)
since link_dirty itself calls manager_dirty no need to
call it separately .
2016-08-07 11:23:32 +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
Andreas Rammhold 6cb955c6a1 networkd: vrf: add support for enslaving devices to VRFs 2016-06-16 00:25:06 +02:00
Tobias Jungel 13b498f967 networkd: add support to configure VLAN on bridge ports 2016-06-10 09:10:41 +02:00