Skip to content

Add socket protocol+type validation - #3463

Merged
josesimoes merged 1 commit into
nanoframework:mainfrom
josesimoes:validate-socket-type-protocol
Jul 10, 2026
Merged

Add socket protocol+type validation#3463
josesimoes merged 1 commit into
nanoframework:mainfrom
josesimoes:validate-socket-type-protocol

Conversation

@josesimoes

@josesimoes josesimoes commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

  • Now validates combination and throws on invalid ones.

Motivation and Context

  • Found when running System.Net unit tests.
  • lwIP silently ignores the protocol parameter for STREAM/DGRAM sockets, accepting invalid combinations.

How Has This Been Tested?

  • Running System.Net unit tests.

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dev Containers (changes related with Dev Containers, has no impact on code or features)
  • Dependencies/declarations (update dependencies or assembly declarations and changes associated, has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).

- Now validates combination and throws on invalid ones.
@josesimoes josesimoes added the Area: Common libs Everything related with common libraries label Jul 10, 2026
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

LWIP_SOCKETS_Driver::Socket now validates supported socket type/protocol combinations and returns EPROTONOSUPPORT for invalid pairs before continuing socket creation.

Changes

Socket protocol validation

Layer / File(s) Summary
Validate socket protocol combinations
src/PAL/Lwip/lwIP_Sockets.cpp
SOCK_STREAM accepts TCP or IP, and SOCK_DGRAM accepts UDP or IP; unsupported combinations return EPROTONOSUPPORT before lwIP socket creation.

Estimated code review effort: 2 (Simple) | ~5 minutes

Suggested labels: Type: bug

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the socket protocol/type validation change and meets the length and punctuation requirements.
Description check ✅ Passed The description matches the code change and testing context, so it is clearly related to the pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@josesimoes
josesimoes enabled auto-merge (squash) July 10, 2026 15:44
@josesimoes
josesimoes merged commit 7a90f3e into nanoframework:main Jul 10, 2026
40 checks passed
@josesimoes
josesimoes deleted the validate-socket-type-protocol branch July 10, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Common libs Everything related with common libraries Type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants