-
Notifications
You must be signed in to change notification settings - Fork 165
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
update(sinsp/ifinfo): add new public addr_to_string methods #1937
Conversation
/milestone 0.18.0 |
userspace/libsinsp/ifinfo.h
Outdated
@@ -41,6 +41,8 @@ class SINSP_PUBLIC sinsp_ipv4_ifinfo | |||
sinsp_ipv4_ifinfo(uint32_t addr, uint32_t netmask, uint32_t bcast, const char* name); | |||
|
|||
std::string to_string() const; | |||
std::string addr_to_string(const uint32_t addr) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing to_string
method creates a string not suitable for the metrics feature. While here thought it would be good to expose an overloaded method in case you wanted to just convert for example the netmask to a string.
Perf diff from master - unit tests
Perf diff from master - scap file
Heap diff from master - unit tests
Heap diff from master - scap file
|
userspace/libsinsp/ifinfo.cpp
Outdated
@@ -69,6 +69,35 @@ std::string sinsp_ipv4_ifinfo::to_string() const | |||
return std::string(s); | |||
} | |||
|
|||
std::string sinsp_ipv4_ifinfo::addr_to_string(const uint32_t addr) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method could be made static instead!
71ece5e
to
b707a74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
LGTM label has been added. Git tree hash: 9d34509b6ae4e23e09063a129bbf5b7d16b6cd3d
|
Signed-off-by: Melissa Kilby <[email protected]>
Signed-off-by: Melissa Kilby <[email protected]> Co-authored-by: Federico Di Pierro <[email protected]>
b707a74
to
8bf2f59
Compare
Rebased as the CI never triggered. What is needed to finish this PR? Thanks! |
Perf diff from master - unit tests
Perf diff from master - scap file
Heap diff from master - unit tests
Heap diff from master - scap file
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
LGTM label has been added. Git tree hash: 24cf9dca4f5c1b057ac1ce60cecace9850a63d74
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FedeDP, incertum The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Would there be feedback from the second reviewer? Thanks. |
What type of PR is this?
/kind cleanup
/kind feature
Any specific area of the project related to this PR?
/area libsinsp
Does this PR require a change in the driver versions?
What this PR does / why we need it:
Expose proper / public ip4 and ip6 ip addr to string conversion methods, see https://github.com/falcosecurity/falco/pull/3253/files#r1651554317 @sgaist and @FedeDP
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: