mirror of
https://github.com/dtaht/unicast-extensions.git
synced 2024-05-11 05:55:07 +00:00
More comments about handling bogons with config file
This commit is contained in:
+23
-15
@@ -1,45 +1,53 @@
|
||||
From 455db523be3beeebdec9741c13d7397fddf2bee1 Mon Sep 17 00:00:00 2001
|
||||
From 2f223855782a312108019074e3365e29e51c10ce Mon Sep 17 00:00:00 2001
|
||||
From: Seth Schoen <[email protected]>
|
||||
Date: Fri, 30 Sep 2022 17:03:11 -0700
|
||||
Date: Fri, 18 Nov 2022 15:33:28 -0800
|
||||
Subject: [PATCH] Don't treat 0/8 and 240/4 specially in IPv4 classification
|
||||
|
||||
With the exception of 0.0.0.0 and 255.255.255.255, which have additional
|
||||
special meanings, treat 0/8 and 240/4 as normal unicast addresses by
|
||||
default. This is because some people are experimenting with using these
|
||||
default. This is because some people are experimenting with using these
|
||||
addresses as regular unicast (either for private addresses or for potential
|
||||
future public addresses).
|
||||
|
||||
On the public Internet, they would still be regarded as bogons and one
|
||||
could make (maybe by default) a bogon-filtering rule in bird.conf that
|
||||
would not permit these addresses to be routed. Dave Taht, who wrote a
|
||||
prior version of this patch, suggested that in any case it is better to
|
||||
have bogons defined in a configuration file than hard-coded in software.
|
||||
On the public Internet, they would still currently be regarded as bogons and
|
||||
one could make (maybe by default) a bogon-filtering rule in bird.conf that
|
||||
would not permit these addresses to be routed, e.g. with a pair of static
|
||||
routes
|
||||
|
||||
route 0.0.0.0/8 prohibit;
|
||||
route 240.0.0.0/4 prohibit;
|
||||
|
||||
Dave Taht, who wrote a prior version of this patch, suggested that in
|
||||
any case it is better to have bogons defined in a configuration file
|
||||
than hard-coded in software.
|
||||
---
|
||||
lib/ip.c | 5 +++--
|
||||
lib/ip.c | 7 +++++--
|
||||
lib/ip.h | 2 +-
|
||||
2 files changed, 4 insertions(+), 3 deletions(-)
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/ip.c b/lib/ip.c
|
||||
index 4c5fa47f..4e573838 100644
|
||||
index 4c5fa47f..e13bbce0 100644
|
||||
--- a/lib/ip.c
|
||||
+++ b/lib/ip.c
|
||||
@@ -87,8 +87,9 @@ ip4_classify(ip4_addr ad)
|
||||
@@ -87,8 +87,10 @@ ip4_classify(ip4_addr ad)
|
||||
|
||||
if (b < 0xe0)
|
||||
{
|
||||
- if (b == 0x00) /* 0.0.0.0/8 This network */
|
||||
+ if (a == 0x00000000) /* 0.0.0.0/32 Unset address */
|
||||
return IADDR_INVALID;
|
||||
+ /* 0.0.0.0/8 is otherwise reserved, but some people are using it or trying to */
|
||||
+ /* 0.0.0.0/8 is otherwise reserved, but
|
||||
+ * some people are using it or trying to */
|
||||
|
||||
if (b == 0x7f) /* 127.0.0.0/8 Loopback address */
|
||||
return IADDR_HOST | SCOPE_HOST;
|
||||
@@ -107,7 +108,7 @@ ip4_classify(ip4_addr ad)
|
||||
@@ -107,7 +109,8 @@ ip4_classify(ip4_addr ad)
|
||||
if (a == 0xffffffff) /* 255.255.255.255 Broadcast address */
|
||||
return IADDR_BROADCAST | SCOPE_LINK;
|
||||
|
||||
- return IADDR_HOST | SCOPE_SITE; /* 240.0.0.0/4 Reserved / private */
|
||||
+ return IADDR_HOST | SCOPE_UNIVERSE; /* 240.0.0.0/4 Reserved / private, but some people are using it or trying to */
|
||||
+ return IADDR_HOST | SCOPE_UNIVERSE; /* 240.0.0.0/4 Reserved / private, but
|
||||
+ * some people are using it or trying to */
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user