Skip to content

Claim ICMP protocols via dmip's protocol handler DIF - #5

Merged
JohnAmadis merged 1 commit into
mainfrom
claude/sleepy-davinci-xkgkjk
Sep 20, 2026
Merged

JohnAmadis merged 1 commit into
mainfrom
claude/sleepy-davinci-xkgkjk

Conversation

@JohnAmadis

Copy link
Copy Markdown
Contributor

Summary

  • Companion to choco-technologies/dmip#3, which removes dmip_register_protocol()/_register_default_protocol() in favor of a DIF dmip itself defines.
  • dmicmp now implements dmip's protocol handler DIF instead, claiming DMIP_PROTO_ICMP, DMIP_PROTO_ICMPV6, and the new DMIP_PROTO_DEFAULT fallback marker all from one dmip_protocol_numbers() implementation.
  • Since a DIF implementation is one function per module rather than one callback per registration, the previous two separate handlers (dmicmp_handle_ip_packet() for ICMP/ICMPv6, dmicmp_handle_unclaimed_protocol() for the default fallback) are merged into a single dmip_protocol_receive() implementation that re-parses the packet's own protocol field to tell the two cases apart.
  • No dmod_init()/_deinit() registration call is needed anymore - dmicmp can now be reloaded without dmip holding a reference on it.
  • CMakeLists.txt now declares DMOD_DIF_IMPLS dmip.

Test plan

  • Verified src/dmicmp.c and include/dmicmp.h compile cleanly (gcc -fsyntax-only) against real dmod core headers, the updated dmip headers (from the companion PR), and real peer-module headers, since dmf-get/network package fetch wasn't available in this environment to run the full CMake+ctest flow.
  • Confirmed tests/dmicmp_test.c needs no changes (it drives the module's real DIF implementation through dmip's real dispatch, the same way it already exercised the old registration) and still compiles against the new headers.
  • CI (ctest via dmod_loader) on this PR, once merged alongside Replace protocol registration with dmip's own DIF dmip#3.

Generated by Claude Code

dmip_register_protocol()/_register_default_protocol() have been removed
(see the corresponding dmip change) - dmicmp now implements dmip's
protocol handler DIF instead, claiming DMIP_PROTO_ICMP, DMIP_PROTO_ICMPV6,
and the new DMIP_PROTO_DEFAULT fallback marker all from one
dmip_protocol_numbers() implementation.

Since a DIF implementation is one function per module rather than one
callback per registration, the previous two separate handlers
(dmicmp_handle_ip_packet() for ICMP/ICMPv6, dmicmp_handle_unclaimed_
protocol() for the default fallback) are merged into a single
dmip_protocol_receive() implementation that re-parses the packet's own
protocol field to tell the two cases apart.

No dmod_init()/_deinit() registration call is needed anymore - dmip
discovers dmicmp's DIF implementations on demand for as long as this
module stays loaded and enabled, so dmicmp can now be reloaded without
dmip holding a reference on it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAqx5zBfvejpcUUZBn66F4
@JohnAmadis
JohnAmadis merged commit c41ea0e into main Sep 20, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants