summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/network-internal.h
Commit message (Collapse)AuthorAgeFilesLines
* sd-dhcp-lease: store static routes and classless static routes in different ↵Yu Watanabe2022-02-021-1/+1
| | | | | | | | | | | arrays When classless static routes option is provided, then static routes option should not be used. Hence, let's not mix and store them in one storage. This introduce sd_dhcp_lease_get_static_routes() and sd_dhcp_lease_get_classless_routes().
* alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()Lennart Poettering2021-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | We recently started making more use of malloc_usable_size() and rely on it (see the string_erase() story). Given that we don't really support sytems where malloc_usable_size() cannot be trusted beyond statistics anyway, let's go fully in and rework GREEDY_REALLOC() on top of it: instead of passing around and maintaining the currenly allocated size everywhere, let's just derive it automatically from malloc_usable_size(). I am mostly after this for the simplicity this brings. It also brings minor efficiency improvements I guess, but things become so much nicer to look at if we can avoid these allocation size variables everywhere. Note that the malloc_usable_size() man page says relying on it wasn't "good programming practice", but I think it does this for reasons that don't apply here: the greedy realloc logic specifically doesn't rely on the returned extra size, beyond the fact that it is equal or larger than what was requested. (This commit was supposed to be a quick patch btw, but apparently we use the greedy realloc stuff quite a bit across the codebase, so this ends up touching *a*lot* of code.)
* netlink,network: drop "const" from opaque object parameters in ↵Lennart Poettering2021-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | supposed-to-be-public APIs This drops the "const" specifier from the opaque object parameters to various functions in our API. This effectively reverts #19292 and more. Why drop this? Our public APIs should not leak too much information about how stuff is implemented internally. In our public APIs we shouldn't give too many guarantees we don#t want to necessarily keep. Specifically: in many cases it makes sense that getters actually generate/parse/allocate data on the fly, storing/caching the result internally, to speed things up, do things lazily or to track memory allocations so that they can be freed later. Doing this means we need to change the objects, even though the getters are semantically a read operation. We want to retain the freedom that we can change things around internally. By exposing the objects as "const" we remove a good chunk of that, for little gain. See sd_bus_creds_get_description() for a real example of a getter that implicitly caches and thus modifies the relevant object. This removes the "const" decorators from sd-dhcp and sd-netlink, two APIs that we intend to make public eventually even though they still are not, leaving us the chance to still fix this before it becomes set in stone.
* sd-dhcp-client: constify argument in sd_dhcp_lease_get_xxx()Yu Watanabe2021-04-121-1/+1
|
* Merge pull request #17478 from yuwata/split-network-internalYu Watanabe2020-11-271-43/+1
|\ | | | | libsystemd-network: split network-internal.c
| * sd-network: move net_get_unique_predictable_data() and net_get_name_persisten()Yu Watanabe2020-10-291-4/+0
| |
| * net-condition: move net_match_config() and related conf parsersYu Watanabe2020-10-291-31/+1
| |
| * sd-network: move link_get_type_string()Yu Watanabe2020-10-291-1/+0
| |
| * libsystemd-network: move config_parse_hwaddr() and config_parse_hwaddrs()Yu Watanabe2020-10-291-2/+0
| |
| * udev: move config_parse_ifalias()Yu Watanabe2020-10-291-1/+0
| |
| * network: move config_parse_bridge_port_priority()Yu Watanabe2020-10-291-4/+0
| |
* | license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|/
* libsystemd-network: move prototypes of dhcp_lese_save/load() to ↵Yu Watanabe2020-06-231-0/+4
| | | | network-internal.h
* network: read driver name from ethtoolYu Watanabe2020-06-031-8/+9
| | | | | | | | | | To make Driver= in [Match] section work in containers. Note that ID_NET_DRIVER= property in udev database is set with the result of the ethtool. So, this should not change anything for non-container cases. Closes #15678.
* network: simplify how initial space is handledZbigniew Jędrzejewski-Szmek2020-05-261-2/+3
|
* network: move NETWORK_DIRS to path-lookup.hZbigniew Jędrzejewski-Szmek2020-03-271-3/+0
| | | | In preparation for future changes...
* network: make Type=ether match based on iftypeYu Watanabe2020-03-021-0/+2
| | | | | | This makes Type= can match the type shown in networkctl. Closes #14952.
* network, udev: introduce PermanentMACAddress= setting in [Match] sectionYu Watanabe2020-01-081-0/+2
| | | | Closes #13983.
* network: make Name= in [Match] support alternative names of interfacesYu Watanabe2019-12-161-0/+1
|
* network: support matching based on wifi interfece typeYu Watanabe2019-10-251-0/+3
|
* network: add support matching based on BSSID=Yu Watanabe2019-10-151-1/+3
|
* network: support matching based on wifi SSIDYu Watanabe2019-10-151-1/+3
|
* network,udev: add Property= setting in [Match] sectionYu Watanabe2019-07-011-0/+2
| | | | Closes #5665.
* network,udev: make net_match_config() take sd_deviceYu Watanabe2019-07-011-3/+1
|
* network,udev: fix multiple invert matching linesYu Watanabe2019-07-011-1/+2
| | | | | | | | | | Previously, ``` [Match] Name=!aaa Name=!bbb ``` does not work. This fixes the issue.
* udev: introduce NAMING_STABLE_VIRTUAL_MACS (retroactively)Zbigniew Jędrzejewski-Szmek2019-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is for 6d3646406560. It turns out that this is causing more problems than expected. Let's retroactively introduce naming scheme v241 to conditionalize this change. Follow-up for #12792 and 6d36464065601f7. See also https://bugzilla.suse.com/show_bug.cgi?id=1136600. $ SYSTEMD_LOG_LEVEL=debug NET_NAMING_SCHEME=v240 build/udevadm test-builtin net_setup_link /sys/class/net/br11 $ SYSTEMD_LOG_LEVEL=debug NET_NAMING_SCHEME=v241 build/udevadm test-builtin net_setup_link /sys/class/net/br11 ... @@ -20,11 +20,13 @@ link_config: could not set ethtool features for br11 Could not set offload features of br11: Operation not permitted br11: Device has name_assign_type=3 -Using interface naming scheme 'v240'. +Using interface naming scheme 'v241'. br11: Policy *keep*: keeping existing userspace name br11: Device has addr_assign_type=1 -br11: No stable identifying information found -br11: Could not generate persistent MAC: No data available +br11: Using "br11" as stable identifying information +br11: Using generated persistent MAC address +Could not set Alias=, MACAddress= or MTU= on br11: Operation not permitted +br11: Could not apply link config, ignoring: Operation not permitted Unload module index Unloaded link configuration context. ID_NET_DRIVER=bridge
* libsystemd-network: rename net_get_name() to net_get_name_persistent()Zbigniew Jędrzejewski-Szmek2019-06-171-1/+1
| | | | | | | This reflect its role better. (I didn't use …_persistent_name(), because which name is actually used depends on the policy. So it's better not to make this sound like it returns *the* persistent name.)
* network,udev: split static condition tests from net_match_config()Yu Watanabe2019-03-211-6/+0
|
* Merge pull request #10408 from keszybz/analyze-cat-presetsLennart Poettering2019-02-181-0/+4
|\ | | | | systemd-analyze cat-presets
| * udev,network: use standard paths for .network and .link filesZbigniew Jędrzejewski-Szmek2019-02-181-0/+4
| | | | | | | | | | | | This centralizes the configuration to one header file. /usr/local/lib is now included in the search list, and documentation is updated accordingly.
* | Merge pull request #11729 from yuwata/fix-11721Lennart Poettering2019-02-181-1/+0
|\ \ | | | | | | sd-device: also store properties read from udev database to sd_device::properties_db
| * | udev,network: drop unused parent_driver argument from net_match_config()Yu Watanabe2019-02-171-1/+0
| |/ | | | | | | The argument has never been used.
* | dhcp: move filtering of bogus DNS/NTP addresses out of DHCP clientThomas Haller2019-02-181-1/+5
|/ | | | | | | | | | | | | | The DHCP client should not pre-filter addresses beyond what RFC requires. If a client's user (like networkd) wishes to skip/filter certain addresses, it's their responsibility. The point of this is that the DHCP library does not hide/abstract information that might be relevant for certain users. For example, NetworkManager exposes DHCP options in its API. When doing that, the options should be close to the actual lease. This is related to commit d9ec2e632df4905201facf76d6a205edc952116a (dhcp4: filter bogus DNS/NTP server addresses silently).
* network: fix handling of uninitialized and zero IAID settingThomas Haller2018-12-101-1/+0
| | | | | | | | | | | | | 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: 0e408b82b8bd7675234cf58009475d4f4c0a491a
* network: replace udev_device by sd_deviceYu Watanabe2018-08-231-3/+3
|
* tree-wide: drop double newlineYu Watanabe2018-06-291-1/+0
|
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-3/+0
| | | | | | | | 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
* tree-wide: use proper unicode © instead of (C) where we canLennart Poettering2018-06-141-1/+1
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | 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.
* tree-wide: port over all code to the new CONFIG_PARSER_PROTOTYPE() macroLennart Poettering2018-05-221-27/+8
| | | | | | | | | | | This makes most header files easier to look at. Also Emacs gets really slow when browsing through large sections of overly long prototypes, which is much improved by this macro. We should probably not do something similar with too many other cases, as macros like this might help readability for some, but make it worse for others. But I think given the complexity of this specific prototype and how often we use it, it's worth doing.
* sd-dhcp: drop deserialize_dhcp_option() as it is equivalent to unhexmem()Yu Watanabe2018-05-111-1/+1
|
* network,udev: make MACAddress= in [Match] section take multiple MAC addressesYu Watanabe2018-05-091-1/+1
|
* libsystemd-network: introduce config_parse_hwaddrs()Yu Watanabe2018-05-091-0/+5
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | 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.
* core,udev,networkd: add ConditionKernelVersion=Lennart Poettering2017-12-261-1/+2
| | | | | | | | | | 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.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* network: reject bridge port priorities above kernel's max value. (#5877)Dimitri John Ledkov2017-05-021-0/+7
| | | | | | Bridge port priority in the kernel can only be between 0 and 63. Therefore reject values above maximum. Fixes: #5729
* tree-wide: port more code to use ifname_valid()Lennart Poettering2016-05-091-4/+0
|
* DHCP DUID, IAID configuration optionsVinay Kulkarni2016-03-301-0/+4
|
* Revert "DHCP DUID and IAID configurability"revert-2818-masterZbigniew Jędrzejewski-Szmek2016-03-211-4/+0
|