]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: ospf_apiserver.c - fix link local opaque LSA delete
authorLou Berger <lberger@labn.net>
Fri, 21 Oct 2022 11:12:11 +0000 (11:12 +0000)
committerLou Berger <lberger@labn.net>
Fri, 21 Oct 2022 15:08:53 +0000 (15:08 +0000)
Signed-off-by: Lou Berger <lberger@labn.net>
ospfclient/ospf_apiclient.c
ospfclient/ospf_apiclient.h
ospfd/ospf_api.c
ospfd/ospf_api.h
ospfd/ospf_apiserver.c

index b5e6389d4c9b0cee3690537ed72bafe56753a36e..ae07724da20d94c2e30bc28a56fde020f9144fca 100644 (file)
@@ -481,7 +481,7 @@ 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,
+                             struct in_addr addr, uint8_t lsa_type,
                              uint8_t opaque_type, uint32_t opaque_id)
 {
        struct msg *msg;
@@ -496,8 +496,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);
 
        rc = ospf_apiclient_send_request(oclient, msg);
        return rc;
index 6d1eb7f64f45ca3cb4ad87c51570da689ff8bce5..cbdb250141183104ff6bce9cd62bd23da653fe7a 100644 (file)
@@ -94,7 +94,7 @@ int ospf_apiclient_lsa_originate(struct ospf_apiclient *oclient,
 /* Synchronous request to delete opaque LSA. Parameter opaque_id is in
    host byte order */
 int ospf_apiclient_lsa_delete(struct ospf_apiclient *oclient,
-                             struct in_addr area_id, uint8_t lsa_type,
+                             struct in_addr addr, uint8_t lsa_type,
                              uint8_t opaque_type, uint32_t opaque_id);
 
 /* Fetch async message and handle it  */
index 8636db450b402fc1e8a35d9e7f5886e085cd425a..59ec016f1e8d15f877a44c086bb44ea7ea55f92f 100644 (file)
@@ -532,12 +532,12 @@ struct msg *new_msg_originate_request(uint32_t seqnum, struct in_addr ifaddr,
        return msg_new(MSG_ORIGINATE_REQUEST, omsg, seqnum, omsglen);
 }
 
-struct msg *new_msg_delete_request(uint32_t seqnum, struct in_addr area_id,
+struct msg *new_msg_delete_request(uint32_t seqnum, struct in_addr addr,
                                   uint8_t lsa_type, uint8_t opaque_type,
                                   uint32_t opaque_id)
 {
        struct msg_delete_request dmsg;
-       dmsg.area_id = area_id;
+       dmsg.addr = addr;
        dmsg.lsa_type = lsa_type;
        dmsg.opaque_type = opaque_type;
        dmsg.opaque_id = htonl(opaque_id);
index 51c8c52ce542c57883d7336cb300af4dac6c9b78..589e650bbd89c15a2565ceb8bb5574db748bd7d6 100644 (file)
@@ -186,7 +186,7 @@ struct msg_originate_request {
 };
 
 struct msg_delete_request {
-       struct in_addr area_id; /* "0.0.0.0" for AS-external opaque LSAs */
+       struct in_addr addr; /* intf IP for link local, area for type 10, "0.0.0.0" for AS-external */
        uint8_t lsa_type;
        uint8_t opaque_type;
        uint8_t pad[2]; /* padding */
@@ -311,8 +311,7 @@ extern struct msg *new_msg_originate_request(uint32_t seqnum,
                                             struct in_addr ifaddr,
                                             struct in_addr area_id,
                                             struct lsa_header *data);
-extern struct msg *new_msg_delete_request(uint32_t seqnum,
-                                         struct in_addr area_id,
+extern struct msg *new_msg_delete_request(uint32_t seqnum, struct in_addr addr,
                                          uint8_t lsa_type, uint8_t opaque_type,
                                          uint32_t opaque_id);
 
index f5ed77dab59099ae18d51a920d495c0374375535..684e4c3d5bf6cb51558963db6c8408b6ffc16547 100644 (file)
@@ -1924,6 +1924,7 @@ int ospf_apiserver_handle_delete_request(struct ospf_apiserver *apiserv,
        struct msg_delete_request *dmsg;
        struct ospf_lsa *old;
        struct ospf_area *area = NULL;
+       struct ospf_interface *oi = NULL;
        struct in_addr id;
        int lsa_type, opaque_type;
        int rc = 0;
@@ -1938,11 +1939,20 @@ int ospf_apiserver_handle_delete_request(struct ospf_apiserver *apiserv,
        /* Lookup area for link-local and area-local opaque LSAs */
        switch (dmsg->lsa_type) {
        case OSPF_OPAQUE_LINK_LSA:
+               oi = ospf_apiserver_if_lookup_by_addr(dmsg->addr);
+               if (!oi) {
+                       zlog_warn("%s: unknown interface %pI4", __func__,
+                                 &dmsg->addr);
+                       rc = OSPF_API_NOSUCHINTERFACE;
+                       goto out;
+               }
+               area = oi->area;
+               break;
        case OSPF_OPAQUE_AREA_LSA:
-               area = ospf_area_lookup_by_area_id(ospf, dmsg->area_id);
+               area = ospf_area_lookup_by_area_id(ospf, dmsg->addr);
                if (!area) {
                        zlog_warn("%s: unknown area %pI4", __func__,
-                                 &dmsg->area_id);
+                                 &dmsg->addr);
                        rc = OSPF_API_NOSUCHAREA;
                        goto out;
                }