New option --oiface for outgoing interface#463
New option --oiface for outgoing interface#463gsnw-sebast wants to merge 1 commit intoschweikert:developfrom
Conversation
Summary of ChangesHello @gsnw-sebast, 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 introduces a new Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new --oiface option to specify the outgoing network interface for ping packets. The implementation correctly uses sendmsg with ancillary data (IP_PKTINFO for IPv4 and IPV6_PKTINFO for IPv6) to achieve this. The changes are well-structured and include documentation and a basic test case. My review includes a couple of suggestions for improvement: one to clarify a comment in the new test and another to make the command-line option parsing more robust to prevent potential issues with future options.
| #endif | ||
| } else if (strstr(optparse_state.optlongname, "seqmap-timeout") != NULL) { | ||
| opt_seqmap_timeout = strtod_strict(optparse_state.optarg) * 1000000; | ||
| } else if (strstr(optparse_state.optlongname, "oiface") != NULL) { |
There was a problem hiding this comment.
Using strstr to check for the option name is not robust. It could lead to incorrect behavior if another long option is added that contains "oiface" as a substring (e.g., --oiface-extra). A more precise check using strncmp would be safer and prevent potential future bugs. This applies to other long option checks in this block as well, but this change should at least be applied for the new option.
} else if (strncmp(optparse_state.optlongname, "oiface", 6) == 0 && (optparse_state.optlongname[6] == '\0' || optparse_state.optlongname[6] == '=')) {
With this new option, it should be possible to send a packet on one interface and receive any packet on another. There is no fallback to
SO_BINDTODEVICE, for example. The-Ioption must be used for this.Unfortunately, it is difficult for me to test this behavior. Therefore, I have only worked with the debugger.