Commit Graph

40 Commits

Author SHA1 Message Date
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
Lennart Poettering 4afd3348c7 tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.

With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.

The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).

This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.

Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:

       #define _cleanup_(function) __attribute__((cleanup(function)))

Or similar, to make the gcc feature easier to use.

Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.

See #2008.
2015-11-27 19:19:36 +01:00
Thomas Hindoe Paaboel Andersen 71d35b6b55 tree-wide: sort includes in *.h
This is a continuation of the previous include sort patch, which
only sorted for .c files.
2015-11-18 23:09:02 +01: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
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
Susant Sahani 49699bac94 LLDP: Add support for networkctl 2014-12-19 08:15:05 +05:30
Torstein Husebø 91c40d8612 networkd: Fix a couple of typos 2014-10-22 16:38:35 +02:00
Tom Gundersen adc5b2e2eb sd-network: add _get_network_file api 2014-09-08 15:09:07 +02:00
Lennart Poettering 8612e93653 sd-network: add system-wide sd_network_get_domains() API 2014-08-15 16:02:14 +02:00
Tom Gundersen 67272d157a sd-network: add support for wildcard domains 2014-08-15 15:15:24 +02:00
Tom Gundersen 9b4d1882ca sd-network: add sd_network_linkg_get_domains()
For now this only exposes the domain name (DHCP Option 15), and not
the search string (DHCP Option 119), which will be implemented in
a follow-up patch.
2014-08-14 23:13:14 +02:00
Tom Gundersen 438ca2bbd4 sd-networkd: rename link_get_state to link_get_setup_state
Suggested by Kay and Lennart.
2014-08-13 22:55:49 +02:00
Tom Gundersen d3df0e3982 sd-network: rename operstates 'down' -> 'off' and 'up' -> 'no-carrier'
Suggested by Lennart and Kay.
2014-08-13 22:44:41 +02:00
Tom Gundersen d6731e4c79 sd-network: /_get_link_/_link_get_/
The link is the 'object', so make this in line with our usual naming convention.

Suggested by Kay and Lennart.
2014-08-13 22:37:45 +02:00
Lennart Poettering 48776bdacd sd-network: bring comments up-to-date 2014-08-13 20:02:38 +02:00
Tom Gundersen 8434fd5cf2 sd-network: rename state INITALIZING to PENDING and expose as any other state
This is the state when we are waiting for udev to initialize the device, and waiting for
libudev and rtnl to be in sync. In the future we probably will also be waiting for nl80211.
At this point we do not yet have enough information to know whether or not networkd should
be handling the device.
2014-08-13 15:39:57 +02:00
Tom Gundersen 54cba0b16c sd-network: split the operstate 'unknown' into 'down' and 'up' 2014-08-12 20:42:59 +02:00
Lennart Poettering 03cc0fd143 sd-network: add API to output all collected system-wide NTP and DNS servers
Also, output the collected information in "networkctl".
2014-08-12 15:06:51 +02:00
Lennart Poettering 7bfe1e9cb0 sd-network: remove client-side dhcp API
The networkd should abstract the difference between DHCP supplied and
configured data, and hence the DHCP lease concept should not exposed on
the client side.

Should we want to support arbitrary DHCP fields one day, we can add a
new sd_network_get_link_dhcp_field() call or so.
2014-08-12 02:04:17 +02:00
Lennart Poettering 6436165dbc sd-network: rename the per-ifindex calls to sd_network_get_link_xxx()
This way we can introduce system-wide versions of these calls that are
called the same way, but without the "link" in the name.
2014-08-11 22:56:52 +02:00
Tom Gundersen bd8f653876 networkd: add and expose per-link LLMNR config option 2014-08-04 16:56:34 +02:00
Tom Gundersen 6f4dedb250 sd-network: expose DNS/NTP servers as strings
This avoids having to distinguish between IPv4 and IPv6, allowing us
to keep their internal orderings. The consumers now has to turn the
strings into addresses.
2014-07-23 23:54:52 +02:00
Tom Gundersen 653912918f sd-network: drop get_ifindices
People should use rtnl for this, and then only query sd-network by the ifindices it finds.
2014-07-21 13:32:27 +02:00
Tom Gundersen 6dcaa6f59a sd-network: fixup api
Do not expose link_is_loopback, people should just get this from rtnl directly.
Do not expose NTP servers as IP addresses, these must be strings.
Expose ifindex as int, not unsigned. This is what the kernel (mostly) and glibc uses.
2014-07-17 22:53:35 +02:00
Tom Gundersen 560852ced0 sd-network: expose 'unmanaged' as a regular state
This is useful to save in the consumer of the lib, unlike ENODATA/EBUSY which
means that the user should wait until a useful state is available.
2014-07-17 22:53:35 +02:00
Lennart Poettering d12b8cad40 sd-network: rename "index" parameter to "ifindex"
makes things a bit clearer and avoids any clashes with libc's index()
symbol.
2014-07-17 01:46:21 +02:00
Lennart Poettering a2ba62c719 sd-network: remove redundant array size parameter from functions that return arrays
As long as the number of array entries is relatively small it's nicer to
simply return the number of entries directly, instead of using a size_t*
return parameter for it.
2014-07-17 01:42:26 +02:00
Lennart Poettering 0014a4ad50 sd-network: fix parameter order for sd_network_monitor_new()
Constructors should return the object they created as first parameter,
except when they are generated as a child/member object of some other
object in which case that should be first.
2014-07-17 01:41:52 +02:00
Tom Gundersen e375dcde72 networkd/sd-network: extend operational states
Expose states 'degraded' or 'routable' if a link has a site/link-local or a routable address, respectively.
2014-05-19 20:44:21 +02:00
Tom Gundersen bcb7a07e0a networkd/sd-network: expose statically configured NTP servers 2014-05-19 18:42:14 +02:00
Tom Gundersen 7dbf94a9c4 sd-network: expose DNS information 2014-05-19 18:14:56 +02:00
Tom Gundersen bbf7c04821 sd-network: expose global operational state 2014-05-08 17:21:37 +02:00
Tom Gundersen deb2e5230b sd-network: expose both admin and operational state directly
Also add a call to check if a link is loopback, as this should commonly be ignored.
2014-05-07 16:54:02 +02:00
Tom Gundersen 7e141e498c sd-network: add support for only listening to some types of changes 2014-04-30 00:05:28 +02:00
Jason St. John 10b17992ee src/systemd: fix grammar and spelling errors in comments 2014-03-25 20:23:33 +01:00
Tom Gundersen 82bdf8ce36 sd-network: fix header 2014-02-28 02:08:08 +01:00
Tom Gundersen fe8db0c5ee sd-network: add new library
This is similar to sd-login, but exposes the state of networkd rather than logind.

Include it in libsystemd-dhcp and rename it to libsystemd-network.
2014-02-28 01:01:13 +01:00