l += IPV6_MAX_BYTELEN;
} else {
flog_err(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"rnh_register: Received unknown family type %d\n",
p.family);
return;
zebra_add_rnh_client(rnh, client, type, zvrf_id(zvrf));
/* Anything not AF_INET/INET6 has been filtered out above */
if (!exist)
- zebra_evaluate_rnh(zvrf_id(zvrf), p.family, 1, type,
- &p);
+ zebra_evaluate_rnh(zvrf, p.family, 1, type, &p);
}
stream_failure:
l += IPV6_MAX_BYTELEN;
} else {
flog_err(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"rnh_register: Received unknown family type %d\n",
p.family);
return;
*/
if (hdr->length < ZEBRA_MIN_FEC_LENGTH) {
flog_err(
- ZEBRA_ERR_IRDP_LEN_MISMATCH,
+ EC_ZEBRA_IRDP_LEN_MISMATCH,
"fec_register: Received a fec register of hdr->length %d, it is of insufficient size to properly decode",
hdr->length);
return;
STREAM_GETW(s, p.family);
if (p.family != AF_INET && p.family != AF_INET6) {
flog_err(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"fec_register: Received unknown family type %d\n",
p.family);
return;
*/
if (hdr->length < ZEBRA_MIN_FEC_LENGTH) {
flog_err(
- ZEBRA_ERR_IRDP_LEN_MISMATCH,
+ EC_ZEBRA_IRDP_LEN_MISMATCH,
"fec_unregister: Received a fec unregister of hdr->length %d, it is of insufficient size to properly decode",
hdr->length);
return;
STREAM_GETW(s, p.family);
if (p.family != AF_INET && p.family != AF_INET6) {
flog_err(
- ZEBRA_ERR_UNKNOWN_FAMILY,
+ EC_ZEBRA_UNKNOWN_FAMILY,
"fec_unregister: Received unknown family type %d\n",
p.family);
return;
prefix2str(p, buff, sizeof(buff));
flog_warn(
- ZEBRA_ERR_MORE_NH_THAN_MULTIPATH,
+ EC_ZEBRA_MORE_NH_THAN_MULTIPATH,
"%s: Prefix %s has %d nexthops, but we can only use the first %d",
caller, buff, nexthop_num, multipath_num);
}
if (!nexthop) {
flog_warn(
- ZEBRA_ERR_NEXTHOP_CREATION_FAILED,
+ EC_ZEBRA_NEXTHOP_CREATION_FAILED,
"%s: Nexthops Specified: %d but we failed to properly create one",
__PRETTY_FUNCTION__, api.nexthop_num);
nexthops_free(re->ng.nexthop);
afi = family2afi(api.prefix.family);
if (afi != AFI_IP6 && CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) {
- flog_warn(ZEBRA_ERR_RX_SRCDEST_WRONG_AFI,
+ flog_warn(EC_ZEBRA_RX_SRCDEST_WRONG_AFI,
"%s: Received SRC Prefix but afi is not v6",
__PRETTY_FUNCTION__);
nexthops_free(re->ng.nexthop);
afi = family2afi(api.prefix.family);
if (afi != AFI_IP6 && CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) {
- flog_warn(ZEBRA_ERR_RX_SRCDEST_WRONG_AFI,
+ flog_warn(EC_ZEBRA_RX_SRCDEST_WRONG_AFI,
"%s: Received a src prefix while afi is not v6",
__PRETTY_FUNCTION__);
return;
/* accept only dynamic routing protocols */
if ((proto >= ZEBRA_ROUTE_MAX) || (proto <= ZEBRA_ROUTE_STATIC)) {
- flog_err(ZEBRA_ERR_TM_WRONG_PROTO,
- "client %d has wrong protocol %s", client->sock,
- zebra_route_string(proto));
+ flog_err(EC_ZEBRA_TM_WRONG_PROTO,
+ "client %d has wrong protocol %s", client->sock,
+ zebra_route_string(proto));
zsend_table_manager_connect_response(client, vrf_id, 1);
return;
}
/* accept only dynamic routing protocols */
if ((proto >= ZEBRA_ROUTE_MAX) || (proto <= ZEBRA_ROUTE_STATIC)) {
- flog_err(ZEBRA_ERR_TM_WRONG_PROTO,
- "client %d has wrong protocol %s", client->sock,
- zebra_route_string(proto));
- zsend_label_manager_connect_response(client, vrf_id, 1);
+ flog_err(EC_ZEBRA_TM_WRONG_PROTO,
+ "client %d has wrong protocol %s", client->sock,
+ zebra_route_string(proto));
+ if (client->is_synchronous)
+ zsend_label_manager_connect_response(client, vrf_id, 1);
return;
}
zlog_notice("client %d with vrf %u instance %u connected as %s",
" Label Manager client connected: sock %d, proto %s, vrf %u instance %u",
client->sock, zebra_route_string(proto), vrf_id, instance);
/* send response back */
- zsend_label_manager_connect_response(client, vrf_id, 0);
+ if (client->is_synchronous)
+ zsend_label_manager_connect_response(client, vrf_id, 0);
stream_failure:
return;
}
-static int msg_client_id_mismatch(const char *op, struct zserv *client,
- uint8_t proto, unsigned int instance)
-{
- if (proto != client->proto) {
- flog_err(ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH,
- "%s: msg vs client proto mismatch, client=%u msg=%u",
- op, client->proto, proto);
- /* TODO: fail when BGP sets proto and instance */
- /* return 1; */
- }
-
- if (instance != client->instance) {
- flog_err(
- ZEBRA_ERR_PROTO_OR_INSTANCE_MISMATCH,
- "%s: msg vs client instance mismatch, client=%u msg=%u",
- op, client->instance, instance);
- /* TODO: fail when BGP sets proto and instance */
- /* return 1; */
- }
-
- return 0;
-}
static void zread_get_label_chunk(struct zserv *client, struct stream *msg,
vrf_id_t vrf_id)
STREAM_GETC(s, keep);
STREAM_GETL(s, size);
- /* detect client vs message (proto,instance) mismatch */
- if (msg_client_id_mismatch("Get-label-chunk", client, proto, instance))
- return;
-
- lmc = assign_label_chunk(client->proto, client->instance, keep, size);
+ lmc = assign_label_chunk(proto, instance, keep, size);
if (!lmc)
flog_err(
- ZEBRA_ERR_LM_CANNOT_ASSIGN_CHUNK,
+ EC_ZEBRA_LM_CANNOT_ASSIGN_CHUNK,
"Unable to assign Label Chunk of size %u to %s instance %u",
- size, zebra_route_string(client->proto),
- client->instance);
+ size, zebra_route_string(proto), instance);
else
zlog_debug("Assigned Label Chunk %u - %u to %s instance %u",
lmc->start, lmc->end,
- zebra_route_string(client->proto), client->instance);
+ zebra_route_string(proto), instance);
/* send response back */
zsend_assign_label_chunk_response(client, vrf_id, lmc);
STREAM_GETL(s, start);
STREAM_GETL(s, end);
- /* detect client vs message (proto,instance) mismatch */
- if (msg_client_id_mismatch("Release-label-chunk", client, proto,
- instance))
- return;
-
- release_label_chunk(client->proto, client->instance, start, end);
+ release_label_chunk(proto, instance, start, end);
stream_failure:
return;
static void zread_label_manager_request(ZAPI_HANDLER_ARGS)
{
/* to avoid sending other messages like ZERBA_INTERFACE_UP */
- if (hdr->command == ZEBRA_LABEL_MANAGER_CONNECT)
- client->is_synchronous = 1;
+ client->is_synchronous = hdr->command ==
+ ZEBRA_LABEL_MANAGER_CONNECT;
/* external label manager */
if (lm_is_external)
zvrf_id(zvrf));
/* this is a label manager */
else {
- if (hdr->command == ZEBRA_LABEL_MANAGER_CONNECT)
+ if (hdr->command == ZEBRA_LABEL_MANAGER_CONNECT ||
+ hdr->command == ZEBRA_LABEL_MANAGER_CONNECT_ASYNC)
zread_label_manager_connect(client, msg, zvrf_id(zvrf));
else {
- /* Sanity: don't allow 'unidentified' requests */
- if (!client->proto) {
- flog_err(
- ZEBRA_ERR_LM_ALIENS,
- "Got label request from an unidentified client");
- return;
- }
if (hdr->command == ZEBRA_GET_LABEL_CHUNK)
zread_get_label_chunk(client, msg,
zvrf_id(zvrf));
tmc = assign_table_chunk(client->proto, client->instance, size);
if (!tmc)
- flog_err(ZEBRA_ERR_TM_CANNOT_ASSIGN_CHUNK,
- "%s: Unable to assign Table Chunk of size %u",
- __func__, size);
+ flog_err(EC_ZEBRA_TM_CANNOT_ASSIGN_CHUNK,
+ "%s: Unable to assign Table Chunk of size %u",
+ __func__, size);
else
zlog_debug("Assigned Table Chunk %u - %u", tmc->start,
tmc->end);
/* Sanity: don't allow 'unidentified' requests */
if (!client->proto) {
flog_err(
- ZEBRA_ERR_TM_ALIENS,
+ EC_ZEBRA_TM_ALIENS,
"Got table request from an unidentified client");
return;
}
switch (hdr->command) {
case ZEBRA_PW_ADD:
if (pw) {
- flog_warn(ZEBRA_ERR_PSEUDOWIRE_EXISTS,
+ flog_warn(EC_ZEBRA_PSEUDOWIRE_EXISTS,
"%s: pseudowire %s already exists [%s]",
__func__, ifname,
zserv_command_string(hdr->command));
break;
case ZEBRA_PW_DELETE:
if (!pw) {
- flog_warn(ZEBRA_ERR_PSEUDOWIRE_NONEXISTENT,
+ flog_warn(EC_ZEBRA_PSEUDOWIRE_NONEXISTENT,
"%s: pseudowire %s not found [%s]", __func__,
ifname, zserv_command_string(hdr->command));
return;
case ZEBRA_PW_SET:
case ZEBRA_PW_UNSET:
if (!pw) {
- flog_warn(ZEBRA_ERR_PSEUDOWIRE_NONEXISTENT,
+ flog_warn(EC_ZEBRA_PSEUDOWIRE_NONEXISTENT,
"%s: pseudowire %s not found [%s]", __func__,
ifname, zserv_command_string(hdr->command));
return;
if (zpr.rule.filter.fwmark)
zpr.rule.filter.filter_bm |= PBR_FILTER_FWMARK;
+ zpr.vrf_id = zvrf->vrf->vrf_id;
if (hdr->command == ZEBRA_RULE_ADD)
- zebra_pbr_add_rule(zvrf->zns, &zpr);
+ zebra_pbr_add_rule(&zpr);
else
- zebra_pbr_del_rule(zvrf->zns, &zpr);
+ zebra_pbr_del_rule(&zpr);
}
stream_failure:
STREAM_GET(&zpi.ipset_name, s, ZEBRA_IPSET_NAME_SIZE);
if (hdr->command == ZEBRA_IPSET_CREATE)
- zebra_pbr_create_ipset(zvrf->zns, &zpi);
+ zebra_pbr_create_ipset(&zpi);
else
- zebra_pbr_destroy_ipset(zvrf->zns, &zpi);
+ zebra_pbr_destroy_ipset(&zpi);
}
stream_failure:
zpi.filter_bm |= PBR_FILTER_PROTO;
/* calculate backpointer */
- zpi.backpointer = zebra_pbr_lookup_ipset_pername(
- zvrf->zns, ipset.ipset_name);
+ zpi.backpointer =
+ zebra_pbr_lookup_ipset_pername(ipset.ipset_name);
if (hdr->command == ZEBRA_IPSET_ENTRY_ADD)
- zebra_pbr_add_ipset_entry(zvrf->zns, &zpi);
+ zebra_pbr_add_ipset_entry(&zpi);
else
- zebra_pbr_del_ipset_entry(zvrf->zns, &zpi);
+ zebra_pbr_del_ipset_entry(&zpi);
}
stream_failure:
zebra_pbr_iptable_update_interfacelist(s, &zpi);
if (hdr->command == ZEBRA_IPTABLE_ADD)
- zebra_pbr_add_iptable(zvrf->zns, &zpi);
+ zebra_pbr_add_iptable(&zpi);
else
- zebra_pbr_del_iptable(zvrf->zns, &zpi);
+ zebra_pbr_del_iptable(&zpi);
stream_failure:
return;
}
[ZEBRA_MPLS_LABELS_DELETE] = zread_mpls_labels,
[ZEBRA_IPMR_ROUTE_STATS] = zebra_ipmr_route_stats,
[ZEBRA_LABEL_MANAGER_CONNECT] = zread_label_manager_request,
+ [ZEBRA_LABEL_MANAGER_CONNECT_ASYNC] = zread_label_manager_request,
[ZEBRA_GET_LABEL_CHUNK] = zread_label_manager_request,
[ZEBRA_RELEASE_LABEL_CHUNK] = zread_label_manager_request,
[ZEBRA_FEC_REGISTER] = zread_fec_register,
[ZEBRA_IPSET_ENTRY_DELETE] = zread_ipset_entry,
[ZEBRA_IPTABLE_ADD] = zread_iptable,
[ZEBRA_IPTABLE_DELETE] = zread_iptable,
+ [ZEBRA_VXLAN_FLOOD_CONTROL] = zebra_vxlan_flood_control,
};
#if defined(HANDLE_ZAPI_FUZZING)