Merge pull request #3631 from opensourcerouting/zapi_fixes

Small zapi fixes
This commit is contained in:
Russ White 2019-01-21 20:25:08 -05:00 committed by GitHub
commit 62b6a7e149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 21 deletions

View File

@ -241,7 +241,7 @@ Zebra Protocol Commands
+------------------------------------+-------+ +------------------------------------+-------+
| ZEBRA_INTERFACE_DISABLE_RADV | 42 | | ZEBRA_INTERFACE_DISABLE_RADV | 42 |
+------------------------------------+-------+ +------------------------------------+-------+
| ZEBRA_IPV3_NEXTHOP_LOOKUP_MRIB | 44 | | ZEBRA_IPV3_NEXTHOP_LOOKUP_MRIB | 43 |
+------------------------------------+-------+ +------------------------------------+-------+
| ZEBRA_INTERFACE_LINK_PARAMS | 44 | | ZEBRA_INTERFACE_LINK_PARAMS | 44 |
+------------------------------------+-------+ +------------------------------------+-------+
@ -279,9 +279,9 @@ Zebra Protocol Commands
+------------------------------------+-------+ +------------------------------------+-------+
| ZEBRA_VNI_DEL | 61 | | ZEBRA_VNI_DEL | 61 |
+------------------------------------+-------+ +------------------------------------+-------+
| ZEBRA_L2VNI_ADD | 63 | | ZEBRA_L3VNI_ADD | 62 |
+------------------------------------+-------+ +------------------------------------+-------+
| ZEBRA_L2VNI_DEL | 64 | | ZEBRA_L3VNI_DEL | 63 |
+------------------------------------+-------+ +------------------------------------+-------+
| ZEBRA_REMOTE_VTEP_ADD | 64 | | ZEBRA_REMOTE_VTEP_ADD | 64 |
+------------------------------------+-------+ +------------------------------------+-------+

View File

@ -219,11 +219,11 @@ static int isis_zebra_if_address_del(int command, struct zclient *client,
} }
static int isis_zebra_link_params(int command, struct zclient *zclient, static int isis_zebra_link_params(int command, struct zclient *zclient,
zebra_size_t length) zebra_size_t length, vrf_id_t vrf_id)
{ {
struct interface *ifp; struct interface *ifp;
ifp = zebra_interface_link_params_read(zclient->ibuf); ifp = zebra_interface_link_params_read(zclient->ibuf, vrf_id);
if (ifp == NULL) if (ifp == NULL)
return 0; return 0;

View File

@ -457,8 +457,7 @@ void zclient_send_reg_requests(struct zclient *zclient, vrf_id_t vrf_id)
vrf_id); vrf_id);
/* If default information is needed. */ /* If default information is needed. */
if (vrf_bitmap_check(zclient->default_information[afi], if (vrf_bitmap_check(zclient->default_information[afi], vrf_id))
VRF_DEFAULT))
zebra_redistribute_default_send( zebra_redistribute_default_send(
ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient, afi, ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient, afi,
vrf_id); vrf_id);
@ -525,8 +524,7 @@ void zclient_send_dereg_requests(struct zclient *zclient, vrf_id_t vrf_id)
i, 0, vrf_id); i, 0, vrf_id);
/* If default information is needed. */ /* If default information is needed. */
if (vrf_bitmap_check(zclient->default_information[afi], if (vrf_bitmap_check(zclient->default_information[afi], vrf_id))
VRF_DEFAULT))
zebra_redistribute_default_send( zebra_redistribute_default_send(
ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, zclient, afi, ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, zclient, afi,
vrf_id); vrf_id);
@ -1497,7 +1495,8 @@ static void link_params_set_value(struct stream *s, struct if_link_params *iflp)
iflp->use_bw = stream_getf(s); iflp->use_bw = stream_getf(s);
} }
struct interface *zebra_interface_link_params_read(struct stream *s) struct interface *zebra_interface_link_params_read(struct stream *s,
vrf_id_t vrf_id)
{ {
struct if_link_params *iflp; struct if_link_params *iflp;
ifindex_t ifindex; ifindex_t ifindex;
@ -1506,7 +1505,7 @@ struct interface *zebra_interface_link_params_read(struct stream *s)
ifindex = stream_getl(s); ifindex = stream_getl(s);
struct interface *ifp = if_lookup_by_index(ifindex, VRF_DEFAULT); struct interface *ifp = if_lookup_by_index(ifindex, vrf_id);
if (ifp == NULL) { if (ifp == NULL) {
flog_err(EC_LIB_ZAPI_ENCODE, flog_err(EC_LIB_ZAPI_ENCODE,
@ -2583,7 +2582,7 @@ static int zclient_read(struct thread *thread)
case ZEBRA_INTERFACE_LINK_PARAMS: case ZEBRA_INTERFACE_LINK_PARAMS:
if (zclient->interface_link_params) if (zclient->interface_link_params)
(*zclient->interface_link_params)(command, zclient, (*zclient->interface_link_params)(command, zclient,
length); length, vrf_id);
break; break;
case ZEBRA_FEC_UPDATE: case ZEBRA_FEC_UPDATE:
if (zclient_debug) if (zclient_debug)

View File

@ -229,7 +229,7 @@ struct zclient {
int (*interface_address_add)(int, struct zclient *, uint16_t, vrf_id_t); int (*interface_address_add)(int, struct zclient *, uint16_t, vrf_id_t);
int (*interface_address_delete)(int, struct zclient *, uint16_t, int (*interface_address_delete)(int, struct zclient *, uint16_t,
vrf_id_t); vrf_id_t);
int (*interface_link_params)(int, struct zclient *, uint16_t); int (*interface_link_params)(int, struct zclient *, uint16_t, vrf_id_t);
int (*interface_bfd_dest_update)(int, struct zclient *, uint16_t, int (*interface_bfd_dest_update)(int, struct zclient *, uint16_t,
vrf_id_t); vrf_id_t);
int (*interface_nbr_address_add)(int, struct zclient *, uint16_t, int (*interface_nbr_address_add)(int, struct zclient *, uint16_t,
@ -564,7 +564,8 @@ extern struct interface *zebra_interface_vrf_update_read(struct stream *s,
extern void zebra_interface_if_set_value(struct stream *, struct interface *); extern void zebra_interface_if_set_value(struct stream *, struct interface *);
extern void zebra_router_id_update_read(struct stream *s, struct prefix *rid); extern void zebra_router_id_update_read(struct stream *s, struct prefix *rid);
extern struct interface *zebra_interface_link_params_read(struct stream *); extern struct interface *zebra_interface_link_params_read(struct stream *s,
vrf_id_t vrf_id);
extern size_t zebra_interface_link_params_write(struct stream *, extern size_t zebra_interface_link_params_write(struct stream *,
struct interface *); struct interface *);
extern int zclient_send_get_label_chunk( extern int zclient_send_get_label_chunk(

View File

@ -340,11 +340,11 @@ static int ospf_interface_address_delete(int command, struct zclient *zclient,
} }
static int ospf_interface_link_params(int command, struct zclient *zclient, static int ospf_interface_link_params(int command, struct zclient *zclient,
zebra_size_t length) zebra_size_t length, vrf_id_t vrf_id)
{ {
struct interface *ifp; struct interface *ifp;
ifp = zebra_interface_link_params_read(zclient->ibuf); ifp = zebra_interface_link_params_read(zclient->ibuf, vrf_id);
if (ifp == NULL) if (ifp == NULL)
return 0; return 0;

View File

@ -405,7 +405,7 @@ void zebra_interface_up_update(struct interface *ifp)
if (ifp->ptm_status || !ifp->ptm_enable) { if (ifp->ptm_status || !ifp->ptm_enable) {
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client))
if (client->ifinfo) { if (vrf_bitmap_check(client->ifinfo, ifp->vrf_id)) {
zsend_interface_update(ZEBRA_INTERFACE_UP, zsend_interface_update(ZEBRA_INTERFACE_UP,
client, ifp); client, ifp);
zsend_interface_link_params(client, ifp); zsend_interface_link_params(client, ifp);
@ -439,7 +439,7 @@ void zebra_interface_add_update(struct interface *ifp)
ifp->vrf_id); ifp->vrf_id);
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client))
if (client->ifinfo) { if (vrf_bitmap_check(client->ifinfo, ifp->vrf_id)) {
client->ifadd_cnt++; client->ifadd_cnt++;
zsend_interface_add(client, ifp); zsend_interface_add(client, ifp);
zsend_interface_link_params(client, ifp); zsend_interface_link_params(client, ifp);
@ -812,6 +812,6 @@ void zebra_interface_parameters_update(struct interface *ifp)
ifp->name, ifp->vrf_id); ifp->name, ifp->vrf_id);
for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client)) for (ALL_LIST_ELEMENTS(zebrad.client_list, node, nnode, client))
if (client->ifinfo) if (vrf_bitmap_check(client->ifinfo, ifp->vrf_id))
zsend_interface_link_params(client, ifp); zsend_interface_link_params(client, ifp);
} }

View File

@ -209,7 +209,7 @@ int zsend_interface_link_params(struct zserv *client, struct interface *ifp)
struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
/* Check this client need interface information. */ /* Check this client need interface information. */
if (!client->ifinfo) { if (!vrf_bitmap_check(client->ifinfo, ifp->vrf_id)) {
stream_free(s); stream_free(s);
return 0; return 0;
} }
@ -1324,6 +1324,7 @@ static void zread_interface_add(ZAPI_HANDLER_ARGS)
continue; continue;
zsend_interface_add(client, ifp); zsend_interface_add(client, ifp);
zsend_interface_link_params(client, ifp);
zsend_interface_addresses(client, ifp); zsend_interface_addresses(client, ifp);
} }
} }

View File

@ -37,7 +37,7 @@ static int zsend_interface_bfd_update(int cmd, struct zserv *client,
struct stream *s; struct stream *s;
/* Check this client need interface information. */ /* Check this client need interface information. */
if (!client->ifinfo) if (!vrf_bitmap_check(client->ifinfo, ifp->vrf_id))
return 0; return 0;
s = stream_new(ZEBRA_MAX_PACKET_SIZ); s = stream_new(ZEBRA_MAX_PACKET_SIZ);