summaryrefslogtreecommitdiffstats
path: root/src/shared/socket-netlink.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | 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.
* netlink: move resolve_ifname() or friends to netlink-util.[ch]Yu Watanabe2021-06-111-39/+1
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* Use sockaddr_un_set_path() in socket_address_parse()Zbigniew Jędrzejewski-Szmek2020-09-101-26/+7
| | | | | | | | Two functional changes: - "/" is now refused. The test is adjusted. - The trailing NUL is *not* included in the returned size for abstract size. The comments in sockaddr_un_set_path() indicate that this is the right thing to do, and the code in socket_address_parse() wasn't doing that.
* shared/socket-netlink: set output in socket_address_parse_netlink() only on ↵Zbigniew Jędrzejewski-Szmek2020-09-101-10/+7
| | | | success
* Allow interface scopes to be specified in ListenStream=Zbigniew Jędrzejewski-Szmek2020-09-101-2/+3
| | | | | | | | | | Closes #12624. The formatting in systemd.socket.xml is updated a bit. Currently in_addr_port_ifindex_name_to_string() always prints the ifindex numerically. This is not super useful since the interface numbers are semi-random. Should we use interface names in preference?
* shared: don't unconditionally set SOCK_STREAM as type in socket_address_parse()Zbigniew Jędrzejewski-Szmek2020-09-101-44/+59
| | | | | | | | | | We would set .type to a fake value. All real callers (outside of tests) immediately overwrite .type with a proper value after calling socket_address_parse(). So let's not set it and adjust the few places that relied on it being set to the fake value. socket_address_parse() is modernized to only set the output argument on success.
* shared: make socket_address_parse use the generic parser for IPv[46] addressesZbigniew Jędrzejewski-Szmek2020-09-101-72/+33
| | | | | | | | One special syntax is not supported anymore: "iface:port" would be parsed as an interface name plus numerical port, equivalent to "[::]%iface:port". This was added in 542563babda, but was undocumented, and we had no tests for it. It seems that this actually wasn't doing anything useful, because the kernel only uses the scope identifier for link-local addresses.
* Get rid of in_addr_port_from_string_auto() againZbigniew Jędrzejewski-Szmek2020-09-101-30/+0
| | | | | With the commit "shared/socket-netlink: only allow ifindex if explicitly supported" this helper is not necessary anymore.
* shared: check interface name validity in ↵Zbigniew Jędrzejewski-Szmek2020-09-101-0/+4
| | | | | | | | | in_addr_port_ifindex_name_from_string_auto() We don't try to resolve invalid ifnames as all. A different return code is used. This difference will be verified later in test_socket_address_parse() when socket_address_parse() is converted to use in_addr_port_ifindex_name_from_string_auto().
* shared/socket-netlink: only allow ifindex if explicitly supportedZbigniew Jędrzejewski-Szmek2020-09-101-10/+14
| | | | | Instead of ignoring ifindex if not wanted, refuse it is the caller does not allow it.
* util: drop unused socket_addr_port_from_string_auto()Yu Watanabe2020-09-041-27/+0
|
* util: introduce in_addr_port_from_string_auto()Yu Watanabe2020-09-041-0/+30
|
* shared: Introduce socket_addr_port_from_string_autoSusant Sahani2020-09-021-0/+27
|
* socket-netlink: make address argument constLennart Poettering2020-08-171-1/+8
|
* util: introduce 'struct in_addr_full' and its helper functionsYu Watanabe2020-07-201-0/+67
|
* util: introduce in_addr_port_ifindex_name_from_string_auto() and ↵Yu Watanabe2020-07-201-41/+103
| | | | in_addr_port_ifindex_name_to_string()
* shared: move in_addr_ifindex_name_from_string_auto() thereMarc-André Lureau2020-05-071-0/+30
|
* tree-wide: use structured initialization at various placesLennart Poettering2020-04-241-2/+3
|
* Resolve alternative ifnames wherever we would resolve an interface nameZbigniew Jędrzejewski-Szmek2020-01-121-1/+25
| | | | To keep the names manageable, "ifname_or_ifindex" is replaced by "interface".
* util-lib: add function to resolve "alternative" namesZbigniew Jędrzejewski-Szmek2020-01-121-7/+19
| | | | Calls to if_nametoindex() are expected to use resolve_ifname() instead.
* util-lib: move things that parse ifnames to shared/Zbigniew Jędrzejewski-Szmek2020-01-111-0/+327
In subsequent commits, calls to if_nametoindex() will be replaced by a wrapper that falls back to alternative name resolution over netlink. netlink support requires libsystemd (for sd-netlink), and we don't want to add any functions that require netlink in basic/. So stuff that calls if_nametoindex() for user supplied interface names, and everything that depends on that, needs to be moved.