mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-10 10:41:14 +00:00
Relax draft-ietf-idr-error-handling-13 valid IP check in favor of draft-ietf-idr-error-handling-14
This commit is contained in:
parent
7d1ef6adac
commit
58298ccd1a
@ -1185,9 +1185,14 @@ bgp_attr_nexthop (struct bgp_attr_parser_args *args)
|
|||||||
args->total);
|
args->total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* According to section 6.3 of RFC4271, syntactically incorrect NEXT_HOP
|
||||||
|
attribute must result in a NOTIFICATION message (this is implemented below).
|
||||||
|
At the same time, semantically incorrect NEXT_HOP is more likely to be just
|
||||||
|
logged locally (this is implemented somewhere else). The UPDATE message
|
||||||
|
gets ignored in any of these cases. */
|
||||||
nexthop_n = stream_get_ipv4 (peer->ibuf);
|
nexthop_n = stream_get_ipv4 (peer->ibuf);
|
||||||
nexthop_h = ntohl (nexthop_n);
|
nexthop_h = ntohl (nexthop_n);
|
||||||
if (!bgp_valid_host_address(nexthop_h))
|
if (IPV4_NET0 (nexthop_h) || IPV4_NET127 (nexthop_h) || IPV4_CLASS_DE (nexthop_h))
|
||||||
{
|
{
|
||||||
char buf[INET_ADDRSTRLEN];
|
char buf[INET_ADDRSTRLEN];
|
||||||
inet_ntop (AF_INET, &nexthop_n, buf, INET_ADDRSTRLEN);
|
inet_ntop (AF_INET, &nexthop_n, buf, INET_ADDRSTRLEN);
|
||||||
|
@ -893,34 +893,6 @@ bgp_collision_detect (struct peer *new, struct in_addr remote_id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* per draft-ietf-idr-error-handling-13
|
|
||||||
*
|
|
||||||
* An IP host address SHOULD be considered invalid if it appears in the
|
|
||||||
* "IANA IPv4 Special-Purpose Address Registry" [IANA-IPV4] and either
|
|
||||||
* the "destination" or the "forwardable" boolean in that registry is
|
|
||||||
* given as "false".
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
bgp_valid_host_address (unsigned long addr)
|
|
||||||
{
|
|
||||||
if (IPV4_NET0(addr) || // 0.0.0.0/8
|
|
||||||
IPV4_NET127(addr) || // 127.0.0.0/8
|
|
||||||
IPV4_LINKLOCAL(addr) || // 169.254.0.0/16
|
|
||||||
addr == 0xC00000AA || // 192.0.0.170/32
|
|
||||||
addr == 0xC00000AB || // 192.0.0.171/32
|
|
||||||
(addr & 0xffffff00) == 0xC0000200 || // 192.0.2.0/24
|
|
||||||
(addr & 0xffffff00) == 0xC6336400 || // 198.51.100.0/24
|
|
||||||
(addr & 0xffffff00) == 0xCB007100 || // 203.0.113.0/24
|
|
||||||
IPV4_CLASS_DE(addr))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bgp_open_receive (struct peer *peer, bgp_size_t size)
|
bgp_open_receive (struct peer *peer, bgp_size_t size)
|
||||||
{
|
{
|
||||||
@ -938,8 +910,6 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
|
|||||||
u_int8_t notify_data_remote_as4[4];
|
u_int8_t notify_data_remote_as4[4];
|
||||||
u_int8_t notify_data_remote_id[4];
|
u_int8_t notify_data_remote_id[4];
|
||||||
u_int16_t *holdtime_ptr;
|
u_int16_t *holdtime_ptr;
|
||||||
unsigned long local_addr;
|
|
||||||
unsigned long remote_addr;
|
|
||||||
|
|
||||||
/* Parse open packet. */
|
/* Parse open packet. */
|
||||||
version = stream_getc (peer->ibuf);
|
version = stream_getc (peer->ibuf);
|
||||||
@ -1028,11 +998,10 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local_addr = ntohl (peer->local_id.s_addr);
|
|
||||||
remote_addr = ntohl (remote_id.s_addr);
|
|
||||||
|
|
||||||
/* remote router-id check. */
|
/* remote router-id check. */
|
||||||
if (local_addr == remote_addr || !bgp_valid_host_address(remote_addr))
|
if (remote_id.s_addr == 0
|
||||||
|
|| IPV4_CLASS_DE (ntohl (remote_id.s_addr))
|
||||||
|
|| ntohl (peer->local_id.s_addr) == ntohl (remote_id.s_addr))
|
||||||
{
|
{
|
||||||
if (bgp_debug_neighbor_events(peer))
|
if (bgp_debug_neighbor_events(peer))
|
||||||
zlog_debug ("%s bad OPEN, wrong router identifier %s",
|
zlog_debug ("%s bad OPEN, wrong router identifier %s",
|
||||||
|
@ -57,7 +57,6 @@ extern int bgp_capability_receive (struct peer *, bgp_size_t);
|
|||||||
extern void bgp_update_restarted_peers (struct peer *);
|
extern void bgp_update_restarted_peers (struct peer *);
|
||||||
extern void bgp_update_implicit_eors (struct peer *);
|
extern void bgp_update_implicit_eors (struct peer *);
|
||||||
extern void bgp_check_update_delay (struct bgp *);
|
extern void bgp_check_update_delay (struct bgp *);
|
||||||
extern int bgp_valid_host_address (unsigned long addr);
|
|
||||||
|
|
||||||
extern int bgp_packet_set_marker (struct stream *s, u_char type);
|
extern int bgp_packet_set_marker (struct stream *s, u_char type);
|
||||||
extern int bgp_packet_set_size (struct stream *s);
|
extern int bgp_packet_set_size (struct stream *s);
|
||||||
|
Loading…
Reference in New Issue
Block a user