Skip to content

Shared Forwarding with Policy-Based Routing causes tcpdump to report invalid IPv4 header checksum #294

Description

@VedantWani

Important notices


Describe the bug

When Shared Forwarding is enabled together with Policy-Based Routing (PBR) on a WAN gateway, tcpdump consistently reports an invalid IPv4 header checksum on packets captured on the PPPoE WAN interface.

The issue is only observed with the combination of:

  • Shared Forwarding = Enabled
  • Policy-Based Routing (gateway selected on firewall rule) = Enabled

The checksum warning disappears immediately when Shared Forwarding is disabled while keeping the same PBR rule.

Hardware checksum offloading, TSO and LRO are all disabled.

The packets continue to function normally (ICMP replies are received), so this may be a packet capture/BPF ordering issue rather than an actual transmission problem.

Observed on OPNsense 26.7-RC2.


To Reproduce

  1. Install OPNsense 26.7-RC2.
  2. Configure a PPPoE WAN interface.
  3. Configure a LAN interface.
  4. Disable:
    • Hardware Checksum Offloading
    • Hardware TCP Segmentation Offloading
    • Hardware Large Receive Offloading
  5. Set Outbound NAT to Hybrid.
  6. Enable Shared Forwarding under System → Settings → Networking.
  7. Create a LAN firewall rule using Policy-Based Routing by selecting the WAN gateway.
  8. Start a capture:
tcpdump -ni pppoe0 -vvv -xx icmp
  1. Generate traffic, for example:
ping 9.9.9.11

or

traceroute 9.9.9.11
  1. Observe the packet capture.
  2. Disable Shared Forwarding while leaving the PBR rule unchanged.
  3. Repeat the capture.

Expected behavior

tcpdump should report a valid IPv4 header checksum regardless of whether Shared Forwarding is enabled.


Actual behavior

With Shared Forwarding enabled:

IP (tos 0x0, ttl 9, id 41299, offset 0, flags [none], proto ICMP (1), length 64, bad cksum 0ed4 (->0fd4)!)
    <WAN-IP> > 9.9.9.11: ICMP echo request

Hex dump:

4500 0040 a153 0000 0901 0ed4

tcpdump recalculates the checksum as:

0x0fd4

The difference is consistently:

0x0100

which appears to correspond to the IPv4 TTL field.

The ICMP checksum is not reported as invalid.

Traffic itself appears to function normally.


Reproduction matrix

Shared Forwarding | Policy Routing | Result -- | -- | -- Disabled | Disabled | No checksum warning Disabled | Enabled | No checksum warning Enabled | Disabled | No checksum warning Enabled | Enabled | IPv4 header checksum reported as invalid by tcpdump

Describe alternatives you considered

  • Disabled Hardware Checksum Offloading
  • Disabled TSO
  • Disabled LRO
  • Verified the issue disappears when Shared Forwarding is disabled
  • Verified the issue is independent of Outbound NAT mode (Hybrid used during testing)

Relevant log files

Example capture:

14:44:33.724226 IP (tos 0x0, ttl 9, id 41299, offset 0, flags [none], proto ICMP (1), length 64, bad cksum 0ed4 (->0fd4)!)
    <WAN-IP> > 9.9.9.11: ICMP echo request, id 35890, seq 33043, length 44
        0x0000: 0200 0000 4500 0040 a153 0000 0901 0ed4
        0x0010: 75d9 78a9 0909 090b 0800 eab9 8c32 8113
sysctl net.inet.ip.forwarding
net.inet.ip.forwarding: 1

Additional context

The checksum mismatch is consistently 0x0100 lower than the value calculated by tcpdump.

This suggests that tcpdump may be observing the packet after the IPv4 TTL has been modified but before the IPv4 header checksum has been updated, although I have not confirmed this in the kernel.

If this is expected due to the Shared Forwarding packet path, it would be helpful to clarify. Otherwise, this may indicate a regression in the interaction between Shared Forwarding, policy routing (route-to), and packet capture on PPPoE interfaces.


Environment

OPNsense 26.7-RC2 (amd64)

WAN: PPPoE
LAN: Ethernet

Outbound NAT: Hybrid

Shared Forwarding: Enabled

Hardware Checksum Offloading: Disabled
Hardware TSO: Disabled
Hardware LRO: Disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstreamThird party issue

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions