Skip to content

Conversation

@Harisabdullah
Copy link
Contributor

@Harisabdullah Harisabdullah commented Sep 7, 2023

Current output

mslm@mslm-ThinkPad-T480s:~/MHaris/cli$ ipinfo tool upper a::/126
0.10.0.0
mslm@mslm-ThinkPad-T480s:~/MHaris/cli$ ipinfo tool upper a::/127
0.10.0.0

Intended Output

mslm@mslm-ThinkPad-T480s:~/MHaris/cli$ ipinfo tool upper a::/126
a::3
mslm@mslm-ThinkPad-T480s:~/MHaris/cli$ ipinfo tool upper a::/127
a::1

if ipnet.IP.To4() != nil {
ipRange, _ := IPRangeStrFromCIDR(input)
upper = ipRange.End
} else if ipnet.IP.To16() != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IPV6 CIDR were not handled separately.

func ActionForCIDR(input string) {
func ActionForCIDR(input string) error {
_, ipnet, err := net.ParseCIDR(input)
if err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Although the output was correct for ipinfo tool lower but modified for the sake of consistency.

@UmanShahzad UmanShahzad merged commit aa426d1 into master Sep 7, 2023
@UmanShahzad UmanShahzad deleted the haris/fix-171 branch September 7, 2023 11:36
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.

3 participants