]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Update some PDU logs, stop sending PDUs on reset exchange error
authorpcarana <pc.moreno2099@gmail.com>
Fri, 13 Mar 2020 18:30:02 +0000 (12:30 -0600)
committerpcarana <pc.moreno2099@gmail.com>
Fri, 13 Mar 2020 18:30:02 +0000 (12:30 -0600)
src/notify.c
src/rtr/pdu.c
src/rtr/pdu_handler.c
src/rtr/pdu_sender.c

index c9f79fbe97439d05777f346cb9fc4a0bc02288fc..6d8ee3c546bd6c615f70d8785e33a9c8b9658fcc 100644 (file)
@@ -11,17 +11,13 @@ static int
 send_notify(struct client *client, void *arg)
 {
        serial_t *serial = arg;
-       int error;
 
        /* Send Serial Notify PDU */
-       error = send_serial_notify_pdu(client->fd, client->rtr_version,
+       send_serial_notify_pdu(client->fd, client->rtr_version,
            *serial);
 
-       /* Error? Log it... */
-       if (error)
-               pr_warn("Error code %d sending notify PDU to client.", error);
-
-       return 0; /* ...but do not interrupt notify to other clients */
+       /* Errors already logged, do not interrupt notify to other clients */
+       return 0;
 }
 
 int
index 4cf45338bba150ac2d64f44bd84c6a0b02fb28cc..327e1c8c5cecbfeaec62db0d71444079b45ad7a0 100644 (file)
@@ -16,28 +16,28 @@ pdutype2str(enum pdu_type type)
 {
        switch (type) {
        case PDU_TYPE_SERIAL_NOTIFY:
-               return "Serial Notify";
+               return "Serial Notify PDU";
        case PDU_TYPE_SERIAL_QUERY:
-               return "Serial Query";
+               return "Serial Query PDU";
        case PDU_TYPE_RESET_QUERY:
-               return "Reset Query";
+               return "Reset Query PDU";
        case PDU_TYPE_CACHE_RESPONSE:
-               return "Cache Response";
+               return "Cache Response PDU";
        case PDU_TYPE_IPV4_PREFIX:
-               return "IPv4 Prefix";
+               return "IPv4 Prefix PDU";
        case PDU_TYPE_IPV6_PREFIX:
-               return "IPv6 Prefix";
+               return "IPv6 Prefix PDU";
        case PDU_TYPE_END_OF_DATA:
-               return "End of Data";
+               return "End of Data PDU";
        case PDU_TYPE_CACHE_RESET:
-               return "Cache Reset";
+               return "Cache Reset PDU";
        case PDU_TYPE_ROUTER_KEY:
-               return "Router Key";
+               return "Router Key PDU";
        case PDU_TYPE_ERROR_REPORT:
-               return "Error Report";
+               return "Error Report PDU";
        }
 
-       return "(unknown)";
+       return "unknown PDU";
 }
 
 static int
@@ -128,7 +128,7 @@ pdu_load(int fd, struct sockaddr_storage *client_addr,
 
        if (log_debug_enabled()) {
                char buffer[INET6_ADDRSTRLEN];
-               pr_debug("Received a %s PDU from %s.",
+               pr_debug("Received a %s from %s.",
                    pdutype2str(header.pdu_type),
                    sockaddr2str(client_addr, buffer));
        }
index f83504653b5ae774ee8c6f94cc9c029a999d6495..4edb858d07c3c721eb18af6ee918f040c7bedbbb 100644 (file)
@@ -186,6 +186,9 @@ handle_reset_query_pdu(int fd, struct rtr_request const *request)
        case EAGAIN:
                err_pdu_send_internal_error(fd, args.version);
                return error;
+       default:
+               /* Any other error must stop sending more PDUs */
+               return error;
        }
 
        return send_end_of_data_pdu(fd, args.version, current_serial);
index edd7355aa06b5cbbc38b61ff0e24081677a91583..01e2d7a4a1b99f73b2989e1377fbe3aed33a1144 100644 (file)
@@ -31,11 +31,12 @@ send_response(int fd, uint8_t pdu_type, unsigned char *data, size_t data_len)
 {
        int error;
 
-       pr_debug("Sending %s PDU to client.", pdutype2str(pdu_type));
+       pr_debug("Sending %s to client.", pdutype2str(pdu_type));
 
        error = write(fd, data, data_len);
        if (error < 0)
-               return pr_errno(errno, "Error sending response");
+               return pr_errno(errno, "Error sending %s to client.",
+                   pdutype2str(pdu_type));
 
        return 0;
 }