IPAddress toString should use existing printTo algorithm and conform to RFC 5952 canonical format for IPv6 addresses

Open
#228 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
api, networking

Research direction

Start with the IPAddress toString() and printTo() implementations, then review the existing printTo() tests for the RFC 5952 canonical IPv6 cases. Make toString() use the established printTo() algorithm and add unit tests covering its output; done means both methods produce the expected canonical format.

Written by the indexing model from the issue text.

Description

enhancement
API component

IPAddress

Description

The toString() for an IPv6 type address has a different output from printTo(), and does not follow the RFC 5952 canonical format. It has an unnecessarily long fixed length format. Note that IPv4 does not use a fixed length format.

Also note that the existing printTo() method already implements the RFC 5952 canonical format algorithm, and has extensive tests (there are no tests for the toString() method).

The recommendation would be for toString() simply to use the existing algorithm from printTo() (and add some unit tests for toString).

Is this a breaking change?

No. Both formats are valid string formats for IPv6, and fromString() handles both of them (and all other valid formats), as should any other system. The canonical format is usually shorter, but will not exceed the fixed length format, so there is no issue with overruns.

Dominant language
C++
Stars
306
Forks
150
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from arduino/ArduinoCore-API

All issues in arduino/ArduinoCore-API

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.