Skip to content

Comments

psh: add ipv6 support (ifconfig/ping)#246

Merged
rmikielis merged 2 commits intomasterfrom
rmikielis/ifconfig-ipv6-support
Dec 1, 2025
Merged

psh: add ipv6 support (ifconfig/ping)#246
rmikielis merged 2 commits intomasterfrom
rmikielis/ifconfig-ipv6-support

Conversation

@rmikielis
Copy link
Contributor

@rmikielis rmikielis commented Oct 10, 2025

JIRA: RTOS-1160

add psh/ifconfig feature to show ipv6 address assigned
add psh/ping support for ipv6 messages

Description

Dependency tree:
phoenix-rtos/libphoenix#447 (merged to master)
phoenix-rtos/libphoenix#450

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (ia32-QEMU / imxrt-1064evk).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

@gemini-code-assist
Copy link

Summary of Changes

Hello @rmikielis, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the ifconfig utility within the psh shell by integrating IPv6 support. The primary goal is to allow users to view assigned IPv6 addresses, their corresponding netmasks, and scopes for network interfaces, addressing the RTOS-1160 JIRA ticket. The changes involve updating the build configuration to enable IPv6 features and significant modifications to the ifconfig source code to handle and display IPv6-specific network information.

Highlights

  • IPv6 Support: The ifconfig utility now supports displaying IPv6 addresses, netmasks, and scopes for network interfaces.
  • Build System Integration: A new conditional compilation flag, PSH_IPV6_SUPPORT, has been added to the psh/Makefile to enable IPv6 features during the build process.
  • Interface Information Display: The psh_ifconfigPrintInterface function in ifconfig.c has been extended to query and present detailed IPv6 configuration for each interface.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for displaying IPv6 addresses in the ifconfig command. The implementation is mostly correct, but I've found a couple of areas for improvement. One is a minor issue regarding how unspecified addresses are checked, which can be made more robust and readable. The other is a more significant issue in the new IPv6 printing logic, which involves confusing buffer reuse and a bug in error handling. I've provided suggestions to refactor this part to make it cleaner and more correct.

Comment on lines 204 to 208
msg = in6addrBuff;
inet_ntop(AF_INET6, &ioctlInterface6Address[i].ifr_addr6.sin6_addr, in6addrBuff, INET6_ADDRSTRLEN);
if (strlen(in6addrBuff) == 2) {
continue;
}

Choose a reason for hiding this comment

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

medium

The check strlen(in6addrBuff) == 2 is an obscure and inefficient way to check for an unspecified (all-zero) IPv6 address. It relies on the string representation being "::" and performs a string conversion just for the check. It's more robust, readable, and efficient to use the IN6_IS_ADDR_UNSPECIFIED macro on the binary address directly before converting it to a string.

            if (IN6_IS_ADDR_UNSPECIFIED(&ioctlInterface6Address[i].ifr_addr6.sin6_addr)) {
                continue;
            }
            msg = in6addrBuff;
            inet_ntop(AF_INET6, &ioctlInterface6Address[i].ifr_addr6.sin6_addr, in6addrBuff, INET6_ADDRSTRLEN);

@github-actions
Copy link

github-actions bot commented Oct 10, 2025

Unit Test Results

9 462 tests  +1 005   8 873 ✅ +940   50m 31s ⏱️ + 5m 17s
  561 suites +   61     589 💤 + 65 
    1 files   ±    0       0 ❌ ±  0 

Results for commit 469291c. ± Comparison against base commit 1d06ed5.

♻️ This comment has been updated with latest results.

@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch from bb5e4bc to 515b6ae Compare October 10, 2025 12:29
@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch from 515b6ae to 77ba2a6 Compare October 10, 2025 12:39
@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch from 77ba2a6 to 81d135c Compare October 20, 2025 13:11
@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch from 81d135c to fd20f27 Compare October 21, 2025 11:17
@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch from fd20f27 to e5b486c Compare October 21, 2025 14:26
@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch from e5b486c to b21a1d3 Compare October 22, 2025 09:14
@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch 2 times, most recently from d0e55bb to 683c76b Compare October 23, 2025 11:07
@rmikielis rmikielis changed the title ifconfig: add ipv6 support psh: add ipv6 support (ifconfig/ping) Oct 23, 2025
@ziemleszcz
Copy link
Contributor

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces IPv6 support to the psh shell, specifically for the ifconfig and ping commands. The changes involve adding necessary header files, conditional compilation based on the PSH_IPV6_SUPPORT macro, and implementing IPv6 address printing and pinging functionalities. The code includes new functions for calculating IPv6 prefix lengths and handling IPv6 addresses in ifconfig, as well as modifications to the ping command to support IPv6 echo requests and replies. I have identified some areas where improvements can be made, particularly in error handling and code clarity.

@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch from 683c76b to 3c42ebd Compare November 3, 2025 10:55
@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch from 3c42ebd to 1c15d81 Compare November 6, 2025 12:26
@ziemleszcz
Copy link
Contributor

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces IPv6 support for the ifconfig and ping commands. The ifconfig command is updated to display IPv6 addresses, prefix lengths, and scopes. The ping command is significantly refactored to handle both IPv4 and IPv6, controlled by a new -6 flag. The changes are well-structured, but I've found a critical issue in the IPv6 ping implementation related to setting the hop limit, as well as a few minor logic issues and areas for code simplification. My review includes suggestions to fix these issues.

@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch from 1c15d81 to bbb87ac Compare November 7, 2025 09:21
@ziemleszcz
Copy link
Contributor

Consider adding yourself to the authors list.

JIRA: RTOS-1160
@rmikielis rmikielis force-pushed the rmikielis/ifconfig-ipv6-support branch from bbb87ac to 469291c Compare November 28, 2025 16:35
@rmikielis rmikielis merged commit d2362b5 into master Dec 1, 2025
41 checks passed
@rmikielis rmikielis deleted the rmikielis/ifconfig-ipv6-support branch December 1, 2025 09:57
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.

3 participants