Skip to content

Add comprehensive error handling to protocol emulators for production readiness #6

@Sweekar-cmd

Description

@Sweekar-cmd

While reviewing the codebase, I noticed the protocol emulators (coap_pit.c, telnet_pit.c, etc.)
lack robust error handling, which is critical for a production tarpit system.

Current issues identified:

  1. No validation of command-line parameters (port, delay, max clients)
  2. Missing errno details in error messages
  3. No handling of specific error cases (EPIPE, ECONNRESET)
  4. No socket options (SO_REUSEADDR, SO_KEEPALIVE)
  5. IP address conversion without bounds checking

Proposed changes for coap_pit.c (as a starting point):

  • Add parameter validation
  • Improve socket creation error messages
  • Add sendto()/recvfrom() error checking
  • Handle malloc failures gracefully

Why this matters:
Better error handling means:

  • Easier debugging when things go wrong
  • More reliable tarpit operation
  • Better metrics for the Grafana dashboard

I'd like to work on this if the maintainers agree it's valuable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions