opnsense-deps/config/cdx_sp.xml
Tomaz Zaman 162890791d PPPoE termination offload: session detection, flow offload, soft parser fix
CMM: detect PPPoE sessions via netgraph (NGM_PPPOE_GET_SESSION_INFO),
register with CDX (FPP_CMD_PPPOE_ENTRY), resolve point-to-point neighbor
MAC from session info instead of ARP.  Prevent duplicate CMM instances
via pidfile(3) locking.

CDX: fix egress PPPoE flags in dpa_get_tx_info_by_itf() — set
add_pppoe_hdr/ac_mac_addr instead of pppoe_present.  Add
pppoe_stats_offset for IPsec path.  Remove CDX_TODO_PPPOE ifdefs
in control_pppoe.c (timer always marks active, PF handles timeouts).

Soft parser (cdx_sp.xml): PPPoE data frames now return to HXS instead
of short-circuiting to relay CC table.  HXS chains PPPoE→IPv4→TCP/UDP
naturally, enabling PCD KeyGen to build 5-tuple hash keys for IPv4 CC
table matching.  LCP control packets still go directly to host.

Verified: 1.6 Gbps through PPPoE with hardware offload (all cores idle,
zero FMan drops).  Bottleneck is test infrastructure PPPoE server, not GDK.
2026-03-13 11:34:47 +01:00

185 lines
6.5 KiB
XML

<netpdl name="NetPDL custom protocol" description="NetPDL custom protocol">
<protocol name="pppoeschema" longname="pppoe handler" prevproto="pppoe">
<execute-code>
<before>
<if expr="($FW[48:16]) == 0xc021">
<if-true>
<!-- PPPoE control packet (LCP), enqueue directly -->
<assign-variable name="$hpnia" value="0x500002"/>
<action type="exit" confirm="yes" nextproto="end_parse"/>
</if-true>
</if>
<!-- Data: return to HXS with no modifications, let PPPoE->IPv4->TCP chain naturally -->
<action type="exit" confirm="no" nextproto="return"/>
</before>
</execute-code>
</protocol>
<protocol name="ethernetschema" longname="offline port Ethernet correction" prevproto="ethernet">
<execute-code>
<before>
<if expr="($logicalportid ge 9) and (ethernet.type == 0x0800 or ethernet.type == 0x86dd)">
<if-true>
<if expr="($FW[112:8] bitwand 0xF0) == 0x40">
<if-true>
<nextproto proto="#ip4"/>
<action type="exit" confirm="no" nextproto="ipv4"/>
</if-true>
</if>
<if expr="($FW[112:8] bitwand 0xF0) == 0x60">
<if-true>
<nextproto proto="#ip6"/>
<action type="exit" confirm="no" nextproto="ipv6"/>
</if-true>
</if>
</if-true>
</if>
<action type="exit" nextproto="return"/>
</before>
</execute-code>
</protocol>
<protocol name="ipv4schema" longname="ipv4schema" prevproto="ipv4">
<execute-code>
<before>
<!-- drop packets with invalid ttl value -->
<if expr="ipv4.ttl == 1 or ipv4.ttl == 0">
<if-true>
<assign-variable name="$nia" value="0x500002"/>
<assign-variable name="$hpnia" value="0x500002"/>
<action type="exit" confirm="no" nextproto="end_parse"/>
</if-true>
</if>
<!-- If it is a multicast packet stop parsing -->
<if expr="$l2r bitwand 0x0060 == 0x0040">
<if-true>
<action type="exit" confirm="yes" nextproto="end_parse"/>
</if-true>
</if>
<!-- If next protocol is ipv6 change protocol -->
<if expr="ipv4.nextp == 0x29">
<if-true>
<action type="exit" confirm="no" nextproto="ipv6"/>
</if-true>
</if>
</before>
</execute-code>
</protocol>
<protocol name="ipv6schema" longname="ipv6schema" prevproto="ipv6">
<execute-code>
<before>
<if expr="ipv6.hop == 1 or ipv6.hop == 0">
<if-true>
<assign-variable name="$nia" value="0x500002"/>
<assign-variable name="$hpnia" value="0x500002"/>
<action type="exit" confirm="no" nextproto="end_parse"/>
</if-true>
</if>
<if expr="$l2r bitwand 0x0060 == 0x0040">
<if-true>
<action type="exit" confirm="yes" nextproto="end_parse"/>
</if-true>
</if>
</before>
</execute-code>
</protocol>
<protocol name="udpschema" longname="udpschema" prevproto="udp">
<execute-code>
<before>
<if expr="$ipoffset_1 == $ipoffset_n">
<if-true>
<if expr="$l3r bitwand 0x8000 == 0x8000">
<if-true>
<assign-variable name="$l3r" value="$l3r bitwor 0x800"/>
</if-true>
<if-false>
<assign-variable name="$l3r" value="$l3r bitwor 0x400"/>
</if-false>
</if>
</if-true>
</if>
<if expr="(udp.sport == 0x1194 or udp.dport == 0x1194)">
<if-true>
<!-- esp-in-udp packet, if source or dest port is 4500 -->
<!-- ESP Marker after UDP header is (spi is 0) 0 for all ISAKMP NATT packet -->
<!-- Send all ISAKMP NATT packets to HOST -->
<if expr="($FW[64:32] bitwand 0xFFFFFFFF) == 0x00000000">
<if-true>
<assign-variable name="$nia" value="0x500002"/>
<assign-variable name="$hpnia" value="0x500002"/>
<action type="exit" confirm="no" nextproto="end_parse"/>
</if-true>
</if>
</if-true>
</if>
<if expr="($logicalportid lt 9)">
<if-true>
<if expr="$l2r bitwand 0x0800 == 0x0800">
<if-false>
<!-- not PPPoE session packet, police the packet -->
<assign-variable name="$nia" value="0x4C0000"/>
<action type="exit" confirm="yes" nextproto="end_parse"/>
</if-false>
<if-true>
</if-true>
</if>
</if-true>
</if>
</before>
</execute-code>
</protocol>
<protocol name="tcpschema" longname="tcpschema" prevproto="tcp">
<execute-code>
<before>
<if expr="((tcp.flags bitwand 7) != 0)">
<if-true>
<assign-variable name="$hpnia" value="0x500002"/>
<action type="exit" confirm="yes" nextproto="end_parse"/>
</if-true>
</if>
<if expr="$ipoffset_1 == $ipoffset_n">
<if-true>
<if expr="$l3r bitwand 0x8000 == 0x8000">
<if-true>
<assign-variable name="$l3r" value="$l3r bitwor 0x800"/>
</if-true>
<if-false>
<assign-variable name="$l3r" value="$l3r bitwor 0x400"/>
</if-false>
</if>
</if-true>
</if>
<if expr="$logicalportid lt 9">
<if-true>
<if expr="$l2r bitwand 0x0800 == 0x0800">
<if-false>
<!-- not PPPoE session packet, police the packet -->
<assign-variable name="$nia" value="0x4C0000"/>
<action type="exit" confirm="yes" nextproto="end_parse"/>
</if-false>
<if-true>
</if-true>
</if>
</if-true>
</if>
</before>
</execute-code>
</protocol>
<protocol name="espschema" longname="espschema" prevproto="ipsec_esp">
<execute-code>
<before>
<if expr="$logicalportid lt 9">
<if-true>
<if expr="$l2r bitwand 0x0800 == 0x0800">
<if-false>
<!-- not PPPoE session packet, police the packet -->
<assign-variable name="$nia" value="0x4C0000"/>
<action type="exit" confirm="yes" nextproto="end_parse"/>
</if-false>
<if-true>
</if-true>
</if>
</if-true>
</if>
</before>
</execute-code>
</protocol>
</netpdl>