diff mbox series

[44/90] inet: Include the command value and string in 'DBG'

Message ID 20231206235056.322578-48-gerickson@nuovations.com (mailing list archive)
State Not Applicable, archived
Headers show
Series Add Gateway Low-priority Default Routes for Non-default Services | expand

Commit Message

Grant Erickson Dec. 6, 2023, 11:50 p.m. UTC
From: Grant Erickson <erick205@umn.edu>

This includes the Routing Netlink (rtnl) command value and string in
'DBG' in 'iproute_default_modify' to aid in debugging.
---
 src/inet.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/inet.c b/src/inet.c
index 9d5841fdf2e3..4882f9b78205 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -3196,6 +3196,18 @@  int __connman_inet_del_fwmark_rule(uint32_t table_id, int family, uint32_t fwmar
 	return iprule_modify(RTM_DELRULE, family, table_id, fwmark);
 }
 
+static const char *rtnl_route_cmd2string(int cmd)
+{
+	switch (cmd) {
+	case RTM_NEWROUTE:
+		return "add";
+	case RTM_DELROUTE:
+		return "del";
+	}
+
+	return "";
+}
+
 static int iproute_default_modify(int cmd, uint32_t table_id, int ifindex,
 			const char *gateway, unsigned char prefixlen)
 {
@@ -3208,7 +3220,8 @@  static int iproute_default_modify(int cmd, uint32_t table_id, int ifindex,
 
 	interface = connman_inet_ifname(ifindex);
 
-	DBG("ifindex %d (%s) gateway %s/%u table %u <%s>",
+	DBG("cmd %d (%s) ifindex %d (%s) gateway %s/%u table %u <%s>",
+		cmd, rtnl_route_cmd2string(cmd),
 		ifindex, interface,
 		gateway, prefixlen,
 		table_id, __connman_inet_table2string(table_id));