]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Reuse ipv4_martian() when validating BGP next-hop
authorDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 1 Jul 2022 20:31:18 +0000 (23:31 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 1 Jul 2022 20:38:14 +0000 (23:38 +0300)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_attr.c

index e7690ed8df2ea4ba9f2f2d690e691c13d1b5311d..1a253b122a5f633ddd6c90c413be4bdd073b1a95 100644 (file)
@@ -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];