summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-network
Commit message (Collapse)AuthorAgeFilesLines
* macro: introduce TAKE_PTR() macroLennart Poettering2018-03-221-10/+5
| | | | | | | | | | | | | | | | 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)
* tree-wide: make use of new STRLEN() macro everywhere (#7639)Lennart Poettering2017-12-141-3/+3
| | | | | Let's employ coccinelle to do this for us. Follow-up for #7625.
* Add a "RequiredForOnline=" Link attribute for .network files (#7347)Mathieu Trudel-Lapierre2017-11-301-0/+15
| | | | | 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.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-193-0/+3
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* libsystemd: use IN_SET macroYu Watanabe2017-09-281-1/+1
|
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4
* Fix missing space in comments (#5439)AsciiWolf2017-02-241-1/+1
|
* tree-wide: make invocations of extract_first_word more uniform (#4627)Zbigniew Jędrzejewski-Szmek2016-11-111-10/+4
| | | | extract_first_words deals fine with the string being NULL, so drop the upfront check for that.
* tree-wide: remove unused variablesThomas Hindoe Paaboel Andersen2016-02-231-1/+0
|
* sd-network: use xsprintf() instead of asprintf() where we canLennart Poettering2016-02-211-14/+13
|
* networkd: rework how carrier bindings are serializedLennart Poettering2016-02-211-4/+58
| | | | | Instead of serializing the interface name, expose the interface index, since that's the only stable identifier.
* sd-lldp: rework sd-lldp APILennart Poettering2016-02-211-26/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reworks the sd-lldp substantially, simplifying things on one hand, and extending the logic a bit on the other. Specifically: - Besides the sd_lldp object only one other object is maintained now, sd_lldp_neighbor. It's used both as storage for literal LLDP packets, and for maintainging info about peers in the database. Separation between packet, TLV and chassis data is not maintained anymore. This should be a major simplification. - The sd-lldp API has been extended so that a couple of per-neighbor fields may be queried directly, without iterating through the object. Other fields that may appear multiple times, OTOH have to be iterated through. - The maximum number of entries in the neighbor database is now configurable during runtime. - The generation of callbacks from sd_lldp objects is more restricted: callbacks are only invoked when actual data changed. - The TTL information is now hooked with a timer event, so that removals from the neighbor database due to TTLs now result in a callback event. - Querying LLDP neighbor database will now return a strictly ordered array, to guarantee stability. - A "capabilities" mask may now be configured, that selects what type of LLDP neighbor data is collected. This may be used to restrict collection of LLDP info about routers instead of all neighbors. This is now exposed via networkd's LLDP= setting. - sd-lldp's API to serialize the collected data to text files has been removed. Instead, there's now an API to extract the raw binary data from LLDP neighbor objects, as well as one to convert this raw binary data back to an LLDP neighbor object. networkd will save this raw binary data to /run now, and the client side can simply parse the information. - support for parsing the more exotic TLVs has been removed, since we are not using that. Instead there are now APIs to extract the raw data from TLVs. Given how easy it is to parse the TLVs clients should do so now directly instead of relying on our APIs for that. - A lot of the APIs that parse out LLDP strings have been simplified so that they actually return strings, instead of char arrays with a length. To deal with possibly dangerous characters the strings are escaped if needed. - APIs to extract and format the chassis and port IDs as strings has been added. - lldp.h has been simplified a lot. The enums are anonymous now, since they were never used as enums, but simply as constants. Most definitions we don't actually use ourselves have eben removed.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-103-6/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* networkd: rework Domains= settingLennart Poettering2016-01-261-22/+10
| | | | | | | | | | | | | | | | 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.
* resolved: introduce support for per-interface negative trust anchorsLennart Poettering2016-01-061-39/+43
|
* resolved,networkd: add a per-interface DNSSEC settingLennart Poettering2016-01-051-0/+4
| | | | | This adds a DNSSEC= setting to .network files, and makes resolved honour them.
* networkd,resolved: add a per-interface mdns configuration optionLennart Poettering2016-01-051-0/+4
|
* sd-network: unify parsing of /run/systemd/netif/links/* string fieldsLennart Poettering2016-01-051-89/+14
|
* tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering2015-11-271-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* util-lib: move inotify-related definitions to fs-util.[ch]Lennart Poettering2015-10-271-2/+3
|
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-272-0/+2
|
* util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-252-1/+3
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-5/+7
| | | | | | | | | | | | | | 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.
* dhcp,network: implement RFC 4833 (DHCP Timezone option)Lennart Poettering2015-08-261-0/+22
| | | | | This one is simply to add: encode the tzdata timezone in the DHCP options and optionally make use of it.
* sd-network: fix CID 1306198Susant Sahani2015-06-111-3/+1
|
* sd-network: allow the state dir to be created after the monitorTom Gundersen2015-06-101-7/+56
| | | | | We now listen for new subdirs of /run/systemd, and /run/systemd/netif in case /run/systemd/netif/links does not exist.
* sd-network: allow NULL in sd_network_monitor_unrefTom Gundersen2015-06-101-4/+4
| | | | Match rest of codebase, we always allow unref'ing NULL.
* networkd: add support for Uplink Failure DetectionAlin Rauta2015-02-271-0/+8
| | | | | | | 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]
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-232-4/+0
| | | | | | 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.
* include <poll.h> instead of <sys/poll.h>Thomas Hindoe Paaboel Andersen2015-02-121-1/+1
| | | | | | include-what-you-use automatically does this and it makes finding unnecessary harder to spot. The only content of poll.h is a include of sys/poll.h so should be harmless.
* LLDP: Add support for networkctlSusant Sahani2014-12-191-0/+26
|
* sd-network: add _get_network_file apiTom Gundersen2014-09-081-0/+24
|
* sd-network: add system-wide sd_network_get_domains() APILennart Poettering2014-08-151-0/+4
|
* sd-nework: be more careful with error codes, return ENODATA if you lack ↵Lennart Poettering2014-08-151-3/+4
| | | | information
* sd-network: add support for wildcard domainsTom Gundersen2014-08-151-0/+19
|
* sd-network: add sd_network_linkg_get_domains()Tom Gundersen2014-08-141-0/+4
| | | | | | 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.
* sd-networkd: rename link_get_state to link_get_setup_stateTom Gundersen2014-08-131-1/+1
| | | | Suggested by Kay and Lennart.
* sd-network: /_get_link_/_link_get_/Tom Gundersen2014-08-131-5/+5
| | | | | | The link is the 'object', so make this in line with our usual naming convention. Suggested by Kay and Lennart.
* sd-network: rename state INITALIZING to PENDING and expose as any other stateTom Gundersen2014-08-131-2/+0
| | | | | | | 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.
* timesyncd: split up into multiple source fileLennart Poettering2014-08-122-1/+39
| | | | | The source file got much too large, hence split up the sources into multiple per-object files, similar in style to resolved.
* sd-network: add API to output all collected system-wide NTP and DNS serversLennart Poettering2014-08-121-26/+63
| | | | Also, output the collected information in "networkctl".
* sd-network: move sd-network API into libsystemd properLennart Poettering2014-08-123-0/+287
In contrast to the DHCP/IPv4LL/ICMP6 APIs sd-network is not a protocol implementation but a client API for networkd, hence move it into libsystemd proper.