11 Commits

Author SHA1 Message Date
2c14a29229 main.c aktualisiert 2025-10-30 22:03:51 +00:00
a2bca5b5ba main.c aktualisiert 2025-10-30 15:26:18 +00:00
ba1c3ba0e6 main.c aktualisiert 2025-10-28 23:16:31 +00:00
8f988b0a0f xdp: Fix L4 header bounds checking and IPv6 extension header parsing in l3fwd
Fix critical bounds checking issues and add proper IPv6 extension header
support in XDP L3 forwarding program.

Issues fixed:

1. L4 Header Bounds Checking
   - Previous code checked bounds for udphdr size (8 bytes) but then
     accessed tcphdr struct (20+ bytes), causing potential out-of-bounds
     reads and verifier rejection
   - Now each protocol (TCP/UDP) has separate, proper bounds validation
     before accessing headers

2. IPv6 Extension Header Parsing
   - Added skip_ip6hdrext() function to parse IPv6 extension headers
     (Hop-by-Hop, Routing, Fragment, Destination Options, AH, MH)
   - Ensures accurate L4 protocol identification and flow tracking for
     IPv6 packets with extension headers
   - Supports up to 6 chained extension headers with fallback

3. PERCPU Map Performance
   - Changed bpf_map_update_elem() flag from BPF_NOEXIST to BPF_ANY
   - Eliminates unnecessary overhead since PERCPU maps have no
     contention and lookup-update race window is negligible

4. L4 Offset Calculation
   - Properly calculate L4 header offset separately for bounds checking
   - Use offset-based addressing instead of pointer arithmetic for
     verifier compliance

These fixes ensure the program passes BPF verifier checks, handles all
packet types correctly, and only records flow statistics for packets
that successfully pass FIB lookup and port validation.

Tested with: IPv4/IPv6 traffic, VLAN-tagged packets, IPv6 with extension
headers (fragmentation, routing headers), TCP/UDP flows.
2025-10-28 13:05:26 +00:00
aacb5dd1a4 main.c aktualisiert 2025-10-28 09:18:45 +00:00
aef70ec801 Adding vLan forwarding and offloading Support
Adding vLan forwarding and offloading Support for XDP offloading.
2025-10-27 21:43:40 +00:00
37ceda168f main.c aktualisiert 2025-10-27 21:34:20 +00:00
439f0f9a81 main.c aktualisiert 2025-10-27 21:34:08 +00:00
319bc67f33 main.c aktualisiert 2025-10-27 16:07:20 +00:00
d06eab0a55 main.c aktualisiert 2025-10-27 16:02:46 +00:00
0bc9ea0685 Adding the xdp based fwd engine 2025-10-27 16:02:36 +00:00