Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out non-operational and loopback interfaces #1937

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

disa6302
Copy link
Contributor

@disa6302 disa6302 commented Feb 28, 2024

Issue #, if available:

What was changed?

  • Add check to filter out gathering interfaces that are inactive or loopback on windows.

Why was it changed?

  • This was done to ensure the SDK does not spend cycles on gathering interfaces unnecessarily and it could lead to time improvement if the getAddress operation is slow on Windows.

How was it changed?

  • Added a check to check for interfaces activity and loopback.

What testing was done for the changes?

  • Tested the sample to confirm original functionality does not break.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.11%. Comparing base (3ab921c) to head (d7e3163).

❗ Current head d7e3163 differs from pull request most recent head 6c695c5. Consider uploading reports for the commit 6c695c5 to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1937   +/-   ##
========================================
  Coverage    76.11%   76.11%           
========================================
  Files           48       48           
  Lines        13711    13710    -1     
========================================
  Hits         10436    10436           
+ Misses        3275     3274    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@disa6302 disa6302 marked this pull request as ready for review February 28, 2024 20:59
@hassanctech hassanctech self-requested a review March 4, 2024 19:05
Copy link
Contributor

@hassanctech hassanctech left a comment

Choose a reason for hiding this comment

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

LGTM

@disa6302 disa6302 merged commit 2f909bc into develop Mar 4, 2024
29 of 30 checks passed
@disa6302 disa6302 deleted the check-inactive-windows branch March 4, 2024 19:08
// Skip inactive interfaces and loop back interfaces
if (aa->OperStatus == IfOperStatusUp && aa->IfType != IF_TYPE_SOFTWARE_LOOPBACK) {
char ifa_name[BUFSIZ];
memset(ifa_name, 0, BUFSIZ);
Copy link
Contributor

@sirknightj sirknightj Mar 4, 2024

Choose a reason for hiding this comment

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

Minor but we should be using the macros from pic (MEMSET, CHAR)

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.

5 participants