Skip to content

ext/sockets: Enable AF_PACKET raw buffer support in socket_sendto/soc…#21631

Open
devnexen wants to merge 3 commits intophp:masterfrom
devnexen:socket_filter_newattempt
Open

ext/sockets: Enable AF_PACKET raw buffer support in socket_sendto/soc…#21631
devnexen wants to merge 3 commits intophp:masterfrom
devnexen:socket_filter_newattempt

Conversation

@devnexen
Copy link
Copy Markdown
Member

@devnexen devnexen commented Apr 4, 2026

…ket_recvfrom.

Take a new approach from PR #17926: instead of parsing ethernet/IP/TCP/UDP headers in C, expose the raw frame as a string to userland, letting users handle protocol decoding safely in PHP. This addresses the security concerns raised during review.

Also rename opaque argument variables (arg1..arg6) to meaningful names in both functions and fix a bug in the commented-out sendto code that was using &sin instead of &sll.

devnexen added 2 commits April 4, 2026 07:14
…ket_recvfrom.

Take a new approach from PR php#17926: instead of parsing ethernet/IP/TCP/UDP
headers in C, expose the raw frame as a string to userland, letting users
handle protocol decoding safely in PHP. This addresses the security
concerns raised during review.

Also rename opaque argument variables (arg1..arg6) to meaningful
names in both functions and fix a bug in the commented-out sendto
code that was using &sin instead of &sll.
Cover ETH_P_ALL, ETH_P_LOOP, large payloads, bogus and invalid
ethertypes, truncated IP/IPv6 headers, undersized frames, small
receive buffers, optional port argument and error cases.
@devnexen devnexen force-pushed the socket_filter_newattempt branch from a3a8207 to cb0a7a6 Compare April 4, 2026 06:18
Drain stale packets from receive queue before each send/receive pair,
use experimental ethertypes (0x88B5/0x88B6) instead of ETH_P_IP/ETH_P_IPV6
to avoid kernel stack interception, and relax strict size comparisons.
@devnexen devnexen force-pushed the socket_filter_newattempt branch from 750266c to 6d9be1e Compare April 4, 2026 06:53
@devnexen devnexen marked this pull request as ready for review April 4, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant