mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-17 08:38:42 +00:00
Use undefined scope for undefined IPv6 addresses.
This commit is contained in:
parent
4116db182d
commit
bf6d91dc4e
4
lib/ip.c
4
lib/ip.c
@ -27,9 +27,9 @@
|
|||||||
char *
|
char *
|
||||||
ip_scope_text(unsigned scope)
|
ip_scope_text(unsigned scope)
|
||||||
{
|
{
|
||||||
static char *scope_table[] = { "host", "link", "site", "org", "univ" };
|
static char *scope_table[] = { "host", "link", "site", "org", "univ", "undef" };
|
||||||
|
|
||||||
if (scope > SCOPE_UNIVERSE)
|
if (scope > SCOPE_UNDEFINED)
|
||||||
return "?";
|
return "?";
|
||||||
else
|
else
|
||||||
return scope_table[scope];
|
return scope_table[scope];
|
||||||
|
1
lib/ip.h
1
lib/ip.h
@ -37,6 +37,7 @@
|
|||||||
#define SCOPE_SITE 2
|
#define SCOPE_SITE 2
|
||||||
#define SCOPE_ORGANIZATION 3
|
#define SCOPE_ORGANIZATION 3
|
||||||
#define SCOPE_UNIVERSE 4
|
#define SCOPE_UNIVERSE 4
|
||||||
|
#define SCOPE_UNDEFINED 5
|
||||||
|
|
||||||
char *ip_scope_text(unsigned);
|
char *ip_scope_text(unsigned);
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ ipv6_classify(ip_addr *a)
|
|||||||
case 5: return IADDR_MULTICAST | SCOPE_SITE;
|
case 5: return IADDR_MULTICAST | SCOPE_SITE;
|
||||||
case 8: return IADDR_MULTICAST | SCOPE_ORGANIZATION;
|
case 8: return IADDR_MULTICAST | SCOPE_ORGANIZATION;
|
||||||
case 14: return IADDR_MULTICAST | SCOPE_UNIVERSE;
|
case 14: return IADDR_MULTICAST | SCOPE_UNIVERSE;
|
||||||
|
default: return IADDR_MULTICAST | SCOPE_UNDEFINED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!x && !a->addr[1] && !a->addr[2])
|
if (!x && !a->addr[1] && !a->addr[2])
|
||||||
@ -102,7 +103,7 @@ ipv6_classify(ip_addr *a)
|
|||||||
if (y >= 0x01000000 && y < 0xe0000000)
|
if (y >= 0x01000000 && y < 0xe0000000)
|
||||||
return IADDR_HOST | SCOPE_UNIVERSE;
|
return IADDR_HOST | SCOPE_UNIVERSE;
|
||||||
}
|
}
|
||||||
return IADDR_INVALID;
|
return IADDR_HOST | SCOPE_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -49,7 +49,7 @@ CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, IGP_METRIC)
|
|||||||
|
|
||||||
CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT,
|
CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT,
|
||||||
RIP, OSPF, OSPF_IA, OSPF_EXT1, OSPF_EXT2, BGP, PIPE)
|
RIP, OSPF, OSPF_IA, OSPF_EXT1, OSPF_EXT2, BGP, PIPE)
|
||||||
CF_ENUM(T_ENUM_SCOPE, SCOPE_, HOST, LINK, SITE, ORGANIZATION, UNIVERSE)
|
CF_ENUM(T_ENUM_SCOPE, SCOPE_, HOST, LINK, SITE, ORGANIZATION, UNIVERSE, UNDEFINED)
|
||||||
CF_ENUM(T_ENUM_RTC, RTC_, UNICAST, BROADCAST, MULTICAST, ANYCAST)
|
CF_ENUM(T_ENUM_RTC, RTC_, UNICAST, BROADCAST, MULTICAST, ANYCAST)
|
||||||
CF_ENUM(T_ENUM_RTD, RTD_, ROUTER, DEVICE, BLACKHOLE, UNREACHABLE, PROHIBIT, MULTIPATH)
|
CF_ENUM(T_ENUM_RTD, RTD_, ROUTER, DEVICE, BLACKHOLE, UNREACHABLE, PROHIBIT, MULTIPATH)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user