Commit Graph

152 Commits

Author SHA1 Message Date
Lennart Poettering b2a81c0b52 networkd: optinally use DHCP lease domain info for routing only
This changes the UseDomains= setting of .network files to take an optional third value "route", in addition to the
boolean values. If set, the passed domain information is used for routing rules only, but not for the search path
logic.
2016-01-26 14:42:04 +01:00
Lennart Poettering 27cb34f574 networkd: rename a few Network object properties to be more like the configuration settings
All booleans called dhcp_xyz are now called ".dhcp_use_xyz", to match their respective configuration file settings. This
should clarify things a bit, in particular as there is a DHCP hostname that was previously called just ".hostname"
because ".dhcp_hostname" was already existing as a bool. Since this confusion is removed now because the bool is called
".dhcp_use_hostname", the string field is now renamed to ".dhcp_hostname".
2016-01-26 14:42:04 +01:00
Lennart Poettering 3df9bec57c networkd: rework Domains= setting
Previously, .network files only knew a vaguely defined "Domains=" concept, for which the documentation declared it was
the "DNS domain" for the network connection, without specifying what that means.

With this the Domains setting is reworked, so that there are now "routing" domains and "search" domains. The former are
to be used by resolved to route DNS request to specific network interfaces, the latter is to be used for searching
single-label hostnames with (in addition to being used for routing). Both settings are configured in the "Domains="
setting. Normal domain names listed in it are now considered search domains (for compatibility with existing setups),
while those prefixed with "~" are considered routing domains only. To route all lookups to a specific interface the
routing domain "." may be used, referring to the root domain. An alternative syntax for this is the "*", as was already
implemented before using the "wildcard" domain concept.

This commit adds proper parsers for this new logic, and exposes this via the sd-network API. This information is not
used by resolved yet, this will be added in a later commit.
2016-01-26 14:42:03 +01:00
Lennart Poettering 8a516214c4 resolved: introduce support for per-interface negative trust anchors 2016-01-06 18:36:32 +01:00
Lennart Poettering ad6c047561 resolved,networkd: add a per-interface DNSSEC setting
This adds a DNSSEC= setting to .network files, and makes resolved honour
them.
2016-01-05 20:10:31 +01:00
Lennart Poettering aaa297d4e5 networkd,resolved: add a per-interface mdns configuration option 2016-01-05 17:41:41 +01:00
Susant Sahani b69c318040 networkd: Add support to configure IPV6 hop limit
This patch adds support to configure IPV6 hop limit.

For example:
/proc/sys/net/ipv6/conf/wlp3s0/hop_limit
2015-11-10 09:26:38 +05:30
Tom Gundersen c4a03a5669 networkd: link - deserialize
For now only deserialize some basic state and the applied addresses.

When a link is added, try to deserialize it's state from /run. This
is relevant only when networkd is restarted at runtime.
2015-10-30 12:32:49 +01:00
Tom Gundersen 86655331bc networkd: route - clean up confusion between 'metric' and 'priority'
Different tools use different terms for the same concept, let's try
to stick with 'priority', as that is what the netlink API uses.
2015-10-30 12:32:48 +01:00
Tom Gundersen 2ce4095690 networkd: route - rename fields in struct 2015-10-30 12:32:48 +01:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 8b43440b7e util-lib: move string table stuff into its own string-table.[ch] 2015-10-27 13:25:56 +01:00
Lennart Poettering 8fcde01280 util-lib: split stat()/statfs()/stavfs() related calls into stat-util.[ch] 2015-10-27 13:25:56 +01:00
Lennart Poettering 6bedfcbb29 util-lib: split string parsing related calls from util.[ch] into parse-util.[ch] 2015-10-27 13:25:55 +01:00
Lennart Poettering 3ffd4af220 util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over.
2015-10-25 13:19:18 +01:00
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Tom Gundersen 84de38c569 networkd: manager/link - only serialize once per event-loop iteration
Every time the state is written out we may trigger third-party apps, so
let's be a bit more careful about writing this out unnecessarily.
2015-10-21 03:24:23 +02:00
Susant Sahani 8749cbcd4f networkd: add support for configure IPv6 DAD
Configures Ipv6 Duplicate Address Detection.

10
2015-10-16 10:53:20 +05:30
Tom Gundersen a2fae7bbb2 networkd: link/network - correctly align log messages 2015-10-11 15:04:16 +02:00
Lennart Poettering 12ca818ffd tree-wide: clean up log_syntax() usage
- Rely everywhere that we use abs() on the error code passed in anyway,
  thus don't need to explicitly negate what we pass in

- Never attach synthetic error number information to log messages. Only
  log about errors we *receive* with the error number we got there,
  don't log any synthetic error, that don#t even propagate, but just eat
  up.

- Be more careful with attaching exactly the error we get, instead of
  errno or unrelated errors randomly.

- Fix one occasion where the error number and line number got swapped.

- Make sure we never tape over OOM issues, or inability to resolve
  specifiers
2015-09-30 22:26:16 +02:00
Susant Sahani 4f2e437ad7 networkd:add support to configure ipv6 acceprt ra
This patch support to configure the ipv6 acceprt ra option.

for more information see
http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/proc-sys-net-ipv6..html
2015-09-12 08:18:06 +05:30
Thomas Hindoe Paaboel Andersen 64d6c22905 tree-wide: do not shadow the global var timezone 2015-09-01 18:20:13 +02:00
Lennart Poettering 539f2a7381 networkd: emit DNS/NTP/Timezone info via DHCP server by default
If we have the data, emit it by default.
2015-08-27 16:47:26 +02:00
Lennart Poettering 1a04db0fc9 dhcp,network: support emitting DNS/NTP server information from DHCP server
For now, this is very simple and IP addresses have to be configured
manually.
2015-08-27 14:48:37 +02:00
Lennart Poettering fc2f9534d0 networkd: split up networkd.h into per-object header files
No functional changes, just moving definitions into separate header
files.
2015-08-27 14:01:23 +02:00
Lennart Poettering 8eb9058dc1 dhcp,network: implement RFC 4833 (DHCP Timezone option)
This one is simply to add: encode the tzdata timezone in the DHCP
options and optionally make use of it.
2015-08-26 20:44:20 +02:00
Lennart Poettering 1ac608c9cc networkd: don't leak memory of Hostname= is used twice in a .network file
Also, we should only accept trailing dots where we have to, but not
everywhere, hence be more strict when validating configured hostnames.
2015-08-26 20:41:22 +02:00
Daniel Mack a7e5da6e33 sd-network: make LLMNR specific config parser generic
Rename the enum, the lookup functions and the parser for LLMNRSupport so
the type can be reused for mDNS.
2015-08-25 14:26:01 +02:00
Zbigniew Jędrzejewski-Szmek 73974f6768 Merge branch 'hostnamectl-dot-v2'
Manual merge of https://github.com/systemd/systemd/pull/751.
2015-08-05 21:02:41 -04:00
Zbigniew Jędrzejewski-Szmek ae691c1d93 hostname-util: get rid of unused parameter of hostname_cleanup()
All users are now setting lowercase=false.
2015-08-05 20:49:21 -04:00
Zbigniew Jędrzejewski-Szmek 79f17ea6f8 networkd: allow trailing dot on fqdn in config file 2015-08-05 20:49:20 -04:00
Zbigniew Jędrzejewski-Szmek 8fb4944358 hostname-util: add relax parameter to hostname_is_valid
Tests are modified to check behaviour with relax and without relax.
New tests are added for hostname_cleanup().
Tests are moved a new file (test-hostname-util) because there's
now a bunch of them.

New parameter is not used anywhere, except in tests, so there should
be no observable change.
2015-08-05 20:49:20 -04:00
Susant Sahani f33ff02b1a networkd: add support for macvtap
This patch add support for macvtap.

see http://virt.kernelnewbies.org/MacVTap
2015-07-27 11:18:28 +05:30
Zbigniew Jędrzejewski-Szmek 23da66bb40 networkd: rename RootBlock to AllowPortToBeRoot
Justification is similar to BPDUGuard rename. "Positive" values
are easier. This is a rather uncommon option, so using a slightly
longer name should not be a problem, and may in fact may make it
easier to guess what the option does without reading the
documentation.
2015-07-24 23:44:42 -04:00
Zbigniew Jędrzejewski-Szmek 072f9e4af4 networkd: turn UnicastFlood on by default
Looking at the kernel commit, "on" seems to be the default value:
commit 867a59436fc35593ae0e0efcd56cc6d2f8506586
Author: Vlad Yasevich <vyasevic@redhat.com>
Date:   Wed Jun 5 10:08:01 2013 -0400

    bridge: Add a flag to control unicast packet flood.

    Add a flag to control flood of unicast traffic.  By default, flood is
    on and the bridge will flood unicast traffic if it doesn't know
    the destination.  When the flag is turned off, unicast traffic
    without an FDB will not be forwarded to the specified port.

... and it seems to be the reasonable thing to do by default.
2015-07-24 23:44:42 -04:00
Zbigniew Jędrzejewski-Szmek 84c3409631 networkd: rename BPDUGuard to UseBPDU
Rename to follow the follow the style of other options.

In general "positive" options are preferred to "negative" ones,
because they are easier to describe and easier for humans to
parse (c.f. the shortening on the man page entry).
2015-07-24 23:44:42 -04:00
Susant Sahani a7d0ef446e networkd: DHCP override hostname
This patch enhances the DHCP client to send the hostname
reference
http://lists.freedesktop.org/archives/systemd-devel/2014-July/021550.html

Tested with
Example conf:

[Match]
Name=eth1

[Network]
DHCP=v4

[DHCP]
SendHostname=true
Hostname=test
2015-07-10 15:42:27 +05:30
Lennart Poettering 1f0d969512 networkd: various fixes for the IPv6 privacy extensions support
- Make sure that the IPv6PrivacyExtensions=yes results in
  prefer-temporary, not prefer-public.

- Introduce special enum value "kernel" to leave setting unset, similar
  how we have it for the IP forwarding settings.

- Bring the enum values in sync with the the strings we parse for them,
  to the level this makes sense (specifically, rename "disabled" to
  "no", and "prefer-temporary" to "yes").

- Make sure we really set the value to to "no" by default, the way it is
  already documented in the man page.

- Fix whitespace error.

- Make sure link_ipv6_privacy_extensions() actually returns the correct
  enum type, rather than implicitly casting it to "bool".

- properly size formatting buffer for ipv6 sysctl value

- Don't complain if /proc/sys isn't writable

- Document that the enum follows the kernel's own values (0 = off, 1 =
  prefer-public, 2 = prefer-temporary)

- Drop redundant negating of error code passed to log_syntax()

- Manpage fixes

This fixes a number of issues from PR #417
2015-07-06 20:37:22 +02:00
Susant Sahani 49092e22c2 networkd: Add support for ipv6 privacy extension
This patch add support for ipv6 privacy extensions.

The variable  /proc/sys/net/ipv6/conf/<if>/use_tempaddr

can be changed via the boolean

IPv6PrivacyExtensions=[yes/no/prefer-temporary]

When true enables privacy extensions, but prefer public addresses over
temporary addresses.
prefer-temporary  prefers temporary adresses over public addresses.
Defaults to false.

[Match]
Name=enp0s25

[Network]
IPv6PrivacyExtensions=prefer-temporary
2015-07-05 11:24:31 +05:30
Nick Owens 8add5f7970 networkd: create "kernel" setting for IPForwarding
In 5a8bcb674f, IPForwarding was introduced
to set forwarding flags on interfaces in .network files. networkd sets
forwarding options regardless of the previous setting, even if it was
set by e.g. sysctl. This commit creates a new option for IPForwarding,
"kernel", that preserves the sysctl settings rather than always setting
them.

See https://bugs.freedesktop.org/show_bug.cgi?id=89509 for the initial
bug report.
2015-06-11 12:09:21 -07:00
Nick Owens 37de250906 libsystemd-network: use domain validation instead of hostname validation for dhcp domain option
previously hostname_is_valid was used to validate domain names, which
would silently drop perfectly valid dns names that were longer than a
single dns label.
2015-06-10 11:15:46 -07:00
Lennart Poettering 958b66ea16 util: split all hostname related calls into hostname-util.c 2015-05-18 17:10:07 +02:00
Tom Gundersen 24c083dfcb networkd: network_get - allow udev_device to be NULL
In containers we never have udev devices, so drop the assert.

This fixes an assertion introduced in af3aa30274.
2015-05-12 00:43:45 +02:00
Susant Sahani 9011ce771f networkd: introduce vti6 tunnel
This patch add support to create vti6 tunnel

test:

vt6.network
[Match]
Name=wlan0

[Network]
Tunnel=ip6vti

vti6.netdev
[NetDev]
Name=ip6vti
Kind=vti6

[Tunnel]
Local=2a00:ffde:4567:edde::4987
Remote=2001:473:fece:cafe::5179

ip link

11: ip6_vti0@NONE: <NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT
group default
    link/tunnel6 :: brd ::
12: ip6vti@wlan0: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default
    link/tunnel6 2a00:ffde:4567:edde::4987 peer 2001:473:fece:cafe::5179
2015-04-29 21:54:00 +02:00
Lennart Poettering 6a7a4e4d0a networkd: improve how networkd logs things
This makes adds a couple of fixes:

- Introduces log_netdev_error_errno() and friends, which takes an error
  number, and matches what log_link_error_errno() and friends do.

- Replaces a lof ot strerror() usage with log_netdev_error_errno(),
  log_link_error_errno() and log_erro_errno()

- Uppercases the first character of many log messages, after all this is
  supposed to be english language

- Drops manual negating of error codes before passing them to log
  functions, the log functions all do that internally anyway.

Some other minor fixes.

Behaviour should not change really.
2015-04-21 17:43:55 +02:00
Tom Gundersen af3aa30274 network: don't pass NULL to udev_device_get_driver() 2015-03-27 16:23:46 +01:00
Zbigniew Jędrzejewski-Szmek dc75168823 Use space after a silencing (void)
We were using a space more often than not, and this way is
codified in CODING_STYLE.
2015-03-13 23:42:17 -04:00
Jan Janssen 3e43b2cd97 networkd: Make DHCP client ID creation configurable 2015-03-04 11:01:39 +01:00
Alin Rauta 0d4ad91dd4 networkd: add support for Uplink Failure Detection
Introduce BindCarrier= to indicate the set of links that determine if
the current link should be brought UP or DOWN.

[tomegun: add a bit to commit message]
2015-02-27 13:58:30 -05:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00