*: Add tableid the route entry was sent to

Add for the southbound pass back the route entries tableid
used for installation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2018-02-09 19:27:52 -05:00
parent 8d056acc82
commit 28610f7e44
7 changed files with 20 additions and 17 deletions

View File

@ -99,8 +99,9 @@ static int eigrp_zebra_notify_owner(int command, struct zclient *zclient,
{
struct prefix p;
enum zapi_route_notify_owner note;
uint32_t table;
if (!zapi_route_notify_decode(zclient->ibuf, &p, &note))
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, &note))
return -1;
return 0;

View File

@ -1210,6 +1210,7 @@ stream_failure:
}
bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
uint32_t *tableid,
enum zapi_route_notify_owner *note)
{
STREAM_GET(note, s, sizeof(*note));
@ -1218,6 +1219,7 @@ bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
STREAM_GETC(s, p->prefixlen);
STREAM_GET(&p->u.prefix, s,
PSIZE(p->prefixlen));
STREAM_GETL(s, *tableid);
return true;

View File

@ -513,6 +513,7 @@ extern int zclient_send_rnh(struct zclient *zclient, int command,
extern int zapi_route_encode(u_char, struct stream *, struct zapi_route *);
extern int zapi_route_decode(struct stream *, struct zapi_route *);
bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
uint32_t *tableid,
enum zapi_route_notify_owner *note);
extern struct nexthop *nexthop_from_zapi_nexthop(struct zapi_nexthop *znh);
extern bool zapi_nexthop_update_decode(struct stream *s,

View File

@ -136,8 +136,9 @@ static int notify_owner(int command, struct zclient *zclient,
{
struct prefix p;
enum zapi_route_notify_owner note;
uint32_t table;
if (!zapi_route_notify_decode(zclient->ibuf, &p, &note))
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, &note))
return -1;
installed_routes++;

View File

@ -1033,8 +1033,7 @@ void kernel_route_rib_pass_fail(struct route_node *rn, struct prefix *p,
else
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
}
zsend_route_notify_owner(re->type, re->instance, re->vrf_id,
p, ZAPI_ROUTE_INSTALLED);
zsend_route_notify_owner(re, p, ZAPI_ROUTE_INSTALLED);
break;
case SOUTHBOUND_INSTALL_FAILURE:
/*
@ -1044,8 +1043,7 @@ void kernel_route_rib_pass_fail(struct route_node *rn, struct prefix *p,
*/
dest->selected_fib = re;
zsend_route_notify_owner(re->type, re->instance, re->vrf_id,
p, ZAPI_ROUTE_FAIL_INSTALL);
zsend_route_notify_owner(re, p, ZAPI_ROUTE_FAIL_INSTALL);
zlog_warn("%u:%s: Route install failed", re->vrf_id,
prefix2str(p, buf, sizeof(buf)));
break;
@ -1113,9 +1111,7 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
* know that they've lost
*/
if (old && old != re)
zsend_route_notify_owner(old->type, old->instance,
old->vrf_id, p,
ZAPI_ROUTE_BETTER_ADMIN_WON);
zsend_route_notify_owner(old, p, ZAPI_ROUTE_BETTER_ADMIN_WON);
/*
* Make sure we update the FPM any time we send new information to

View File

@ -978,21 +978,22 @@ static int zsend_ipv4_nexthop_lookup_mrib(struct zserv *client,
return zebra_server_send_message(client);
}
int zsend_route_notify_owner(u_char proto, u_short instance,
vrf_id_t vrf_id, struct prefix *p,
int zsend_route_notify_owner(struct route_entry *re, struct prefix *p,
enum zapi_route_notify_owner note)
{
struct zserv *client;
struct stream *s;
uint8_t blen;
client = zebra_find_client(proto, instance);
client = zebra_find_client(re->type, re->instance);
if (!client || !client->notify_owner) {
if (IS_ZEBRA_DEBUG_PACKET) {
char buff[PREFIX_STRLEN];
zlog_debug("Not Notifying Owner: %u about prefix %s",
proto, prefix2str(p, buff, sizeof(buff)));
zlog_debug(
"Not Notifying Owner: %u about prefix %s(%u)",
re->type, prefix2str(p, buff, sizeof(buff)),
re->table);
}
return 0;
}
@ -1000,7 +1001,7 @@ int zsend_route_notify_owner(u_char proto, u_short instance,
s = client->obuf;
stream_reset(s);
zclient_create_header(s, ZEBRA_ROUTE_NOTIFY_OWNER, vrf_id);
zclient_create_header(s, ZEBRA_ROUTE_NOTIFY_OWNER, re->vrf_id);
stream_put(s, &note, sizeof(note));
@ -1010,6 +1011,8 @@ int zsend_route_notify_owner(u_char proto, u_short instance,
stream_putc(s, p->prefixlen);
stream_put(s, &p->u.prefix, blen);
stream_putl(s, re->table);
stream_putw_at(s, 0, stream_get_endp(s));
return zebra_server_send_message(client);

View File

@ -175,8 +175,7 @@ extern int zsend_interface_vrf_update(struct zserv *, struct interface *,
extern int zsend_interface_link_params(struct zserv *, struct interface *);
extern int zsend_pw_update(struct zserv *, struct zebra_pw *);
extern int zsend_route_notify_owner(u_char proto, u_short instance,
vrf_id_t vrf_id, struct prefix *p,
extern int zsend_route_notify_owner(struct route_entry *re, struct prefix *p,
enum zapi_route_notify_owner note);
extern void zserv_nexthop_num_warn(const char *, const struct prefix *,