mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-01-03 02:23:54 +00:00
zebra: include intf when sending IPv4 nexthop to FPM
* zebra/zebra_fpm_netlink.c
Change the zebra FPM code to include an interface index when
encoding a nexthop even if the protocol only provided a gateway
address (e.g, NEXTHOP_TYPE_IPV4).
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
b9c24cd230
commit
324ed1f87a
@ -167,6 +167,7 @@ netlink_route_info_add_nh (netlink_route_info_t *ri, struct nexthop *nexthop)
|
||||
{
|
||||
nhi.recursive = 1;
|
||||
nhi.type = nexthop->rtype;
|
||||
nhi.if_index = nexthop->rifindex;
|
||||
|
||||
if (nexthop->rtype == NEXTHOP_TYPE_IPV4
|
||||
|| nexthop->rtype == NEXTHOP_TYPE_IPV4_IFINDEX)
|
||||
@ -186,15 +187,9 @@ netlink_route_info_add_nh (netlink_route_info_t *ri, struct nexthop *nexthop)
|
||||
#endif /* HAVE_IPV6 */
|
||||
|
||||
if (nexthop->rtype == NEXTHOP_TYPE_IFINDEX
|
||||
|| nexthop->rtype == NEXTHOP_TYPE_IFNAME
|
||||
|| nexthop->rtype == NEXTHOP_TYPE_IPV4_IFINDEX
|
||||
|| nexthop->rtype == NEXTHOP_TYPE_IPV6_IFINDEX
|
||||
|| nexthop->rtype == NEXTHOP_TYPE_IPV6_IFNAME)
|
||||
|| nexthop->rtype == NEXTHOP_TYPE_IFNAME)
|
||||
{
|
||||
nhi.if_index = nexthop->rifindex;
|
||||
if ((nexthop->rtype == NEXTHOP_TYPE_IPV4_IFINDEX
|
||||
|| nexthop->rtype == NEXTHOP_TYPE_IFINDEX)
|
||||
&& nexthop->src.ipv4.s_addr)
|
||||
if (nexthop->src.ipv4.s_addr)
|
||||
src = &nexthop->src;
|
||||
}
|
||||
|
||||
@ -203,6 +198,7 @@ netlink_route_info_add_nh (netlink_route_info_t *ri, struct nexthop *nexthop)
|
||||
|
||||
nhi.recursive = 0;
|
||||
nhi.type = nexthop->type;
|
||||
nhi.if_index = nexthop->ifindex;
|
||||
|
||||
if (nexthop->type == NEXTHOP_TYPE_IPV4
|
||||
|| nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX)
|
||||
@ -220,20 +216,13 @@ netlink_route_info_add_nh (netlink_route_info_t *ri, struct nexthop *nexthop)
|
||||
nhi.gateway = &nexthop->gate;
|
||||
}
|
||||
#endif /* HAVE_IPV6 */
|
||||
if (nexthop->type == NEXTHOP_TYPE_IFINDEX
|
||||
|| nexthop->type == NEXTHOP_TYPE_IFNAME
|
||||
|| nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX)
|
||||
{
|
||||
nhi.if_index = nexthop->ifindex;
|
||||
|
||||
if (nexthop->type == NEXTHOP_TYPE_IFINDEX
|
||||
|| nexthop->type == NEXTHOP_TYPE_IFNAME)
|
||||
{
|
||||
if (nexthop->src.ipv4.s_addr)
|
||||
src = &nexthop->src;
|
||||
}
|
||||
else if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX
|
||||
|| nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)
|
||||
{
|
||||
nhi.if_index = nexthop->ifindex;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fall through...
|
||||
|
||||
Loading…
Reference in New Issue
Block a user