+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Zebra API message creation & consumption.
* Portions:
* Copyright (C) 1997-1999 Kunihiro Ishiguro
* Copyright (C) 2015-2018 Cumulus Networks, Inc.
* et al.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
stream_putl(s, nexthop->ifindex);
break;
case NEXTHOP_TYPE_IPV6:
- stream_put(s, &nexthop->gate.ipv6, 16);
- break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
stream_put(s, &nexthop->gate.ipv6, 16);
stream_putl(s, nexthop->ifindex);
case NEXTHOP_TYPE_IFINDEX:
stream_putl(s, nexthop->ifindex);
break;
- default:
+ case NEXTHOP_TYPE_BLACKHOLE:
/* do nothing */
break;
}
else
client->redist_v6_del_cnt++;
break;
- default:
+ case AFI_L2VPN:
+ case AFI_MAX:
+ case AFI_UNSPEC:
break;
}
uint32_t label_index = MPLS_INVALID_LABEL_INDEX;
s = msg;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
return;
uint16_t flags;
s = msg;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (!zvrf)
return;
nexthop->srte_color = api_nh->srte_color;
}
- /* MPLS labels for BGP-LU or Segment Routing */
+ /* Labels for MPLS BGP-LU or Segment Routing or EVPN */
if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_LABEL)
&& api_nh->type != NEXTHOP_TYPE_IFINDEX
&& api_nh->type != NEXTHOP_TYPE_BLACKHOLE
&& api_nh->label_num > 0) {
- label_type = lsp_type_from_re_type(client->proto);
+ /* If label type was passed, use it */
+ if (api_nh->label_type)
+ label_type = api_nh->label_type;
+ else
+ label_type =
+ lsp_type_from_re_type(client->proto);
+
nexthop_add_labels(nexthop, label_type,
api_nh->label_num,
&api_nh->labels[0]);
mpls_label2str(nexthop->nh_label->num_labels,
nexthop->nh_label->label,
labelbuf, sizeof(labelbuf),
- false);
+ nexthop->nh_label_type, false);
}
zlog_debug("%s: nh=%s, vrf_id=%d %s",
{
struct ipaddr addr;
struct route_entry *re = NULL;
+ union g_addr gaddr;
STREAM_GET_IPADDR(msg, &addr);
switch (addr.ipa_type) {
case IPADDR_V4:
- re = rib_match_ipv4_multicast(zvrf_id(zvrf), addr.ipaddr_v4,
- NULL);
+ gaddr.ipv4 = addr.ipaddr_v4;
+ re = rib_match_multicast(AFI_IP, zvrf_id(zvrf), &gaddr, NULL);
break;
case IPADDR_V6:
- re = rib_match_ipv6_multicast(zvrf_id(zvrf), addr.ipaddr_v6,
- NULL);
+ gaddr.ipv6 = addr.ipaddr_v6;
+ re = rib_match_multicast(AFI_IP6, zvrf_id(zvrf), &gaddr, NULL);
break;
case IPADDR_NONE:
/* ??? */
struct zebra_vrf *zvrf;
struct zserv *client;
- zvrf = vrf_info_lookup(VRF_DEFAULT);
+ zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT);
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
/* Do not send unsolicited messages to synchronous clients. */
if (client->synchronous)
STREAM_GETL(s, filter.filter.u.flower.classid);
break;
}
- default:
+ case TC_FILTER_BPF:
+ case TC_FILTER_FLOW:
+ case TC_FILTER_U32:
+ case TC_FILTER_UNSPEC:
break;
}
static inline void zread_iptable(ZAPI_HANDLER_ARGS)
{
struct zebra_pbr_iptable *zpi =
- XCALLOC(MTYPE_TMP, sizeof(struct zebra_pbr_iptable));
+ XCALLOC(MTYPE_PBR_OBJ, sizeof(struct zebra_pbr_iptable));
struct stream *s;
s = msg;