From: Donatas Abraitis Date: Fri, 1 Jul 2022 20:31:18 +0000 (+0300) Subject: bgpd: Reuse ipv4_martian() when validating BGP next-hop X-Git-Tag: frr-8.5.1~722^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=70632160e942d3777f799d9a705d9265d5981170;p=mirror_frr.git bgpd: Reuse ipv4_martian() when validating BGP next-hop Signed-off-by: Donatas Abraitis --- diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index e7690ed8d..1a253b122 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -1606,13 +1606,9 @@ static int bgp_attr_as4_path(struct bgp_attr_parser_args *args, enum bgp_attr_parse_ret bgp_attr_nexthop_valid(struct peer *peer, struct attr *attr) { - in_addr_t nexthop_h; struct bgp *bgp = peer->bgp; - nexthop_h = ntohl(attr->nexthop.s_addr); - if ((IPV4_NET0(nexthop_h) || IPV4_NET127(nexthop_h) || - !ipv4_unicast_valid(&attr->nexthop)) && - !bgp->allow_martian) { + if (ipv4_martian(&attr->nexthop) && !bgp->allow_martian) { uint8_t data[7]; /* type(2) + length(1) + nhop(4) */ char buf[INET_ADDRSTRLEN];