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

feat(core): add ipv4 netmask function #3624

Merged
merged 7 commits into from
Aug 10, 2023
Merged

feat(core): add ipv4 netmask function #3624

merged 7 commits into from
Aug 10, 2023

Conversation

allegraharris
Copy link
Contributor

@allegraharris allegraharris commented Aug 7, 2023

Adds a netmask parsing function to create additional functionality for #3523. This function takes a string argument in the format 22.59.138.9/8 and returns its netmask (255.0.0.0) in IPv4 format.

Use case: Obtaining the broadcast bitmask for an ip address via performing bitwise NOT on the netmask. Apply a bitwise OR to this result to obtain the broadcast address of an ip address.

Example:

select (~ netmask('68.11.9.2/8')) | ipv4 '68.11.9.2' -> 68.255.255.255 

@ideoma
Copy link
Collaborator

ideoma commented Aug 10, 2023

[PR Coverage check]

😍 pass : 13 / 13 (100.00%)

file detail

path covered line new line coverage
🔵 io/questdb/griffin/engine/functions/math/IPv4StrNetmaskFunctionFactory.java 13 13 100.00%

@bluestreak01 bluestreak01 merged commit 27f6b44 into master Aug 10, 2023
21 checks passed
@bluestreak01 bluestreak01 deleted the ah_subnet_func branch August 10, 2023 21:00
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.

None yet

3 participants