Skip to content

Fix MAC_from_string to use input parameter instead of global config for MAC address parsing#10356

Merged
thebentern merged 5 commits into
masterfrom
fix/portduino-mac-from-string
Apr 30, 2026
Merged

Fix MAC_from_string to use input parameter instead of global config for MAC address parsing#10356
thebentern merged 5 commits into
masterfrom
fix/portduino-mac-from-string

Conversation

@thebentern

Copy link
Copy Markdown
Contributor

This seems like a pretty big oversight. Ran into it while doing testing my TCP connection on the local MCP server on MacOS native

@github-actions github-actions Bot added needs-review Needs human review bugfix Pull request that fixes bugs labels Apr 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Portduino’s MAC_from_string() so it parses the MAC from its input argument (after colon stripping) instead of incorrectly reading from the global portduino_config.mac_address, and adds a regression test suite to prevent reintroducing this behavior.

Changes:

  • Correct MAC_from_string() to parse bytes from the function parameter mac_str rather than portduino_config.mac_address.
  • Add a new Unity test suite covering happy paths, regression cases, and length-based rejection behavior for MAC_from_string().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/platform/portduino/PortduinoGlue.cpp Fixes MAC parsing to use the provided input string rather than global config state.
test/test_mac_from_string/test_main.cpp Adds regression/unit tests validating correct parsing and non-parsing rejection cases.

Comment thread test/test_mac_from_string/test_main.cpp Outdated
Comment thread src/platform/portduino/PortduinoGlue.cpp Outdated
@thebentern thebentern requested a review from Copilot April 30, 2026 14:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/platform/portduino/PortduinoGlue.cpp
@jp-bennett

Copy link
Copy Markdown
Collaborator

This was a definite case of it-works-on-my-machine. Good hardening

@thebentern thebentern merged commit 7066abb into master Apr 30, 2026
80 checks passed
@thebentern thebentern deleted the fix/portduino-mac-from-string branch April 30, 2026 19:49
jp-bennett pushed a commit that referenced this pull request May 4, 2026
…or MAC address parsing (#10356)

* Fix MAC_from_string to use input parameter instead of global config for MAC address parsing

* Enhance MAC_from_string validation and error handling

* Add missing include for <cctype> in PortduinoGlue.cpp
Evil8it pushed a commit to Evil8it/ME4TACTNK that referenced this pull request Jun 10, 2026
…or MAC address parsing (meshtastic#10356)

* Fix MAC_from_string to use input parameter instead of global config for MAC address parsing

* Enhance MAC_from_string validation and error handling

* Add missing include for <cctype> in PortduinoGlue.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants