All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Lodal <simonl@parknet.dk>
To: netfilter-devel@lists.netfilter.org
Subject: RFC: Partial IP4 syntax
Date: Wed, 29 Sep 2004 03:41:02 +0200	[thread overview]
Message-ID: <415A12AE.1060901@parknet.dk> (raw)


While writing yet another IP4 address parser I came up with an idea for 
a more compact IP address/mask notation, to make stuff simpler to write 
and read.

The idea is to just leave out irrelevant octets. There are 3 forms of 
partial addresses:
1) .b.c.d | .c.d | .d (leading dot): Incomplete at beginning.
2) a..d | a..c.d | a.b..d (double dot): Incomplete in the middle.
3) a | a. | a.b | a.b. | a.b.c | a.b.c. (trailing dot or missing 
octets): Incomplete at end.

In each case the position and number of missing octets can be deduced 
and zeroes inserted for them. The parser then calculates a default mask 
which only covers the octets that were defined.

Examples:
10 = 10.0.0.0/8
10. = 10.0.0.0/8
10.0 = 10.0.0.0/16
10.0. = 10.0.0.0/16
.4 = 0.0.0.4/0.0.0.255
.3.4 = 0.0.3.4/0.0.255.255
1..4 = 1.0.0.4/255.0.0.255
.2.3. = invalid, can only be incomplete at one end

I know IP address syntax should not change every day. But this will not 
break or exclude old syntax. I do not see it clashing with other/future 
syntax.

Only minor problem I know of is when parsing netmask which can be in 
cidr or dotted quad form: /32 could be interpreted as a partial address, 
expanded to 32.0.0.0. But it is simple to special case this; make it a 
cidr mask when there is only one octet and it is <=32, otherwise 
interpret as dotted quad (partial or not).

What do you think? Old hat?


Simon

             reply	other threads:[~2004-09-29  1:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-29  1:41 Simon Lodal [this message]
2004-09-29  3:56 ` RFC: Partial IP4 syntax Ben Efros
2004-09-29  5:42   ` Simon Lodal
2004-09-29  8:55     ` Henrik Nordstrom
2004-09-29 16:38       ` Simon Lodal
2004-09-29 17:05         ` Henrik Nordstrom
2004-09-29 18:45           ` Simon Lodal
2004-09-29 19:11             ` Cedric Blancher
2004-09-29 22:41               ` Simon Lodal
2004-09-29 19:39             ` Henrik Nordstrom
2004-09-29  8:50 ` Henrik Nordstrom
2004-09-29 16:37   ` Simon Lodal
2004-09-29 16:54     ` Henrik Nordstrom
2004-09-29 18:21       ` Simon Lodal
2004-09-29 19:30         ` Henrik Nordstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=415A12AE.1060901@parknet.dk \
    --to=simonl@parknet.dk \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.