mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-10-18 19:10:35 +00:00
lib: send ZAPI IPv6 source prefix
This introduces ZAPI_MESSAGE_SRCPFX, and if set adds a source prefix field to ZAPI IPv6 route messages sent from daemons to zebra. The function calls all have a new prefix_ipv6 * argument specifying the source, or NULL. All daemons currently supply NULL. Zebra support for processing the field was added in the previous patch, however, zebra does not do anything useful with the value yet. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
3c7c91d0bd
commit
d75f3b00e7
@ -1587,7 +1587,7 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp,
|
||||
|
||||
zapi_ipv6_route (valid_nh_count ?
|
||||
ZEBRA_IPV6_ROUTE_ADD : ZEBRA_IPV6_ROUTE_DELETE,
|
||||
zclient, (struct prefix_ipv6 *) p, &api);
|
||||
zclient, (struct prefix_ipv6 *) p, NULL, &api);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1725,7 +1725,7 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi)
|
||||
}
|
||||
|
||||
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient,
|
||||
(struct prefix_ipv6 *) p, &api);
|
||||
(struct prefix_ipv6 *) p, NULL, &api);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ vnc_zebra_route_msg (
|
||||
|
||||
zapi_ipv6_route ((add ? ZEBRA_IPV6_NEXTHOP_ADD :
|
||||
ZEBRA_IPV6_NEXTHOP_DELETE), zclient_vnc,
|
||||
(struct prefix_ipv6 *) p, &api);
|
||||
(struct prefix_ipv6 *) p, NULL, &api);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -424,7 +424,7 @@ isis_zebra_route_add_ipv6 (struct prefix *prefix,
|
||||
prefix6.family = AF_INET6;
|
||||
prefix6.prefixlen = prefix->prefixlen;
|
||||
memcpy (&prefix6.prefix, &prefix->u.prefix6, sizeof (struct in6_addr));
|
||||
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, &prefix6, &api);
|
||||
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, &prefix6, NULL, &api);
|
||||
SET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
|
||||
UNSET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC);
|
||||
}
|
||||
@ -505,7 +505,7 @@ isis_zebra_route_del_ipv6 (struct prefix *prefix,
|
||||
prefix6.family = AF_INET6;
|
||||
prefix6.prefixlen = prefix->prefixlen;
|
||||
memcpy (&prefix6.prefix, &prefix->u.prefix6, sizeof (struct in6_addr));
|
||||
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, &prefix6, &api);
|
||||
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, &prefix6, NULL, &api);
|
||||
UNSET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED);
|
||||
}
|
||||
|
||||
|
@ -854,12 +854,15 @@ zapi_ipv4_route_ipv6_nexthop (u_char cmd, struct zclient *zclient,
|
||||
|
||||
int
|
||||
zapi_ipv6_route (u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p,
|
||||
struct zapi_ipv6 *api)
|
||||
struct prefix_ipv6 *src_p, struct zapi_ipv6 *api)
|
||||
{
|
||||
int i;
|
||||
int psize;
|
||||
struct stream *s;
|
||||
|
||||
/* either we have !SRCPFX && src_p == NULL, or SRCPFX && src_p != NULL */
|
||||
assert (!(api->message & ZAPI_MESSAGE_SRCPFX) == !src_p);
|
||||
|
||||
/* Reset stream. */
|
||||
s = zclient->obuf;
|
||||
stream_reset (s);
|
||||
@ -878,6 +881,13 @@ zapi_ipv6_route (u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p,
|
||||
stream_putc (s, p->prefixlen);
|
||||
stream_write (s, (u_char *)&p->prefix, psize);
|
||||
|
||||
if (CHECK_FLAG (api->message, ZAPI_MESSAGE_SRCPFX))
|
||||
{
|
||||
psize = PSIZE (src_p->prefixlen);
|
||||
stream_putc (s, src_p->prefixlen);
|
||||
stream_write (s, (u_char *)&src_p->prefix, psize);
|
||||
}
|
||||
|
||||
/* Nexthop, ifindex, distance and metric information. */
|
||||
if (CHECK_FLAG (api->message, ZAPI_MESSAGE_NEXTHOP))
|
||||
{
|
||||
|
@ -246,7 +246,8 @@ struct zapi_ipv6
|
||||
};
|
||||
|
||||
extern int zapi_ipv6_route (u_char cmd, struct zclient *zclient,
|
||||
struct prefix_ipv6 *p, struct zapi_ipv6 *api);
|
||||
struct prefix_ipv6 *p, struct prefix_ipv6 *src_p,
|
||||
struct zapi_ipv6 *api);
|
||||
extern int zapi_ipv4_route_ipv6_nexthop (u_char, struct zclient *,
|
||||
struct prefix_ipv4 *, struct zapi_ipv6 *);
|
||||
|
||||
|
@ -463,9 +463,9 @@ ospf6_zebra_route_update (int type, struct ospf6_route *request)
|
||||
api.distance = ospf6_distance_apply (dest, request);
|
||||
|
||||
if (type == REM)
|
||||
ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, dest, &api);
|
||||
ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, dest, NULL, &api);
|
||||
else
|
||||
ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, dest, &api);
|
||||
ret = zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, dest, NULL, &api);
|
||||
|
||||
if (ret < 0)
|
||||
zlog_err ("zapi_ipv6_route() %s failed: %s",
|
||||
@ -527,7 +527,7 @@ ospf6_zebra_add_discard (struct ospf6_route *request)
|
||||
|
||||
dest = (struct prefix_ipv6 *) &request->prefix;
|
||||
|
||||
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, dest, &api);
|
||||
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, dest, NULL, &api);
|
||||
|
||||
if (IS_OSPF6_DEBUG_ZEBRA (SEND))
|
||||
zlog_debug ("Zebra: Route add discard %s/%d",
|
||||
@ -572,7 +572,7 @@ ospf6_zebra_delete_discard (struct ospf6_route *request)
|
||||
|
||||
dest = (struct prefix_ipv6 *) &request->prefix;
|
||||
|
||||
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, dest, &api);
|
||||
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, dest, NULL, &api);
|
||||
|
||||
if (IS_OSPF6_DEBUG_ZEBRA (SEND))
|
||||
zlog_debug ("Zebra: Route delete discard %s/%d",
|
||||
|
@ -99,7 +99,7 @@ ripng_zebra_ipv6_send (struct route_node *rp, u_char cmd)
|
||||
}
|
||||
|
||||
zapi_ipv6_route (cmd, zclient,
|
||||
(struct prefix_ipv6 *)&rp->p, &api);
|
||||
(struct prefix_ipv6 *)&rp->p, NULL, &api);
|
||||
|
||||
if (IS_RIPNG_DEBUG_ZEBRA)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user