]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfclient/ospf_apiclient.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / ospfclient / ospf_apiclient.c
index 41f0b25b916c8cac18f476e79036be693f379fb0..c5bbc01501595abcaf13e722bed76830b0755941 100644 (file)
@@ -1,22 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Client side of OSPF API.
  * Copyright (C) 2001, 2002, 2003 Ralph Keller
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra 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, or (at your
- * option) any later version.
- *
- * GNU Zebra 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>
 
 #include "ospf_apiclient.h"
 
-/* *sigh* ... can't find a better way to hammer this into automake */
-#include "ospfd/ospf_dump_api.c"
-#include "ospfd/ospf_api.c"
-
 XREF_SETUP();
 
 DEFINE_MGROUP(OSPFCLIENT, "libospfapiclient");
@@ -439,6 +420,12 @@ int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient,
        struct lsa_header *lsah;
        uint32_t tmp;
 
+       /* Validate opaque LSA length */
+       if ((size_t)opaquelen > sizeof(buf) - sizeof(struct lsa_header)) {
+               fprintf(stderr, "opaquelen(%d) is larger than buf size %zu\n",
+                       opaquelen, sizeof(buf));
+               return OSPF_API_NOMEMORY;
+       }
 
        /* We can only originate opaque LSAs */
        if (!IS_OPAQUE_LSA(lsa_type)) {
@@ -447,12 +434,6 @@ int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient,
                return OSPF_API_ILLEGALLSATYPE;
        }
 
-       if ((size_t)opaquelen > sizeof(buf) - sizeof(struct lsa_header)) {
-               fprintf(stderr, "opaquelen(%d) is larger than buf size %zu\n",
-                       opaquelen, sizeof(buf));
-               return OSPF_API_NOMEMORY;
-       }
-
        /* Make a new LSA from parameters */
        lsah = (struct lsa_header *)buf;
        lsah->ls_age = 0;
@@ -481,8 +462,9 @@ int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient,
 }
 
 int ospf_apiclient_lsa_delete(struct ospf_apiclient *oclient,
-                             struct in_addr area_id, uint8_t lsa_type,
-                             uint8_t opaque_type, uint32_t opaque_id)
+                             struct in_addr addr, uint8_t lsa_type,
+                             uint8_t opaque_type, uint32_t opaque_id,
+                             uint8_t flags)
 {
        struct msg *msg;
        int rc;
@@ -496,8 +478,8 @@ int ospf_apiclient_lsa_delete(struct ospf_apiclient *oclient,
 
        /* opaque_id is in host byte order and will be converted
         * to network byte order by new_msg_delete_request */
-       msg = new_msg_delete_request(ospf_apiclient_get_seqnr(), area_id,
-                                    lsa_type, opaque_type, opaque_id);
+       msg = new_msg_delete_request(ospf_apiclient_get_seqnr(), addr, lsa_type,
+                                    opaque_type, opaque_id, flags);
 
        rc = ospf_apiclient_send_request(oclient, msg);
        return rc;