summaryrefslogtreecommitdiff
path: root/src/core/bpf-socket-bind.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* libbpf: add compat helpers for libbpf down to 0.1.0Dominique Martinet2022-10-061-1/+1
| | | | | | | | | - new symbols are available from libbpf 0.6.0 so could be used with libbpf.so.0, but we're sure the old symbols will be there and this simplifies code - detection at runtime should always work, regardless of whether systemd has been compiled with older or newer libbpf and runs with older or newer libbpf
* libbpf: Remove use of deprecated APIsDaan De Meyer2022-10-061-3/+3
|
* tree-wide: Use correct format specifiersJan Janssen2022-08-301-2/+2
| | | | gcc will complain about all these with -Wformat-signedness.
* core/bpf: prefix log messages from different bpf subsystemsZbigniew Jędrzejewski-Szmek2022-06-021-17/+18
| | | | | | | | | | | | When something goes awry, we would get identical log messages from all the bpf subsystems. E.g. "Failed to load BPF object: %m" appeared 5 times in the sources. But it is very important to know *which* object we failed to load. This could be guessed, e.g. from surroudning messages or from filename/line metadata, but when we get log messages in bug reports, this might not be available. Let's make the messages distinguishable. While at it, some messages were adjusted a bit. In particular, we shouldn't use internal names like BPFProgram which have no meaning outside of the codebase.
* core: define a helper function for basic bpf checksZbigniew Jędrzejewski-Szmek2022-06-021-10/+3
|
* list: declare iterator of LIST_FOREACH() in the loopYu Watanabe2022-03-191-2/+0
|
* bpf: Fix error handlingDaan De Meyer2022-03-151-2/+1
| | | | | The __open() functions actually set errno on failure so let's update the error handling to account for that.
* bpf: refactor skeleton generationJames Hilliard2021-12-071-1/+1
| | | | This should hopefully fix cross compilation for the bpf programs.
* tree-wide: fix SPDX short identifier for LGPL-2.1-or-laterLuca Boccassi2021-10-011-1/+1
| | | | | https://spdx.dev/ids/#:~:text=Allowing%20later%20versions%20of%20a%20license https://spdx.org/licenses/LGPL-2.1-or-later.html
* bpf: add ip proto matching to socket-bind progJulia Kartseva2021-06-291-0/+1
| | | | | | | | | | Lookup ip protocol in a socket address to allow or deny binding a socket to the address. Matching rule is extended with 'protocol' field. If its value is 0 (IPPROTO_IP) ip protocol comparison is omitted and matching is passed to the next token which is ip ports. Documentation is updated.
* bpf-link: prefix function names with "bpf_"Lennart Poettering2021-06-081-3/+3
| | | | we generally do this for all bpf functions, do so here too.
* core: rename socket-bind.[ch] → bpf-socket-bind.[ch]Lennart Poettering2021-06-081-0/+252
The other BPF infra has a file name prefix of "bpf-" hence do so here too.