diff mbox series

[26/90] connection: Add gateway config ADDED/REMOVED states.

Message ID 20231206235056.322578-27-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:49 p.m. UTC
From: Grant Erickson <erick205@umn.edu>

This adds two new gateway configuration lifecycle states: ADDED and
REMOVED.

ADDED indicates whether the gateway has been added, or set, to the
kernel but not acknowledged round-trip via a Routing Netlink (rtnl)
notification.

REMOVED indicates whether the gateway has been removed, or cleared,
from the kernel but not acknowledged round-trip via a Routing Netlink
(rtnl) notification.
---
 src/connection.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/connection.c b/src/connection.c
index 532b8f06713c..18ab007f0893 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -85,12 +85,24 @@  enum gateway_config_state {
 	 */
 	CONNMAN_GATEWAY_CONFIG_STATE_INACTIVE = 0,
 
+	/**
+	 *	Indicates whether the gateway has been added, or set, to the
+	 *	kernel but not acknowledged round-trip.
+	 */
+	CONNMAN_GATEWAY_CONFIG_STATE_ADDED	  = 1,
+
 	/**
 	 *	Indicates whether the gateway, or default router, is added and
 	 *	acknowledged by the kernel through a Routing Netlink (rtnl)
 	 *	notification and, consequently, is active (that is, in use).
 	 */
-	CONNMAN_GATEWAY_CONFIG_STATE_ACTIVE	  = 1
+	CONNMAN_GATEWAY_CONFIG_STATE_ACTIVE	  = 2,
+
+	/**
+	 *	Indicates whether the gateway has been removed, or cleared,
+	 *	from the kernel but not acknowledged round-trip.
+	 */
+	CONNMAN_GATEWAY_CONFIG_STATE_REMOVED  = 3
 };
 
 /**
@@ -262,8 +274,12 @@  static const char *gateway_config_state2string(enum gateway_config_state state)
 	switch (state) {
 	case CONNMAN_GATEWAY_CONFIG_STATE_INACTIVE:
 		return "inactive";
+	case CONNMAN_GATEWAY_CONFIG_STATE_ADDED:
+		return "added";
 	case CONNMAN_GATEWAY_CONFIG_STATE_ACTIVE:
 		return "active";
+	case CONNMAN_GATEWAY_CONFIG_STATE_REMOVED:
+		return "removed";
 	}
 
 	return NULL;