Re: IPv4 & IPv6 CIDR subnet calculator

2019-09-27 Thread Magnus Wild
On Wed, Sep 25, 2019 at 02:43:55AM -0700, Mark Jamsek wrote:
>
> I’ve created a subnet calculator for both IPv4 and IPv6 written in C.
> 

I've tried it, and it seems to work well. Pretty handy tool!

Thanks for sharing!

/Magnus



Re: IPv4 & IPv6 CIDR subnet calculator

2019-09-26 Thread Mark Jamsek
Hi Martin,

It is, yet IPv4 still traffics most of the Internet with 75% coverage, which
suggests IPv4 would be the prevalent use case. I mostly use it for IPv4.

But if IPv6 is the dominant use case, I can change it.

I initially thought to make it dynamically detect the version so you would
only need to enter the ipaddr/prefix irrespective of the address version. I
think this would be the best change.

In the meantime, you can always postfix the -6 if you forget:

netcalc 8c6b:dbfd:5c73:8f14:f815:a4a2:5dab:38b0/110 -6

works just the same.

Or simply alias it, which is what I've done:

$ type nc6
nc6 is an alias for 'netcalc -6'


Regards,

Mark Jamsek



--
Sent from: http://openbsd-archive.7691.n7.nabble.com/openbsd-user-misc-f3.html



Re: IPv4 & IPv6 CIDR subnet calculator

2019-09-26 Thread Mark Jamsek
Hi Martin,

Here you go:

https://jamsek.dev/resources/pub/netcalc/netcalc03.c

No switch needed for IPv4 or IPv6.


Regards,

Mark Jamsek



--
Sent from: http://openbsd-archive.7691.n7.nabble.com/openbsd-user-misc-f3.html



Re: IPv4 & IPv6 CIDR subnet calculator

2019-09-25 Thread Martin Schröder
Am Mi., 25. Sept. 2019 um 13:16 Uhr schrieb Mark Jamsek :
> Or use the -6 switch for IPv6 addresses:

Please make v6 the default and Vintage-IP available via -4. It's 2019 after all.

Best
Martin



IPv4 & IPv6 CIDR subnet calculator

2019-09-25 Thread Mark Jamsek
Hi all,

I’ve created a subnet calculator for both IPv4 and IPv6 written in C.

As well as using it to find a network for a given IPv4 CIDR range,
you can request multiple subnets with the -s option:

./netcalc 10.20.30.40/24 -s4

Or use the -6 switch for IPv6 addresses:

./netcalc -6 8c6b:dbfb:5c73:8f14:f815:a4a2:5dab:38b0/110

You’ll need to compile it with the math library linked:

cc -Werror -Wall -o netcalc netcalc.c -lm

Only tested on OpenBSD 6.5 and macOS Mojave 10.14 but it's
probably compatible elsewhere too.

https://jamsek.dev/resources/pub/netcalc

There's also a man page.


Regards,

Mark Jamsek



--
Sent from: http://openbsd-archive.7691.n7.nabble.com/openbsd-user-misc-f3.html