acl: Fix/improve acl_del_entry log message.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 3 Jan 2018 13:12:00 +0000 (14:12 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 13 Mar 2018 02:28:10 +0000 (03:28 +0100)
The given address/netmask can match any number of entries. Currently
we log one message per removed address but all messages contain the
address/netmask to match rather than the removed one that was stored
in the acl.

This patch changes acl_del_entry() to log both, with different
severities.

acl.c

diff --git a/acl.c b/acl.c
index 75fdc55..2c90052 100644 (file)
--- a/acl.c
+++ b/acl.c
@@ -101,14 +101,18 @@ static void acl_del_entry(struct list_head *acl, char *addr, unsigned netmask)
        struct access_info *ai, *tmp;
        struct in_addr to_delete;
 
+       PARA_NOTICE_LOG("removing entries matching %s/%u\n", addr, netmask);
        inet_pton(AF_INET, addr, &to_delete);
 
        list_for_each_entry_safe(ai, tmp, acl, node) {
-
                if (v4_addr_match(to_delete.s_addr, ai->addr.s_addr,
                                        PARA_MIN(netmask, ai->netmask))) {
-                       PARA_NOTICE_LOG("removing %s/%u from access list\n",
-                                       addr, ai->netmask);
+                       char dst[INET_ADDRSTRLEN + 1];
+                       const char *p = inet_ntop(AF_INET, &ai->addr.s_addr,
+                               dst, sizeof(dst));
+                       if (p)
+                               PARA_INFO_LOG("removing %s/%u\n", p,
+                                       ai->netmask);
                        list_del(&ai->node);
                        free(ai);
                }