diff mbox series

netconfig: Print addresses added and removed to debug log

Message ID 20221026175828.2435994-1-andrew.zaborowski@intel.com (mailing list archive)
State New
Headers show
Series netconfig: Print addresses added and removed to debug log | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint success GitLint
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-alpine-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

Andrew Zaborowski Oct. 26, 2022, 5:58 p.m. UTC
---
 src/netconfig-commit.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Denis Kenzior Oct. 26, 2022, 7:54 p.m. UTC | #1
Hi Andrew,

On 10/26/22 12:58, Andrew Zaborowski wrote:
> ---
>   src/netconfig-commit.c | 23 +++++++++++++++++++++++
>   1 file changed, 23 insertions(+)
> 

Applied, thanks.

Regards,
-Denis
diff mbox series

Patch

diff --git a/src/netconfig-commit.c b/src/netconfig-commit.c
index 96436c1c..0e7c3961 100644
--- a/src/netconfig-commit.c
+++ b/src/netconfig-commit.c
@@ -92,9 +92,32 @@  void netconfig_commit_free(struct netconfig *netconfig, const char *reasonstr)
 		l_queue_destroy(l_steal_ptr(netconfig_list), NULL);
 }
 
+static void netconfig_commit_print_addrs(const char *verb,
+					const struct l_queue_entry *addrs)
+{
+	for (; addrs; addrs = addrs->next) {
+		const struct l_rtnl_address *addr = addrs->data;
+		char str[INET6_ADDRSTRLEN];
+
+		if (l_rtnl_address_get_address(addr, str))
+			l_debug("%s address: %s", verb, str);
+	}
+}
+
 void netconfig_commit(struct netconfig *netconfig, uint8_t family,
 			enum l_netconfig_event event)
 {
+	const struct l_queue_entry *added;
+	const struct l_queue_entry *removed;
+	const struct l_queue_entry *expired;
+
+	l_netconfig_get_addresses(netconfig->nc, &added, NULL, &removed, &expired);
+
+	/* Only print IP additions and removals to avoid cluttering the log */
+	netconfig_commit_print_addrs("installing", added);
+	netconfig_commit_print_addrs("removing", removed);
+	netconfig_commit_print_addrs("expired", expired);
+
 	commit_ops->commit(netconfig, family, event);
 
 	if (event == L_NETCONFIG_EVENT_CONFIGURE) {