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

add pton builtin #2289

Merged
merged 3 commits into from
Jul 29, 2022
Merged

Conversation

xh4n3
Copy link
Contributor

@xh4n3 xh4n3 commented Jul 5, 2022

Description

This pull request addressed the proposal in #2248, added a new built-in function pton.

The pton converts text-formatted IP addresses to byte arrays, which is exactly reversed-version of ntop. It should come in handy when we need to select packets with certain IP addresses.

Plan

The current implementation only support comparison byte by byte, direct byte array comparison will be implemented in future pull requests.

Checklist
  • Language changes are updated in man/adoc/bpftrace.adoc and if needed in docs/reference_guide.md
  • User-visible and non-trivial changes updated in CHANGELOG.md
  • The new behaviour is covered by tests

src/ast/passes/semantic_analyser.cpp Outdated Show resolved Hide resolved
src/ast/passes/semantic_analyser.cpp Outdated Show resolved Hide resolved
tests/semantic_analyser.cpp Show resolved Hide resolved
docs/reference_guide.md Outdated Show resolved Hide resolved
man/adoc/bpftrace.adoc Outdated Show resolved Hide resolved
@xh4n3 xh4n3 force-pushed the features/add-pton-builtin branch 2 times, most recently from 0024f1e to 61d95e1 Compare July 14, 2022 07:41
@xh4n3
Copy link
Contributor Author

xh4n3 commented Jul 14, 2022

@danobi @fbs @viktormalik Thanks for the suggestions!
I've updated the commits to address those issues. 😃

@xh4n3 xh4n3 force-pushed the features/add-pton-builtin branch from 61d95e1 to 0a1cb3d Compare July 18, 2022 10:57
Signed-off-by: xh4n3 <xyn1016@gmail.com>
@xh4n3 xh4n3 force-pushed the features/add-pton-builtin branch from 0a1cb3d to 3e1bc64 Compare July 18, 2022 11:09
Signed-off-by: xh4n3 <xyn1016@gmail.com>
Signed-off-by: xh4n3 <xyn1016@gmail.com>
@xh4n3 xh4n3 force-pushed the features/add-pton-builtin branch from 3e1bc64 to 314928d Compare July 18, 2022 11:22
@xh4n3
Copy link
Contributor Author

xh4n3 commented Jul 18, 2022

@viktormalik @danobi The inet_pton check has been added to semantic analyser, it should find empty string or illegal address in the first place now.

@xh4n3
Copy link
Contributor Author

xh4n3 commented Jul 27, 2022

Hi @danobi , would you like to take another look? The issues you mentioned should be fixed now.

@viktormalik viktormalik merged commit dc73201 into bpftrace:master Jul 29, 2022
@xh4n3 xh4n3 deleted the features/add-pton-builtin branch July 29, 2022 07:38
@xh4n3 xh4n3 mentioned this pull request Jul 29, 2022
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.

4 participants