patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob c828ee3076787feff0e980daa4862803fe1e3772 666 bytes (raw)
name: vm/sys/net/xdp-forwarder/set_router_iface.c 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
// SPDX-License-Identifier: EUPL-1.2+
// SPDX-FileCopyrightText: 2025 Yureka Lilian <yureka@cyberchaos.dev>

#include <stdio.h>
#include <net/if.h>
#include <bpf/bpf.h>

int main(int argc, char **argv) {
	if (argc < 2) {
		fprintf(stderr, "missing interface name\n");
		return 1;
	}

	int router_idx = if_nametoindex(argv[1]);
	if (router_idx <= 0) {
		perror("error getting router interface");
		return 1;
	}

	int map_fd = bpf_obj_get("/sys/fs/bpf/router_iface");
	if (map_fd < 0) {
		perror("failed to open bpf map");
		return 1;
	}

	int id = 0;
	if (bpf_map_update_elem(map_fd, &id, &router_idx, 0) < 0) {
		perror("failed to update bpf map");
		return 1;
	}
}

debug log:

solving c828ee3 ...
found c828ee3 in https://inbox.spectrum-os.org/spectrum-devel/20250823222134.1772413-2-yureka@cyberchaos.dev/

applying [1/1] https://inbox.spectrum-os.org/spectrum-devel/20250823222134.1772413-2-yureka@cyberchaos.dev/
diff --git a/vm/sys/net/xdp-forwarder/set_router_iface.c b/vm/sys/net/xdp-forwarder/set_router_iface.c
new file mode 100644
index 0000000..c828ee3

Checking patch vm/sys/net/xdp-forwarder/set_router_iface.c...
Applied patch vm/sys/net/xdp-forwarder/set_router_iface.c cleanly.

index at:
100644 c828ee3076787feff0e980daa4862803fe1e3772	vm/sys/net/xdp-forwarder/set_router_iface.c

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).