mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-15 20:19:27 +00:00
Merge pull request #4302 from rgirada/fix_pim_upstream
staticd: static route config should get fail if nexthop configured as its local connected ip.
This commit is contained in:
commit
fa0ebe5a8a
@ -35,7 +35,6 @@
|
|||||||
#ifndef VTYSH_EXTRACT_PL
|
#ifndef VTYSH_EXTRACT_PL
|
||||||
#include "staticd/static_vty_clippy.c"
|
#include "staticd/static_vty_clippy.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct static_vrf *static_vty_get_unknown_vrf(struct vty *vty,
|
static struct static_vrf *static_vty_get_unknown_vrf(struct vty *vty,
|
||||||
const char *vrf_name)
|
const char *vrf_name)
|
||||||
{
|
{
|
||||||
@ -479,6 +478,23 @@ static int static_route_leak(
|
|||||||
return CMD_WARNING_CONFIG_FAILED;
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
}
|
}
|
||||||
gatep = &gate;
|
gatep = &gate;
|
||||||
|
|
||||||
|
if (afi == AFI_IP && !negate) {
|
||||||
|
if (if_lookup_exact_address(&gatep->ipv4, AF_INET,
|
||||||
|
svrf->vrf->vrf_id))
|
||||||
|
if (vty)
|
||||||
|
vty_out(vty,
|
||||||
|
"%% Warning!! Local connected address is configured as Gateway IP(%s)\n",
|
||||||
|
gate_str);
|
||||||
|
} else if (afi == AFI_IP6 && !negate) {
|
||||||
|
if (if_lookup_exact_address(&gatep->ipv6, AF_INET6,
|
||||||
|
svrf->vrf->vrf_id))
|
||||||
|
if (vty)
|
||||||
|
vty_out(vty,
|
||||||
|
"%% Warning!! Local connected address is configured as Gateway IPv6(%s)\n",
|
||||||
|
gate_str);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gate_str == NULL && ifname == NULL)
|
if (gate_str == NULL && ifname == NULL)
|
||||||
|
@ -200,6 +200,25 @@ struct static_nht_data {
|
|||||||
uint8_t nh_num;
|
uint8_t nh_num;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* API to check whether the configured nexthop address is
|
||||||
|
* one of its local connected address or not.
|
||||||
|
*/
|
||||||
|
static bool
|
||||||
|
static_nexthop_is_local(vrf_id_t vrfid, struct prefix *addr, int family)
|
||||||
|
{
|
||||||
|
if (family == AF_INET) {
|
||||||
|
if (if_lookup_exact_address(&addr->u.prefix4,
|
||||||
|
AF_INET,
|
||||||
|
vrfid))
|
||||||
|
return true;
|
||||||
|
} else if (family == AF_INET6) {
|
||||||
|
if (if_lookup_exact_address(&addr->u.prefix6,
|
||||||
|
AF_INET6,
|
||||||
|
vrfid))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
static int static_zebra_nexthop_update(ZAPI_CALLBACK_ARGS)
|
static int static_zebra_nexthop_update(ZAPI_CALLBACK_ARGS)
|
||||||
{
|
{
|
||||||
struct static_nht_data *nhtd, lookup;
|
struct static_nht_data *nhtd, lookup;
|
||||||
@ -214,6 +233,12 @@ static int static_zebra_nexthop_update(ZAPI_CALLBACK_ARGS)
|
|||||||
if (nhr.prefix.family == AF_INET6)
|
if (nhr.prefix.family == AF_INET6)
|
||||||
afi = AFI_IP6;
|
afi = AFI_IP6;
|
||||||
|
|
||||||
|
if (nhr.type == ZEBRA_ROUTE_CONNECT) {
|
||||||
|
if (static_nexthop_is_local(vrf_id, &nhr.prefix,
|
||||||
|
nhr.prefix.family))
|
||||||
|
nhr.nexthop_num = 0;
|
||||||
|
}
|
||||||
|
|
||||||
memset(&lookup, 0, sizeof(lookup));
|
memset(&lookup, 0, sizeof(lookup));
|
||||||
lookup.nh = &nhr.prefix;
|
lookup.nh = &nhr.prefix;
|
||||||
lookup.nh_vrf_id = vrf_id;
|
lookup.nh_vrf_id = vrf_id;
|
||||||
|
Loading…
Reference in New Issue
Block a user