summaryrefslogtreecommitdiff
path: root/src/libsystemd
Commit message (Collapse)AuthorAge
* sd-login: add new sd_pid_get_cgroup() APILennart Poettering2017-03-14
| | | | | | | | | | This adds a new sd_pid_get_cgroup() call to sd-login which may be used to query the control path of a process. This is useful for programs when making use of delegation units, in order to figure out which subtree has been delegated. In light of the unified control group hierarchy this is finally safe to do, hence let's add a proper API for it, to make it easier to use this.
* Prep v221: Update and clean up build system to sync with upstreamSven Eden2017-03-14
| | | | | | | | | | | | | | This commit replays the moving around of source files that have been done between systemd-219 and systemd-221. Further the Makefile.am is synchronized with the upstream version and then "re-cleaned". A lot of functions, that are not used anywhere in elogind have been coated into #if 0/#endif directives to further shorten the list of dependencies. All unneeded files have been removed.
* sd-netlink: introduce api for new NL type NLA_FLAGSusant Sahani2017-03-14
|
* sd-netlink: add support for new type NETLINK_TYPE_FLAGSusant Sahani2017-03-14
| | | | | | | | NETLINK_TYPE_FLAG is NLA_FLAG. This new type will be used in NLA_FLAG for example IFLA_VXLAN_GBP and IFLA_VXLAN_REMCSUM_NOPARTIAL
* sd-netlink: add support for vxlan attributesSusant Sahani2017-03-14
|
* sd-netlink: Add macvtap supportSusant Sahani2017-03-14
|
* netlink-types: use consistent whitespace at EOLZbigniew Jędrzejewski-Szmek2017-03-14
| | | | Follow up for v222-124-g79e27dbcb1.
* sd-netlink: add bridge NL paramsSusant Sahani2017-03-14
|
* sd-netlink: add tunnel paramsSusant Sahani2017-03-14
|
* sd-netlink: add tunnel NL parametersSusant Sahani2017-03-14
|
* sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering2017-03-14
| | | | | | | | | | | | | | | | sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush() (which writes all unwritten messages out) + sd_bus_close() (which terminates the connection, releasing all unread messages) + sd_bus_unref() (which frees the connection). The combination of this call is used pretty frequently in systemd tools right before exiting, and should also be relevant for most external clients, and is hence useful to cover in a call of its own. Previously the combination of the three calls was already done in the _cleanup_bus_close_unref_ macro, but this was only available internally. Also see #327
* treewide: fix typosTorstein Husebø2017-03-14
|
* sd-netlink: message - remove unused next_rta_offset fieldTom Gundersen2017-03-14
| | | | This was a left-over from before we supported containers.
* sd-netlink: make a couple of helper functions staticTom Gundersen2017-03-14
| | | | Also rename from rtnl_* to netlink_*.
* netlink: rework containersTom Gundersen2017-03-14
| | | | | | | Instead of representing containers as several arrays, make a new netlink_container struct and keep one array of these structs. We also introduce netlink_attribute structs that in the future will hold meta-information about each atribute.
* sd-netlink: don't export internal type-system detailsDavid Herrmann2017-03-14
| | | | | | | | | | | | | | | | | | | | | | | | | | The kernel bonding layer allows passing an array of ARP IP targets as bond-configuration. Due to the weird implementation of arrays in netlink (which we haven't figure out a generic way to support, yet), we usually hard-code the supported array-sizes. However, this should not be exported from sd-netlink. Instead, make sure the caller just uses it's current hack of enumerating the types, and the sd-netlink core will have it's own list of supported array-sizes (to be removed in future extensions, btw!). If either does not match, we will just return a normal error. Note that we provide 2 constants for ARP_IP_TARGETS_MAX now. However, both have very different reasons: - the constant in netdev-bond.c is used to warn the user that the given number of targets might not be supported by the kernel (even though the kernel might increase that number at _any_ time) - the constant in sd-netlink is solely used due to us missing a proper array implementation. Once that's supported in the type-system, it can be removed without notice Last but not least, this patch turns the log_error() into a log_warning(). Given that the previous condition was off-by-one, anyway, it never hit at the right time. Thus, it was probably of no real use.
* sd-netlink: respect attribute type flagsTom Gundersen2017-03-14
| | | | | | | | | | Though currently unused by us, netlink attribute types support embedding flags to indicate if the type is encoded in network byte-order and if it is a nested attribute. Read out these flags when parsing the message. We will now swap the byteorder in case it is non-native when reading out integers (though this is not needed by any of the types we currently support). We do not enforce the NESTED flag, as the kernel gets this wrong in many cases.
* sd-netlink: don't treat NULL as root type-systemDavid Herrmann2017-03-14
| | | | | | | | | | Explicitly export the root type-system to the type-system callers. This avoids treating NULL as root, which for one really looks backwards (NULL is usually a leaf, not root), and secondly prevents us from properly debugging calling into non-nested types. Also rename the root to "type_system_root". Once we support more than rtnl, well will have to revisit that, anyway.
* sd-netlink: don't treat type_system->count==0 as invalidDavid Herrmann2017-03-14
| | | | | | | Empty type-systems are just fine. Avoid the nasty hack in union-type-systems that treat empty type-systems as invalid. Instead check for the actual types-array and make sure it's non-NULL (which is even true for empty type-systems, due to "empty_types" array).
* sd-netlink: drop NETLINK_TYPE_METADavid Herrmann2017-03-14
| | | | | | | | | The NETLINK_TYPE_META pseudo-type is actually equivalent to an empty nested type. Drop it and define an empty type-system instead. This also has the nice side-effect that m->container_type_system[0] is never NULL (which has really nasty side-effects if you try to read attributes).
* sd-netlink: turn 'max' into 'count' to support empty type-systemsDavid Herrmann2017-03-14
| | | | | | | | | | Right now we store the maximum type-ID of a type-system. This prevents us from creating empty type-systems. Store the "count" instead, which should be treated as max+1. Note that type_system_union_protocol_get_type_system() currently has a nasty hack to treat empty type-systems as invalid. This might need some modification later on as well.
* sd-netlink: avoid casting size_t into intDavid Herrmann2017-03-14
| | | | | | size_t is usually 64bit and int 32bit on a 64bit machine. This probably does not matter for netlink message sizes, but nevertheless, avoid hard-coding it anywhere.
* sd-netlink: make NLTypeSystem internalDavid Herrmann2017-03-14
| | | | | | | | | | Same as NLType, move NLTypeSystem into netlink-types.c and hide it from the outside. Provide an accessor function for the 'max' field that is used to allocate suitable array sizes. Note that this will probably be removed later on, anyway. Once we support bigger type-systems, it just seems impractical to allocate such big arrays for each container entry. An RBTree would probably do just fine.
* sd-netlink: make NLType internalDavid Herrmann2017-03-14
| | | | | | | | | | | | | | If we extend NLType to support arrays and further extended types, we really want to avoid hard-coding the type-layout outside of netlink-types.c. We already avoid accessing nl_type->type_system outside of netlink-types.c, extend this to also avoid accessing any other fields. Provide accessor functions for nl_type->type and nl_type->size and then move NLType away from the type-system header. With this in place, follow-up patches can safely turn "type_system" and "type_system_union" into a real "union { }", and then add another type for arrays.
* sd-netlink: don't access type->type_system[_union] directlyDavid Herrmann2017-03-14
| | | | | | | | | | | | | | | Make sure we never access type->type_system or type->type_system_union directly. This is an implementation detail of the type-system and we should always use the accessors. Right now, they only exist for 2-level accesses (type-system to type-system). This patch introduces the 1-level accessors (type to type-system) and makes use of it. This patch makes sure the proper assertions are in place, so we never accidentally access sub-type-systems for non-nested/union types. Note that this places hard-asserts on the accessors. This should be fine, as we expect callers to only access sub type-systems if they *know* they're dealing with nested types.
* sd-netlink: make sure the root-level type is nestedDavid Herrmann2017-03-14
| | | | | | | | | | | | | | | | | | | In sd-netlink-message, we always guarantee that the currently selected type-system is non-NULL. Otherwise, we would be unable to parse any types in the current container level. Hence, this assertion must be true: message->container_type_system[m->n_containers] != NULL During message_new() we currently do not verify that this assertion is true. Instead, we blindly access nl_type->type_system and use it (which might be NULL for basic types and unions). Fix this, by explicitly checking that the root-level type is nested. Note that this is *not* a strict requirement of netlink, but it's a strict requirement for all message types we currently support. Furthermore, all the callers of message_new() already verify that only supported types are passed, therefore, this is a pure cosmetic check. However, it might be needed on the future, so make sure we don't trap into this once we change the type-system.
* sd-netlink: rename NLA_ to NETLINK_TYPE_David Herrmann2017-03-14
| | | | | | | | | | | The NLA_ names are used to name real datatypes we extract out of netlink messages. The kernel has an internal enum with the same names (NLA_foobar), which is *NOT* binary compatible to our types. Furthermore, we support a different set of types than the kernel (as we try to treat some kernel peculiarities as our own types to simplify the API). Rename NLA_ to NETLINK_TYPE_ to make clear that this is our own set of types.
* export sd_bus_object_added() / _removed()Geert Jansen2017-03-14
| | | | Fixes #306.
* libsystemd: remove list of symbols to export only in the futureKay Sievers2017-03-14
|
* sd-netlink: rename from sd-rtnlTom Gundersen2017-03-14
|
* libudev: enumerate - accept NULL parameters in add_match()Tom Gundersen2017-03-14
| | | | This was a regression introduced when moving to sd-device.
* sd-device: enumerator - fix matching on properties and sysattrsTom Gundersen2017-03-14
| | | | | | | | This was a regression that broke $ udevadm trigger -nv --property-match=DEVNAME=/dev/sda1 --attr-match=size=409600 Reported by David Reisner.
* sd-device: fix return codes on errorZbigniew Jędrzejewski-Szmek2017-03-14
| | | | asprintf() does not set errno.
* libudev-device: fix lazy loading of devlinks, properties and tagsTom Gundersen2017-03-14
| | | | | If the underlying device has not read in the properties yet, the generation will be 0, so make sure we trigger the reading at least once.
* sd-device: uniformly handle missing devicesTom Gundersen2017-03-14
| | | | | sd_device_new_from_* now returns -ENODEV when the device does not exist, and the enumerator silently drops these errors as missing devices is exepected.
* sd-device: enumerator - match only on initialized devices by defaultTom Gundersen2017-03-14
| | | | | | | | It is still possible to include uninitialized ones, but now that is opt-in. In most cases people only want initialized devices. Exception is if you want to work without udev running. Suggested by David Herrmann.
* sd-device: enumerator - don't expose add_device()Tom Gundersen2017-03-14
| | | | | | | This is rarely, if ever, used. Drop it from the new public API and only keep it for the legacy API. Suggested by David Herrmann.
* libudev: make libudev-enumerate a thin wrapper around sd-deviceTom Gundersen2017-03-14
|
* sd-device: add device-enumerator libraryTom Gundersen2017-03-14
|
* Rename more things to elogindAndy Wingo2015-04-19
|
* Compiling.Andy Wingo2015-04-08
|
* sd-device: get_sysattr_value - don't leak returned valueTom Gundersen2015-04-03
| | | | | | | This was getting leaked as a copy was added to the hashmap, simply add the returned value instead. This should fix CID #1292806.
* sd-device: initialize variableTom Gundersen2015-04-03
| | | | sysnum would not be initialized if sysname had no trailing digits.
* libsystemd: add sd-device libraryTom Gundersen2015-04-02
| | | | | | | | | | | | This provides equivalent functionality to libudev-device, but in the systemd style. The public API only caters to creating sd_device objects from for devices that already exist in /sys, there is no support for listening for monitoring events or creating devices received over the udev netlink protocol. The private API contains the necessary functionality to make sd-device a drop-in replacement for libudev-device, but which we would not otherwise want to export.
* fix gcc warnings about uninitialized variablesHarald Hoyer2015-03-27
| | | | | | | | | | | | | like: src/shared/install.c: In function ‘unit_file_lookup_state’: src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized] return r < 0 ? r : state; ^ src/shared/install.c:1796:13: note: ‘r’ was declared here int r; ^
* sd-rtnl: Always enable IFA_FLAGSPatrik Flykt2015-03-27
| | | | | IFA_FLAGS is a discrete value and has no preprocessor #define defined for it. Fix this by always using the value.
* sd-rtnl: handle empty multi-part message from the kernelAlin Rauta2015-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We strips out NLMSG_DONE piece from a multi-part message adding into the receive queue only the messages containing actual data. If we send a request to the kernel for getting the forwarding database table (just an example), the response will be a multi-part message like below: 1. FDB entry 1; 2. FDB entry 2; 3. NLMSG_DONE; We strip out "3. NLMSG_DONE;" part and places into the receive queue a pointer to "1. FDB entry 1; 2. FDB entry 2". But if the FDB table is empty, the respose from the kernel will look like below: 1. NLMSG_DONE; We strip out "1. NLMSG_DONE;" part and since there is no actual data got, it continues waiting until reaching timeout. Therefore, a call to "sd_rtnl_call" to send and wait for a response from kernel will exit with timeout which is interpreted as error in communication. This patch puts the NLMSG_DONE message on the receive queue if it ends an empty multi-part message. This situation is detected in sd_rtnl_call() and in the callback code and NULL is returned to the caller instead. [tomegun: - added/reworded commit message - extend the same support to sd_rtnl_call_async() - drop debug logging from library, we only do this if something is really wrong, but an empty multi-part message is perfectly normal - modernize the code we touch whilst we are at it]
* Add (void) where we don't care about return valueZbigniew Jędrzejewski-Szmek2015-03-15
|
* sd-event: sd_event_run - only return 0 on timeoutTom Gundersen2015-03-14
| | | | sd_event_dispatch() returns 0 on FINISH, so let's eat that up.
* sd-event: rename PASSIVE/PREPARED to INITIAL/ARMEDTom Gundersen2015-03-14
|