diff options
| -rw-r--r-- | bgpd/bgp_zebra.c | 7 | ||||
| -rw-r--r-- | doc/user/basic.rst | 4 | ||||
| -rw-r--r-- | lib/prefix.c | 2 | ||||
| -rw-r--r-- | lib/prefix.h | 5 |
4 files changed, 13 insertions, 5 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index da598993d1..346b3c90fd 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -834,6 +834,13 @@ bool bgp_zebra_nexthop_set(union sockunion *local, union sockunion *remote, peer->bgp->vrf_id); } + /* Handle peerings via loopbacks. For instance, peer between + * 127.0.0.1 and 127.0.0.2. In short, allow peering with self + * via 127.0.0.0/8. + */ + if (!ifp && cmd_allow_reserved_ranges_get()) + ifp = if_get_vrf_loopback(peer->bgp->vrf_id); + if (!ifp) { /* * BGP views do not currently get proper data diff --git a/doc/user/basic.rst b/doc/user/basic.rst index 254dad8303..337cfff937 100644 --- a/doc/user/basic.rst +++ b/doc/user/basic.rst @@ -349,6 +349,10 @@ Basic Config Commands Allow using IPv4 reserved (Class E) IP ranges for daemons. E.g.: setting IPv4 addresses for interfaces or allowing reserved ranges in BGP next-hops. + If you need multiple FRR instances (or FRR + any other daemon) running in a + single router and peering via 127.0.0.0/8, it's also possible to use this + knob if turned on. + Default: off. .. _sample-config-file: diff --git a/lib/prefix.c b/lib/prefix.c index a6aae08a6a..b8cad910f4 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -1399,7 +1399,7 @@ bool ipv4_unicast_valid(const struct in_addr *addr) if (IPV4_CLASS_D(ip)) return false; - if (IPV4_CLASS_E(ip)) { + if (IPV4_NET0(ip) || IPV4_NET127(ip) || IPV4_CLASS_E(ip)) { if (cmd_allow_reserved_ranges_get()) return true; else diff --git a/lib/prefix.h b/lib/prefix.h index 9c57283706..88a228b55c 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -499,11 +499,8 @@ extern int macstr2prefix_evpn(const char *str, struct prefix_evpn *p); /* NOTE: This routine expects the address argument in network byte order. */ static inline bool ipv4_martian(const struct in_addr *addr) { - in_addr_t ip = ntohl(addr->s_addr); - - if (IPV4_NET0(ip) || IPV4_NET127(ip) || !ipv4_unicast_valid(addr)) { + if (!ipv4_unicast_valid(addr)) return true; - } return false; } |
