patches and low-level development discussion
 help / color / mirror / code / Atom feed
blob d547bdd48bb909f8e15021122fd960451b312c09 696 bytes (raw)
name: vm/sys/net/xdp-forwarder/prog_physical.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
 
// SPDX-License-Identifier: EUPL-1.2+
// SPDX-FileCopyrightText: 2025 Yureka Lilian <yureka@cyberchaos.dev>

#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include "parsing_helpers.h"
#include "rewrite_helpers.h"

struct {
	__uint(type, BPF_MAP_TYPE_DEVMAP);
	__type(key, int);
	__type(value, int);
	__uint(max_entries, 1);
	__uint(pinning, LIBBPF_PIN_BY_NAME);
} router_iface SEC(".maps");

SEC("xdp")
int physical(struct xdp_md *ctx) {
	struct ethhdr *eth;
	if (parse_ethhdr(ctx, &eth) < 0)
		return XDP_DROP;

	if (ctx->ingress_ifindex < 1 || ctx->ingress_ifindex > 4096)
		return XDP_DROP;

	vlan_tag_push(ctx, eth, ctx->ingress_ifindex);
	return bpf_redirect_map(&router_iface, 0, 0);
}

debug log:

solving d547bdd ...
found d547bdd 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/prog_physical.c b/vm/sys/net/xdp-forwarder/prog_physical.c
new file mode 100644
index 0000000..d547bdd

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

index at:
100644 d547bdd48bb909f8e15021122fd960451b312c09	vm/sys/net/xdp-forwarder/prog_physical.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).