mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
lib, zebra: carry source prefix in route_notify
When a daemon wants to know about its routes, make it possible to have that work for dst-src routes. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
3671ce36fd
commit
2af780650f
|
@ -2015,6 +2015,15 @@ bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
|
|||
uint32_t *tableid,
|
||||
enum zapi_route_notify_owner *note,
|
||||
afi_t *afi, safi_t *safi)
|
||||
{
|
||||
struct prefix dummy;
|
||||
|
||||
return zapi_route_notify_decode_srcdest(s, p, &dummy, tableid, note, afi, safi);
|
||||
}
|
||||
|
||||
bool zapi_route_notify_decode_srcdest(struct stream *s, struct prefix *p, struct prefix *src_p,
|
||||
uint32_t *tableid, enum zapi_route_notify_owner *note,
|
||||
afi_t *afi, safi_t *safi)
|
||||
{
|
||||
uint32_t t;
|
||||
afi_t afi_val;
|
||||
|
@ -2025,6 +2034,9 @@ bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
|
|||
STREAM_GETC(s, p->family);
|
||||
STREAM_GETC(s, p->prefixlen);
|
||||
STREAM_GET(&p->u.prefix, s, prefix_blen(p));
|
||||
src_p->family = p->family;
|
||||
STREAM_GETC(s, src_p->prefixlen);
|
||||
STREAM_GET(&src_p->u.prefix, s, prefix_blen(src_p));
|
||||
STREAM_GETL(s, t);
|
||||
STREAM_GETC(s, afi_val);
|
||||
STREAM_GETC(s, safi_val);
|
||||
|
|
|
@ -1144,6 +1144,9 @@ bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
|
|||
uint32_t *tableid,
|
||||
enum zapi_route_notify_owner *note,
|
||||
afi_t *afi, safi_t *safi);
|
||||
bool zapi_route_notify_decode_srcdest(struct stream *s, struct prefix *p, struct prefix *src_p,
|
||||
uint32_t *tableid, enum zapi_route_notify_owner *note,
|
||||
afi_t *afi, safi_t *safi);
|
||||
bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno,
|
||||
uint32_t *priority, uint32_t *unique, char *ifname,
|
||||
enum zapi_rule_notify_owner *note);
|
||||
|
|
|
@ -740,6 +740,10 @@ static int route_notify_internal(const struct route_node *rn, int type,
|
|||
struct zserv *client;
|
||||
struct stream *s;
|
||||
uint8_t blen;
|
||||
const struct prefix *p, *src_p;
|
||||
struct prefix src_dummy = {};
|
||||
|
||||
srcdest_rnode_prefixes(rn, &p, &src_p);
|
||||
|
||||
client = zserv_find_client(type, instance);
|
||||
if (!client || !client->notify_owner) {
|
||||
|
@ -771,9 +775,17 @@ static int route_notify_internal(const struct route_node *rn, int type,
|
|||
|
||||
stream_putc(s, rn->p.family);
|
||||
|
||||
blen = prefix_blen(&rn->p);
|
||||
stream_putc(s, rn->p.prefixlen);
|
||||
stream_put(s, &rn->p.u.prefix, blen);
|
||||
blen = prefix_blen(p);
|
||||
stream_putc(s, p->prefixlen);
|
||||
stream_put(s, &p->u.prefix, blen);
|
||||
|
||||
if (!src_p) {
|
||||
src_dummy.family = p->family;
|
||||
src_p = &src_dummy;
|
||||
}
|
||||
blen = prefix_blen(src_p);
|
||||
stream_putc(s, src_p->prefixlen);
|
||||
stream_put(s, &src_p->u.prefix, blen);
|
||||
|
||||
stream_putl(s, table_id);
|
||||
|
||||
|
|
Loading…
Reference in a new issue