mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 16:57:44 +00:00
bgpd: Fix check for martian next hops
Ensure that the check for martian next hop is correct, including for MP nexthops, if IPv4. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
86f6f09e2e
commit
58cf4b28ff
@ -329,11 +329,11 @@ bgp_connected_delete (struct bgp *bgp, struct connected *ifc)
|
||||
}
|
||||
|
||||
int
|
||||
bgp_nexthop_self (struct bgp *bgp, struct attr *attr)
|
||||
bgp_nexthop_self (struct bgp *bgp, struct in_addr nh_addr)
|
||||
{
|
||||
struct bgp_addr tmp, *addr;
|
||||
|
||||
tmp.addr = attr->nexthop;
|
||||
tmp.addr = nh_addr;
|
||||
|
||||
addr = hash_lookup (bgp->address_hash, &tmp);
|
||||
if (addr)
|
||||
|
@ -74,7 +74,7 @@ extern void bgp_connected_add (struct bgp *bgp, struct connected *c);
|
||||
extern void bgp_connected_delete (struct bgp *bgp, struct connected *c);
|
||||
extern int bgp_multiaccess_check_v4 (struct in_addr, struct peer *);
|
||||
extern int bgp_config_write_scan_time (struct vty *);
|
||||
extern int bgp_nexthop_self (struct bgp *, struct attr *);
|
||||
extern int bgp_nexthop_self (struct bgp *, struct in_addr);
|
||||
extern struct bgp_nexthop_cache *bnc_new(void);
|
||||
extern void bnc_free(struct bgp_nexthop_cache *bnc);
|
||||
extern void bnc_nexthop_free(struct bgp_nexthop_cache *bnc);
|
||||
|
@ -2442,8 +2442,8 @@ bgp_update_martian_nexthop (struct bgp *bgp, afi_t afi, safi_t safi, struct attr
|
||||
{
|
||||
if (attr->nexthop.s_addr == 0 ||
|
||||
IPV4_CLASS_DE (ntohl (attr->nexthop.s_addr)) ||
|
||||
bgp_nexthop_self (bgp, attr))
|
||||
ret = 1;
|
||||
bgp_nexthop_self (bgp, attr->nexthop))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* If MP_NEXTHOP is present, validate it. */
|
||||
@ -2458,7 +2458,8 @@ bgp_update_martian_nexthop (struct bgp *bgp, afi_t afi, safi_t safi, struct attr
|
||||
case BGP_ATTR_NHLEN_IPV4:
|
||||
case BGP_ATTR_NHLEN_VPNV4:
|
||||
ret = (attre->mp_nexthop_global_in.s_addr == 0 ||
|
||||
IPV4_CLASS_DE (ntohl (attre->mp_nexthop_global_in.s_addr)));
|
||||
IPV4_CLASS_DE (ntohl (attre->mp_nexthop_global_in.s_addr)) ||
|
||||
bgp_nexthop_self (bgp, attre->mp_nexthop_global_in));
|
||||
break;
|
||||
|
||||
case BGP_ATTR_NHLEN_IPV6_GLOBAL:
|
||||
|
Loading…
Reference in New Issue
Block a user