GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - flowchartsman/cidr-convert: Convert a list of IP addresses/ranges to their minimized cidr form

BranchesTags
Open more actions menu

Latest commit

 

History

5 Commits
5 Commits

Folders and files

NameName
Last commit message
Last commit date
README
README
 
 
cidr-convert.c
cidr-convert.c
 
 
cidr-convert.go
cidr-convert.go
 
 

Repository files navigation

CIDR block calculator.

Takes a set of dotted-quad IP addresses, ranges, or CIDR blocks, on
 stdin; at EOF, prints a minimal set of CIDR ranges to stdout.

Input consists of a stream of dotted-quads, pairs of dotted-quads
 separated by a dash, or dotted-quads with /number widths after
 them.  Dash-separated ranges refer to all addresses between the
 two, inclusive; an address with a /number after it refers to a
 CIDR-style block.  It is not an error for an address to be
 specified in the input more than once.  Whitespace may appear
 anywhere except within a dotted-quad or CIDR width.  Characters
 other than digits, dots, dashes, and whitespace are errors.  If a
 number in a dotted-quad is greater than 255, or a CIDR width is
 greater than 32, or other syntax errors occur (such as too many
 dots without whitespace, dash, or slash) a complaint is printed and
 the dotted-quad, range, or block in which it appears is skipped.

Output consists of zero or more lines, each a dotted-quad/width CIDR
 net-with-mask, including all and only the addresses in the input.
 It will be a minimal set, in that no two blocks in the output can
 be collapsed without resorting to noncontiguous netmasks.

Compile-time options:

     -DNO_PROGNAME
             Provide __progname, for systems that don't have it.  If
             it shows up undefined at link time, try compiling with
             this turned on.

This file is in the public domain.

Originally obtained from: http://www.spamshield.org/cidr-convert.c 

Added to github on 02-01-2012 initially to fix a simple display bug for initial
quads over 127.  The goal is to allow for collaborative tweaking and development
of this useful tool.

As of 05-27-2015, I have ported the tool to Go as well. Mostly as a learning
exercise. Build with 'go build cidr-convert.go' to prevent the compiler from
getting confused.

About

Convert a list of IP addresses/ranges to their minimized cidr form

Resources

Readme
Activity

Stars

39 stars

Watchers

5 watching

Forks

6 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.