// SPDX-License-Identifier: EUPL-1.2+ // SPDX-FileCopyrightText: 2025 Yureka Lilian #include #include #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, ð) < 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); }