Follow-up: Added CoAP socket #4334#5002
Conversation
|
@gpotter2 How to add the "AI Trailer" the "old" commits which were created 2 years ago? |
|
You can |
|
Ok, that should work. I just disliked changing to much of the history. What do you think about a start date? Like only commits from 2026 onward are filtered by the script? |
Sure that's a good idea. |
fa0b4a4 to
4bb9a59
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new CoAP socket implementation to Scapy’s contrib layer, expanding CoAP support beyond packet parsing to include client/server exchanges (retransmissions, separate responses, duplicate detection), and introduces regression + interop tests (libcoap) with CI support.
Changes:
- Introduce
scapy.contrib.coap_socketimplementing a CoAP-awareSuperSocketwith resource handling and basic retransmission/separate-response behavior. - Extend
scapy.contrib.coapwith exported CoAP constants plushashret()/answers()to improve request/response matching in Scapy send/recv workflows. - Add UTScapy regression + libcoap interoperability/stress tests and install libcoap binaries in CI.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
scapy/contrib/coap_socket.py |
New CoAP socket implementation (client/server, resources, retransmission, separate responses). |
scapy/contrib/coap.py |
Adds exported constants and response-matching helpers (hashret, answers). |
test/contrib/coap_socket.uts |
New UTScapy regression + libcoap interoperability/stress tests for CoAPSocket. |
.config/ci/install.sh |
Installs libcoap binaries for CI to enable interop tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixing response payload Some docstring and bug fixes. Finished CoAP server logic implementation Added client interaction Client/Server done. Added delayed response handling Fixing small problems Unit tests Documentation AI-Assisted: no
- Moved the defines/enumerators to coap.py - Changed the send() function to match the SuperSocket declaration - Updated unit tests AI-Assisted: no
- Implemented coap.answers function - Fixed some types - Remove unnecessary override - Changed sr and sr1 functions signatures. AI-Assisted: no
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> AI-Assisted: yes (GitHub CoPilot Auto)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> AI-Assisted: yes (GitHub CoPilot Auto)
AI-Assisted: yes (GitHub CoPilot Auto)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> AI-Assisted: yes (GitHub CoPilot Auto)
| s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) | ||
| s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | ||
| s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) | ||
| s.bind((self.ip, self.port)) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5002 +/- ##
==========================================
- Coverage 80.29% 80.03% -0.27%
==========================================
Files 383 384 +1
Lines 95163 95601 +438
==========================================
+ Hits 76407 76510 +103
- Misses 18756 19091 +335
🚀 New features to boost your workflow:
|
Description
This PR implements a CoAP socket, pretty similar on how ISOTPSoftSocket works.
I implemented the basic message exchange, mostly based on the RFC-7252.
Known-limitations
General comments
It has a dependency for
from scapy.contrib.isotp.isotp_soft_socket import TimeoutScheduler, I found nice how this is implemented, so I just used it, I didn't want to copy/paste again.Also I added some unit tests for the basic cases.
Quick usage
This follow-up reintegrates master and adds additional unit tests