From a45710a5a887d25ab0e04ce1553bb268013ef780 Mon Sep 17 00:00:00 2001
From: Michael Tremer <michael.tremer@ipfire.org>
Date: Tue, 16 Sep 2014 14:44:42 +0200
Subject: [PATCH 19/22] openvpn: Ignore not fully established connections

---
 src/openvpn.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/openvpn.c b/src/openvpn.c
index 9598abc..6a0ffbd 100644
--- a/src/openvpn.c
+++ b/src/openvpn.c
@@ -292,6 +292,10 @@ static int multi1_read (char *name, FILE *fh)
 		if (fields_num < 4)
 			continue;
 
+		// Ignore not yet fully established connections
+		if (strcmp(fields[1], "UNDEF") == 0)
+			continue;
+
 		if (collect_user_count)
 			/* If so, sum all users, ignore the individuals*/
 		{
@@ -347,6 +351,10 @@ static int multi2_read (char *name, FILE *fh)
 		if (strcmp (fields[0], "CLIENT_LIST") != 0)
 			continue;
 
+		// Ignore not yet fully established connections
+		if (strcmp(fields[0], "UNDEF") == 0)
+			continue;
+
 		if (collect_user_count)
 			/* If so, sum all users, ignore the individuals*/
 		{
@@ -412,6 +420,10 @@ static int multi3_read (char *name, FILE *fh)
 			if (strcmp (fields[0], "CLIENT_LIST") != 0)
 				continue;
 
+			// Ignore not yet fully established connections
+			if (strcmp(fields[0], "UNDEF") == 0)
+				continue;
+
 			if (collect_user_count)
 				/* If so, sum all users, ignore the individuals*/
 			{
@@ -475,6 +487,9 @@ static int multi4_read (char *name, FILE *fh)
 		if (strcmp (fields[0], "CLIENT_LIST") != 0)
 			continue;
 
+		// Ignore not yet fully established connections
+		if (strcmp(fields[0], "UNDEF") == 0)
+			continue;
 
 		if (collect_user_count)
 			/* If so, sum all users, ignore the individuals*/
-- 
1.9.3

