ext/sockets: Enable AF_PACKET raw buffer support in socket_sendto/soc…#21631
Open
devnexen wants to merge 3 commits intophp:masterfrom
Open
ext/sockets: Enable AF_PACKET raw buffer support in socket_sendto/soc…#21631devnexen wants to merge 3 commits intophp:masterfrom
devnexen wants to merge 3 commits intophp:masterfrom
Conversation
…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.
a3a8207 to
cb0a7a6
Compare
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.
750266c to
6d9be1e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…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.