]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_nb_rpcs.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / zebra / zebra_nb_rpcs.c
index cf8efe40a427a0834774e047c47efb5a85d767f6..083ab3fde69d28de7462f4ae44ddd4457f5e272d 100644 (file)
@@ -1,20 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2020 Cumulus Networks, Inc.
  *                    Chirag Shah
- *
- * 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>
 /*
  * XPath: /frr-zebra:clear-evpn-dup-addr
  */
-int clear_evpn_dup_addr_rpc(const char *xpath, const struct list *input,
-                           struct list *output)
+int clear_evpn_dup_addr_rpc(struct nb_cb_rpc_args *args)
 {
        struct zebra_vrf *zvrf;
        int ret = NB_OK;
        struct yang_data *yang_dup_choice = NULL, *yang_dup_vni = NULL,
                         *yang_dup_ip = NULL, *yang_dup_mac = NULL;
 
-       yang_dup_choice = yang_data_list_find(input, "%s/%s", xpath,
+       yang_dup_choice = yang_data_list_find(args->input, "%s/%s", args->xpath,
                                              "input/clear-dup-choice");
 
        zvrf = zebra_vrf_get_evpn();
@@ -51,41 +37,43 @@ int clear_evpn_dup_addr_rpc(const char *xpath, const struct list *input,
                struct ethaddr mac;
 
                yang_dup_vni = yang_data_list_find(
-                       input, "%s/%s", xpath,
+                       args->input, "%s/%s", args->xpath,
                        "input/clear-dup-choice/single-case/vni-id");
                if (yang_dup_vni) {
                        vni = yang_str2uint32(yang_dup_vni->value);
 
                        yang_dup_mac = yang_data_list_find(
-                               input, "%s/%s", xpath,
+                               args->input, "%s/%s", args->xpath,
                                "input/clear-dup-choice/single-case/vni-id/mac-addr");
                        yang_dup_ip = yang_data_list_find(
-                               input, "%s/%s", xpath,
+                               args->input, "%s/%s", args->xpath,
                                "input/clear-dup-choice/single-case/vni-id/vni-ipaddr");
 
                        if (yang_dup_mac) {
                                yang_str2mac(yang_dup_mac->value, &mac);
                                ret = zebra_vxlan_clear_dup_detect_vni_mac(
-                                       zvrf, vni, &mac);
+                                       zvrf, vni, &mac, args->errmsg,
+                                       args->errmsg_len);
                        } else if (yang_dup_ip) {
                                yang_str2ip(yang_dup_ip->value, &host_ip);
                                ret = zebra_vxlan_clear_dup_detect_vni_ip(
-                                       zvrf, vni, &host_ip);
+                                       zvrf, vni, &host_ip, args->errmsg,
+                                       args->errmsg_len);
                        } else
                                ret = zebra_vxlan_clear_dup_detect_vni(zvrf,
                                                                       vni);
                }
        }
-       ret = (ret != CMD_SUCCESS) ? NB_ERR : NB_OK;
+       if (ret < 0)
+               return NB_ERR;
 
-       return ret;
+       return NB_OK;
 }
 
 /*
  * XPath: /frr-zebra:get-route-information
  */
-int get_route_information_rpc(const char *xpath, const struct list *input,
-                             struct list *output)
+int get_route_information_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -94,8 +82,7 @@ int get_route_information_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-v6-mroute-info
  */
-int get_v6_mroute_info_rpc(const char *xpath, const struct list *input,
-                          struct list *output)
+int get_v6_mroute_info_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -104,8 +91,7 @@ int get_v6_mroute_info_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-vrf-info
  */
-int get_vrf_info_rpc(const char *xpath, const struct list *input,
-                    struct list *output)
+int get_vrf_info_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -114,8 +100,7 @@ int get_vrf_info_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-vrf-vni-info
  */
-int get_vrf_vni_info_rpc(const char *xpath, const struct list *input,
-                        struct list *output)
+int get_vrf_vni_info_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -124,8 +109,7 @@ int get_vrf_vni_info_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-evpn-info
  */
-int get_evpn_info_rpc(const char *xpath, const struct list *input,
-                     struct list *output)
+int get_evpn_info_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -134,8 +118,7 @@ int get_evpn_info_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-vni-info
  */
-int get_vni_info_rpc(const char *xpath, const struct list *input,
-                    struct list *output)
+int get_vni_info_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -144,8 +127,7 @@ int get_vni_info_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-evpn-vni-rmac
  */
-int get_evpn_vni_rmac_rpc(const char *xpath, const struct list *input,
-                         struct list *output)
+int get_evpn_vni_rmac_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -154,8 +136,7 @@ int get_evpn_vni_rmac_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-evpn-vni-nexthops
  */
-int get_evpn_vni_nexthops_rpc(const char *xpath, const struct list *input,
-                             struct list *output)
+int get_evpn_vni_nexthops_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -164,8 +145,7 @@ int get_evpn_vni_nexthops_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-evpn-macs
  */
-int get_evpn_macs_rpc(const char *xpath, const struct list *input,
-                     struct list *output)
+int get_evpn_macs_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -174,8 +154,7 @@ int get_evpn_macs_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-evpn-arp-cache
  */
-int get_evpn_arp_cache_rpc(const char *xpath, const struct list *input,
-                          struct list *output)
+int get_evpn_arp_cache_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -184,8 +163,7 @@ int get_evpn_arp_cache_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-pbr-ipset
  */
-int get_pbr_ipset_rpc(const char *xpath, const struct list *input,
-                     struct list *output)
+int get_pbr_ipset_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -194,8 +172,7 @@ int get_pbr_ipset_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-pbr-iptable
  */
-int get_pbr_iptable_rpc(const char *xpath, const struct list *input,
-                       struct list *output)
+int get_pbr_iptable_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;
@@ -204,8 +181,7 @@ int get_pbr_iptable_rpc(const char *xpath, const struct list *input,
 /*
  * XPath: /frr-zebra:get-debugs
  */
-int get_debugs_rpc(const char *xpath, const struct list *input,
-                  struct list *output)
+int get_debugs_rpc(struct nb_cb_rpc_args *args)
 {
        /* TODO: implement me. */
        return NB_ERR_NOT_FOUND;