mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 07:37:29 +00:00
Merge pull request #1799 from donaldsharp/route_notify_owner
Route notify owner
This commit is contained in:
commit
8bc92a3ec7
@ -94,13 +94,14 @@ static int eigrp_router_id_update_zebra(int command, struct zclient *zclient,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int eigrp_zebra_notify_owner(int command, struct zclient *zclient,
|
static int eigrp_zebra_route_notify_owner(int command, struct zclient *zclient,
|
||||||
zebra_size_t length, vrf_id_t vrf_id)
|
zebra_size_t length, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
struct prefix p;
|
struct prefix p;
|
||||||
enum zapi_route_notify_owner note;
|
enum zapi_route_notify_owner note;
|
||||||
|
uint32_t table;
|
||||||
|
|
||||||
if (!zapi_route_notify_decode(zclient->ibuf, &p, ¬e))
|
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, ¬e))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -128,7 +129,7 @@ void eigrp_zebra_init(void)
|
|||||||
zclient->interface_address_delete = eigrp_interface_address_delete;
|
zclient->interface_address_delete = eigrp_interface_address_delete;
|
||||||
zclient->redistribute_route_add = eigrp_zebra_read_route;
|
zclient->redistribute_route_add = eigrp_zebra_read_route;
|
||||||
zclient->redistribute_route_del = eigrp_zebra_read_route;
|
zclient->redistribute_route_del = eigrp_zebra_read_route;
|
||||||
zclient->notify_owner = eigrp_zebra_notify_owner;
|
zclient->route_notify_owner = eigrp_zebra_route_notify_owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1210,14 +1210,20 @@ stream_failure:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
|
bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
|
||||||
|
uint32_t *tableid,
|
||||||
enum zapi_route_notify_owner *note)
|
enum zapi_route_notify_owner *note)
|
||||||
{
|
{
|
||||||
|
uint32_t t;
|
||||||
|
|
||||||
STREAM_GET(note, s, sizeof(*note));
|
STREAM_GET(note, s, sizeof(*note));
|
||||||
|
|
||||||
STREAM_GETC(s, p->family);
|
STREAM_GETC(s, p->family);
|
||||||
STREAM_GETC(s, p->prefixlen);
|
STREAM_GETC(s, p->prefixlen);
|
||||||
STREAM_GET(&p->u.prefix, s,
|
STREAM_GET(&p->u.prefix, s,
|
||||||
PSIZE(p->prefixlen));
|
prefix_blen(p));
|
||||||
|
STREAM_GETL(s, t);
|
||||||
|
|
||||||
|
*tableid = t;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -2363,9 +2369,9 @@ static int zclient_read(struct thread *thread)
|
|||||||
vrf_id);
|
vrf_id);
|
||||||
break;
|
break;
|
||||||
case ZEBRA_ROUTE_NOTIFY_OWNER:
|
case ZEBRA_ROUTE_NOTIFY_OWNER:
|
||||||
if (zclient->notify_owner)
|
if (zclient->route_notify_owner)
|
||||||
(*zclient->notify_owner)(command, zclient,
|
(*zclient->route_notify_owner)(command, zclient, length,
|
||||||
length, vrf_id);
|
vrf_id);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -213,8 +213,8 @@ struct zclient {
|
|||||||
int (*local_macip_add)(int, struct zclient *, uint16_t, vrf_id_t);
|
int (*local_macip_add)(int, struct zclient *, uint16_t, vrf_id_t);
|
||||||
int (*local_macip_del)(int, struct zclient *, uint16_t, vrf_id_t);
|
int (*local_macip_del)(int, struct zclient *, uint16_t, vrf_id_t);
|
||||||
int (*pw_status_update)(int, struct zclient *, uint16_t, vrf_id_t);
|
int (*pw_status_update)(int, struct zclient *, uint16_t, vrf_id_t);
|
||||||
int (*notify_owner)(int command, struct zclient *zclient,
|
int (*route_notify_owner)(int command, struct zclient *zclient,
|
||||||
uint16_t length, vrf_id_t vrf_id);
|
uint16_t length, vrf_id_t vrf_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Zebra API message flag. */
|
/* Zebra API message flag. */
|
||||||
@ -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_encode(u_char, struct stream *, struct zapi_route *);
|
||||||
extern int zapi_route_decode(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,
|
bool zapi_route_notify_decode(struct stream *s, struct prefix *p,
|
||||||
|
uint32_t *tableid,
|
||||||
enum zapi_route_notify_owner *note);
|
enum zapi_route_notify_owner *note);
|
||||||
extern struct nexthop *nexthop_from_zapi_nexthop(struct zapi_nexthop *znh);
|
extern struct nexthop *nexthop_from_zapi_nexthop(struct zapi_nexthop *znh);
|
||||||
extern bool zapi_nexthop_update_decode(struct stream *s,
|
extern bool zapi_nexthop_update_decode(struct stream *s,
|
||||||
|
@ -131,13 +131,14 @@ static int interface_state_down(int command, struct zclient *zclient,
|
|||||||
extern uint32_t total_routes;
|
extern uint32_t total_routes;
|
||||||
extern uint32_t installed_routes;
|
extern uint32_t installed_routes;
|
||||||
|
|
||||||
static int notify_owner(int command, struct zclient *zclient,
|
static int route_notify_owner(int command, struct zclient *zclient,
|
||||||
zebra_size_t length, vrf_id_t vrf_id)
|
zebra_size_t length, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
struct prefix p;
|
struct prefix p;
|
||||||
enum zapi_route_notify_owner note;
|
enum zapi_route_notify_owner note;
|
||||||
|
uint32_t table;
|
||||||
|
|
||||||
if (!zapi_route_notify_decode(zclient->ibuf, &p, ¬e))
|
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, ¬e))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
installed_routes++;
|
installed_routes++;
|
||||||
@ -210,5 +211,5 @@ void sharp_zebra_init(void)
|
|||||||
zclient->interface_down = interface_state_down;
|
zclient->interface_down = interface_state_down;
|
||||||
zclient->interface_address_add = interface_address_add;
|
zclient->interface_address_add = interface_address_add;
|
||||||
zclient->interface_address_delete = interface_address_delete;
|
zclient->interface_address_delete = interface_address_delete;
|
||||||
zclient->notify_owner = notify_owner;
|
zclient->route_notify_owner = route_notify_owner;
|
||||||
}
|
}
|
||||||
|
@ -1033,8 +1033,7 @@ void kernel_route_rib_pass_fail(struct route_node *rn, struct prefix *p,
|
|||||||
else
|
else
|
||||||
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
|
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
|
||||||
}
|
}
|
||||||
zsend_route_notify_owner(re->type, re->instance, re->vrf_id,
|
zsend_route_notify_owner(re, p, ZAPI_ROUTE_INSTALLED);
|
||||||
p, ZAPI_ROUTE_INSTALLED);
|
|
||||||
break;
|
break;
|
||||||
case SOUTHBOUND_INSTALL_FAILURE:
|
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;
|
dest->selected_fib = re;
|
||||||
|
|
||||||
zsend_route_notify_owner(re->type, re->instance, re->vrf_id,
|
zsend_route_notify_owner(re, p, ZAPI_ROUTE_FAIL_INSTALL);
|
||||||
p, ZAPI_ROUTE_FAIL_INSTALL);
|
|
||||||
zlog_warn("%u:%s: Route install failed", re->vrf_id,
|
zlog_warn("%u:%s: Route install failed", re->vrf_id,
|
||||||
prefix2str(p, buf, sizeof(buf)));
|
prefix2str(p, buf, sizeof(buf)));
|
||||||
break;
|
break;
|
||||||
@ -1112,10 +1110,8 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
|
|||||||
* If this is a replace to a new RE let the originator of the RE
|
* If this is a replace to a new RE let the originator of the RE
|
||||||
* know that they've lost
|
* know that they've lost
|
||||||
*/
|
*/
|
||||||
if (old && old != re)
|
if (old && (old != re) && (old->type != re->type))
|
||||||
zsend_route_notify_owner(old->type, old->instance,
|
zsend_route_notify_owner(old, p, ZAPI_ROUTE_BETTER_ADMIN_WON);
|
||||||
old->vrf_id, p,
|
|
||||||
ZAPI_ROUTE_BETTER_ADMIN_WON);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure we update the FPM any time we send new information to
|
* Make sure we update the FPM any time we send new information to
|
||||||
|
@ -986,29 +986,38 @@ static int zsend_ipv4_nexthop_lookup_mrib(struct zserv *client,
|
|||||||
return zebra_server_send_message(client);
|
return zebra_server_send_message(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
int zsend_route_notify_owner(u_char proto, u_short instance,
|
int zsend_route_notify_owner(struct route_entry *re, struct prefix *p,
|
||||||
vrf_id_t vrf_id, struct prefix *p,
|
|
||||||
enum zapi_route_notify_owner note)
|
enum zapi_route_notify_owner note)
|
||||||
{
|
{
|
||||||
struct zserv *client;
|
struct zserv *client;
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
uint8_t blen;
|
uint8_t blen;
|
||||||
|
|
||||||
client = zebra_find_client(proto, instance);
|
client = zebra_find_client(re->type, re->instance);
|
||||||
if (!client || !client->notify_owner) {
|
if (!client || !client->notify_owner) {
|
||||||
if (IS_ZEBRA_DEBUG_PACKET) {
|
if (IS_ZEBRA_DEBUG_PACKET) {
|
||||||
char buff[PREFIX_STRLEN];
|
char buff[PREFIX_STRLEN];
|
||||||
|
|
||||||
zlog_debug("Not Notifying Owner: %u about prefix %s",
|
zlog_debug(
|
||||||
proto, prefix2str(p, buff, sizeof(buff)));
|
"Not Notifying Owner: %u about prefix %s(%u) %d",
|
||||||
|
re->type, prefix2str(p, buff, sizeof(buff)),
|
||||||
|
re->table, note);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_ZEBRA_DEBUG_PACKET) {
|
||||||
|
char buff[PREFIX_STRLEN];
|
||||||
|
|
||||||
|
zlog_debug("Notifying Owner: %u about prefix %s(%u) %d",
|
||||||
|
re->type, prefix2str(p, buff, sizeof(buff)),
|
||||||
|
re->table, note);
|
||||||
|
}
|
||||||
|
|
||||||
s = client->obuf;
|
s = client->obuf;
|
||||||
stream_reset(s);
|
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, ¬e, sizeof(note));
|
stream_put(s, ¬e, sizeof(note));
|
||||||
|
|
||||||
@ -1018,6 +1027,8 @@ int zsend_route_notify_owner(u_char proto, u_short instance,
|
|||||||
stream_putc(s, p->prefixlen);
|
stream_putc(s, p->prefixlen);
|
||||||
stream_put(s, &p->u.prefix, blen);
|
stream_put(s, &p->u.prefix, blen);
|
||||||
|
|
||||||
|
stream_putl(s, re->table);
|
||||||
|
|
||||||
stream_putw_at(s, 0, stream_get_endp(s));
|
stream_putw_at(s, 0, stream_get_endp(s));
|
||||||
|
|
||||||
return zebra_server_send_message(client);
|
return zebra_server_send_message(client);
|
||||||
|
@ -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_interface_link_params(struct zserv *, struct interface *);
|
||||||
extern int zsend_pw_update(struct zserv *, struct zebra_pw *);
|
extern int zsend_pw_update(struct zserv *, struct zebra_pw *);
|
||||||
|
|
||||||
extern int zsend_route_notify_owner(u_char proto, u_short instance,
|
extern int zsend_route_notify_owner(struct route_entry *re, struct prefix *p,
|
||||||
vrf_id_t vrf_id, struct prefix *p,
|
|
||||||
enum zapi_route_notify_owner note);
|
enum zapi_route_notify_owner note);
|
||||||
|
|
||||||
extern void zserv_nexthop_num_warn(const char *, const struct prefix *,
|
extern void zserv_nexthop_num_warn(const char *, const struct prefix *,
|
||||||
|
Loading…
Reference in New Issue
Block a user