summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-ipv4acd.c
Commit message (Collapse)AuthorAgeFilesLines
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-2/+2
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* tree-wide: add FORMAT_TIMESPAN()Zbigniew Jędrzejewski-Szmek2021-07-091-3/+1
|
* sd-ipv4acd: update condition of address conflictYu Watanabe2021-07-011-16/+48
| | | | | | | | See RFC 5227 section 2.1.1. This introduces a callback which intend to a library user, e.g. networkd, checks whether the sender hardware address is a MAC address of the host's intrerface or not.
* sd-ipv4acd: allow to change requesting address without restarting sd-ipv4acdYu Watanabe2021-07-011-1/+22
|
* sd-ipv4acd: set defend window in timeout event and state is ↵Yu Watanabe2021-07-011-8/+7
| | | | IPV4ACD_STATE_STARTED
* sd-ipv4acd: allow to change MAC address without restarting sd-ipv4acdYu Watanabe2021-07-011-1/+13
| | | | This also makes sd_ipv4acd_set_mac() refuses null MAC address.
* arp-util: use struct in_addrYu Watanabe2021-07-011-5/+5
|
* sd-ipv4acd: include announced address in log messageYu Watanabe2021-07-011-4/+6
|
* sd-ipv4acd: use struct in_addr instead of be32_tYu Watanabe2021-07-011-20/+13
|
* libsystemd-network: check that errno==0 is not passed to log functionsZbigniew Jędrzejewski-Szmek2021-04-141-2/+5
|
* libsystemd-network: use macro for definitions of log_{lldp,dhcp,…}_errnoZbigniew Jędrzejewski-Szmek2021-04-141-10/+5
| | | | No functional change.
* Check that errno passed log_{interface,link}_*_errno() is non-zeroZbigniew Jędrzejewski-Szmek2021-04-141-1/+1
|
* libsystemd-network: make log_dhcp_client() or friends include interface nameYu Watanabe2021-03-041-1/+9
|
* libsystemd-network: introduce sd_xxx_{set,get}_ifname()Yu Watanabe2021-03-041-10/+14
|
* tree-wide: use -EINVAL for enum invalid valuesZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
| | | | | | | | | As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617. This does not touch anything exposed in src/systemd. Changing the defines there would be a compatibility break. Note that tests are broken after this commit. They will be fixed in the next one.
* sd-ipv4acd: logs current stateYu Watanabe2020-12-021-0/+16
|
* sd-ipv4acd,sd-ipv4ll: include interface name in the debug logsYu Watanabe2020-12-021-2/+5
|
* sd-ipv4acd,sd-ipv4ll: introduce _get_ifindex() and _get_ifname()Yu Watanabe2020-12-021-1/+22
| | | | | | They will be used in later commits. This also makes sd_ipv4acd_set_ifindex() check the existence of the interface.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* libsystemd-network: do not request each daemon exist in sd_xxx_stop()Yu Watanabe2020-10-151-1/+2
|
* Add CLOSE_AND_REPLACE helperZbigniew Jędrzejewski-Szmek2020-09-181-2/+1
| | | | | | Similar to free_and_replace. I think this should be uppercase to make it clear that this is a macro. free_and_replace should probably be uppercased too.
* sd-ipv4acd: introduce sd_ipv4acd_get_address()Yu Watanabe2020-09-041-0/+9
|
* sd-ipv4acd: do not call callback in sd_ipv4acd_stop() when it is already stoppedYu Watanabe2020-09-041-0/+7
|
* ipv4ll: do not reset conflict counter on restartAJ Bagwell2019-12-111-2/+4
| | | | | | | | Don't reset the conflict counter when trying a new pseudo random address, so that after trying 10 addresses the londer timeout is used in accordance with the RFC Fixes #14299.
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-041-1/+0
|
* tree-wide: drop netinet/ether.h from socket-util.h and sd-netlink.hYu Watanabe2019-07-241-0/+1
|
* tree-wide: use PROJECT_FILE instead of __FILE__Zbigniew Jędrzejewski-Szmek2019-07-041-1/+1
| | | | This replaces the internal uses of __FILE__ with the new macro.
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-1/+1
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* ipv4acd: do not unref() event sources when update or disable themYu Watanabe2018-11-161-17/+9
|
* ipv4acd: use structured initializer at one more placeYu Watanabe2018-11-161-5/+7
|
* tree-wide: use DEFINE_TRIVIAL_REF_UNREF_FUNC() macro or friends where applicableYu Watanabe2018-08-271-19/+4
|
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-1/+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-2/+2
| | | | | | 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: 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.
* tree-wide: use TAKE_PTR() and TAKE_FD() macrosYu Watanabe2018-04-051-4/+2
|
* tree-wide: adjust fall through comments so that gcc is happyShawn Landden2017-11-201-2/+1
| | | | | | | | Distcc removes comments, making the comment silencing not work. I know there was a decision against a macro in commit ec251fe7d5bc24b5d38b0853bc5969f3a0ba06e2
* 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.
* tree-wide: use IN_SET where possibleAndreas Rammhold2017-10-021-1/+1
| | | | | In addition to the changes from #6933 this handles cases that could be matched with the included cocci file.
* libsystemd-network: ipv4ll probe conflict counter (#5361)Jason Reeder2017-02-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | A bug exists where the conflict counter is cleared regardless of whether or not the next probe attempt leads to a successful address acquisition. This causes 'bursts' of MAX_CONFLICTS probes followed by a delay of RATE_LIMIT_INTERVAL instead of a single probe each RATE_LIMIT_INTERVAL when beyond MAX_CONFLICTS. The conflict counter should only be cleared after an address is successfully acquired. This commit achieves that goal. From RFC3927: A host should maintain a counter of the number of address conflicts it has experienced in the process of trying to acquire an address, and if the number of conflicts exceeds MAX_CONFLICTS then the host MUST limit the rate at which it probes for new addresses to no more than one new address per RATE_LIMIT_INTERVAL. This is to prevent catastrophic ARP storms in pathological failure cases, such as a rogue host that answers all ARP probes, causing legitimate hosts to go into an infinite loop attempting to select a usable address. Signed-off-by: Jason Reeder <jasonreeder@gmail.com>
* tree-wide: use mfree moreZbigniew Jędrzejewski-Szmek2016-10-161-3/+1
|
* ipv4acd: rename "ll" parameter to "acd" everywhereLennart Poettering2016-05-261-152/+152
| | | | | Appears to be a (confusing) left-over from copy/paste when this still was ipv4ll code.
* sd-ipv4acd: drop IPV4ACD_NETWORK definitionLennart Poettering2016-05-261-6/+3
| | | | Appears to be a copy/paste mistake from sd-ipv4ll. Let's get rid of this.
* ipv4acd: make sure our event handler callbacks never check uninitialized "r" ↵Lennart Poettering2016-05-261-18/+18
| | | | for errors
* ipv4acd: normalize time types to usec_tLennart Poettering2016-05-261-27/+24
| | | | | | We try to stick to usec_t for encoding time information, do that here too. In particular, get rid of "int" second specifications, since signed timespans are a weird thing.
* ipv4acd: in case the state engine is reused, reset n_conflict timer to 0Lennart Poettering2016-05-261-0/+1
|
* ipv4acd: no need to memcpy() where assignment sufficesLennart Poettering2016-05-261-1/+1
|
* ipv4acd: introduce new "started" stateLennart Poettering2016-05-261-1/+3
| | | | | | | | This state is active immediately after the state engine was started, but before the first timer hits. This way multiple _start() invocations on the same object are always detected correctly.
* ipv4acd: rename ipv4acd_stop() → ipv4acd_reset()Lennart Poettering2016-05-261-51/+43
| | | | | | | | This is much less confusing, since there's also sd_ipv4acd_stop(), which was idfferent from ipv4acd_stop(). After renaming it, let's also use the funciton when destroying ipv4acd objects, as the code is pretty much the same for that.
* ipv4acd: add "_event_source" suffix to event source objectsLennart Poettering2016-05-261-24/+21
| | | | | Otherwise the field "receive_message" is a bit too confusing, as it suggests it actually stores a message object of some kind.