* [PATCH teavpn2 1/5] README: Remove RELEASE_MODE var
2022-01-22 5:06 [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template Alviro Iskandar Setiawan
@ 2022-01-22 5:06 ` Alviro Iskandar Setiawan
2022-01-22 5:06 ` [PATCH teavpn2 2/5] README: Add instruction to build with GUI Alviro Iskandar Setiawan
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-01-22 5:06 UTC (permalink / raw)
To: Ammar Faizi; +Cc: Tea Inside Mailing List, Alviro Iskandar Setiawan
Since we use the configure script, we always do -O2 for all builds
and RELEASE_MODE variable is no longer used. Remove it from the
build instruction in README file.
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 8f15aed..c0a650f 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ welcomed).
```
git clone https://github.com/TeaInside/teavpn2;
cd teavpn2;
-make -j$(nproc) RELEASE_MODE=1;
+make -j$(nproc);
```
# Issues
--
2.32.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH teavpn2 2/5] README: Add instruction to build with GUI
2022-01-22 5:06 [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template Alviro Iskandar Setiawan
2022-01-22 5:06 ` [PATCH teavpn2 1/5] README: Remove RELEASE_MODE var Alviro Iskandar Setiawan
@ 2022-01-22 5:06 ` Alviro Iskandar Setiawan
2022-01-22 5:06 ` [PATCH teavpn2 3/5] mutex: Refactor mutex helpers Alviro Iskandar Setiawan
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-01-22 5:06 UTC (permalink / raw)
To: Ammar Faizi; +Cc: Tea Inside Mailing List, Alviro Iskandar Setiawan
Since we're now supporting GUI, add the instruction to build with
GUI support.
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
README.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/README.md b/README.md
index c0a650f..e8e16bc 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,12 @@ cd teavpn2;
make -j$(nproc);
```
+For build with GUI support:
+```
+./configure --gui;
+make -j$(nproc);
+```
+
# Issues
We welcome bug reports, feature requests and questions through GitHub
repository https://github.com/TeaInside/teavpn2 (kindly to open an issue).
--
2.32.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH teavpn2 3/5] mutex: Refactor mutex helpers
2022-01-22 5:06 [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template Alviro Iskandar Setiawan
2022-01-22 5:06 ` [PATCH teavpn2 1/5] README: Remove RELEASE_MODE var Alviro Iskandar Setiawan
2022-01-22 5:06 ` [PATCH teavpn2 2/5] README: Add instruction to build with GUI Alviro Iskandar Setiawan
@ 2022-01-22 5:06 ` Alviro Iskandar Setiawan
2022-01-22 5:06 ` [PATCH teavpn2 4/5] config/client: Fix data_dir for client config template Alviro Iskandar Setiawan
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-01-22 5:06 UTC (permalink / raw)
To: Ammar Faizi; +Cc: Tea Inside Mailing List, Alviro Iskandar Setiawan
Refactor mutex helpers, make it simpler. The old code was too verbose
and harder to read.
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
src/teavpn2/mutex.h | 89 +++++++++++++++++----------------------------
1 file changed, 34 insertions(+), 55 deletions(-)
diff --git a/src/teavpn2/mutex.h b/src/teavpn2/mutex.h
index cd86779..96abc0d 100644
--- a/src/teavpn2/mutex.h
+++ b/src/teavpn2/mutex.h
@@ -10,99 +10,78 @@
#include <pthread.h>
#include <teavpn2/common.h>
-#define MUTEX_LEAK_ASSERT 0
-#define MUTEX_LOCK_ASSERT 0
+#ifndef __MUTEX_LEAK_ASSERT
+#define __MUTEX_LEAK_ASSERT 0
+#endif
+
struct tmutex {
pthread_mutex_t mutex;
-#if MUTEX_LEAK_ASSERT
+
+#if __MUTEX_LEAK_ASSERT
union {
void *__leak_assert;
- uint64_t need_destroy;
+ uintptr_t need_destroy;
};
#else
bool need_destroy;
-#endif /* #if MUTEX_LEAK_ASSERT */
+#endif
};
-static __always_inline void mutex_init_mark(struct tmutex *m)
-{
-#if MUTEX_LEAK_ASSERT
- m->__leak_assert = malloc(1);
- if (unlikely(!m->__leak_assert))
- panic("Cannot initialize __leak_assert for mutex_init_mark");
-#else
- m->need_destroy = 1;
-#endif /* #if MUTEX_LEAK_ASSERT */
+#define MUTEX_INITIALIZER \
+{ \
+ .mutex = PTHREAD_MUTEX_INITIALIZER \
}
+#define DEFINE_MUTEX(V) struct tmutex V = MUTEX_INITIALIZER
-static __cold __always_inline int mutex_init(struct tmutex *m,
- const pthread_mutexattr_t *attr)
+
+static __always_inline int mutex_init(struct tmutex *m,
+ const pthread_mutexattr_t *attr)
{
int ret;
- memset(m, 0, sizeof(*m));
ret = pthread_mutex_init(&m->mutex, attr);
if (unlikely(ret)) {
- ret = errno;
pr_err("pthread_mutex_init(): " PRERF, PREAR(ret));
return -ret;
}
- mutex_init_mark(m);
- return ret;
-}
-
-static __hot __always_inline int mutex_lock(struct tmutex *m)
-{
- int ret;
- __asm__ volatile("":"+r"(m)::"memory");
- ret = pthread_mutex_lock(&m->mutex);
-#if MUTEX_LOCK_ASSERT
- BUG_ON(ret != 0);
+#if __MUTEX_LEAK_ASSERT
+ m->__leak_assert = malloc(1);
+ BUG_ON(!m->__leak_assert);
+#else
+ m->need_destroy = true;
#endif
+
return ret;
}
-
-static __hot __always_inline int mutex_unlock(struct tmutex *m)
+static __always_inline int mutex_lock(struct tmutex *m)
{
- int ret;
- __asm__ volatile("":"+r"(m)::"memory");
- ret = pthread_mutex_unlock(&m->mutex);
-#if MUTEX_LOCK_ASSERT
- BUG_ON(ret != 0);
-#endif
- return ret;
+ return pthread_mutex_lock(&m->mutex);
}
+static __always_inline int mutex_unlock(struct tmutex *m)
+{
+ return pthread_mutex_unlock(&m->mutex);
+}
static __always_inline int mutex_trylock(struct tmutex *m)
{
- __asm__ volatile("":"+r"(m)::"memory");
return pthread_mutex_trylock(&m->mutex);
}
-
-static __cold inline int mutex_destroy(struct tmutex *m)
+static __always_inline int mutex_destroy(struct tmutex *m)
{
- if (m->need_destroy) {
- int ret = pthread_mutex_destroy(&m->mutex);
- if (unlikely(ret)) {
- pr_err("pthread_mutex_destroy(): " PRERF, PREAR(ret));
- return -ret;
- }
-
-#if MUTEX_LEAK_ASSERT
- free(m->__leak_assert);
- m->__leak_assert = NULL;
-#else
- m->need_destroy = 0;
+ BUG_ON(!m->need_destroy);
+
+#if __MUTEX_LEAK_ASSERT
+ free(m->__leak_assert);
#endif
- }
- return 0;
+
+ return pthread_mutex_destroy(&m->mutex);
}
#endif /* #ifndef TEAVPN2__MUTEX_H */
--
2.32.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH teavpn2 4/5] config/client: Fix data_dir for client config template
2022-01-22 5:06 [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template Alviro Iskandar Setiawan
` (2 preceding siblings ...)
2022-01-22 5:06 ` [PATCH teavpn2 3/5] mutex: Refactor mutex helpers Alviro Iskandar Setiawan
@ 2022-01-22 5:06 ` Alviro Iskandar Setiawan
2022-01-22 5:06 ` [PATCH teavpn2 5/5] config/{client,server}: Update interface name to teavpn2 Alviro Iskandar Setiawan
2022-01-22 5:14 ` [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template Ammar Faizi
5 siblings, 0 replies; 10+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-01-22 5:06 UTC (permalink / raw)
To: Ammar Faizi; +Cc: Tea Inside Mailing List, Alviro Iskandar Setiawan
The data_dir was data/server, that's wrong because it's client config.
The client doesn't use data/server directory. Change the data_dir to
data/client.
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
config/client.ini | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/client.ini b/config/client.ini
index e180ccf..9495e62 100644
--- a/config/client.ini
+++ b/config/client.ini
@@ -5,7 +5,7 @@
[sys]
thread = 4
verbose_level = 2
-data_dir = data/server
+data_dir = data/client
[socket]
use_encryption = 0
--
2.32.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH teavpn2 5/5] config/{client,server}: Update interface name to teavpn2
2022-01-22 5:06 [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template Alviro Iskandar Setiawan
` (3 preceding siblings ...)
2022-01-22 5:06 ` [PATCH teavpn2 4/5] config/client: Fix data_dir for client config template Alviro Iskandar Setiawan
@ 2022-01-22 5:06 ` Alviro Iskandar Setiawan
2022-01-22 5:14 ` [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template Ammar Faizi
5 siblings, 0 replies; 10+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-01-22 5:06 UTC (permalink / raw)
To: Ammar Faizi; +Cc: Tea Inside Mailing List, Alviro Iskandar Setiawan
Change the default interface name to teavpn2-server-001 for server and
teavpn2-client-001 for client. The purpose is for better readability
and the ease of debugging.
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
config/client.ini | 2 +-
config/server.ini | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/client.ini b/config/client.ini
index 9495e62..fb82aaf 100644
--- a/config/client.ini
+++ b/config/client.ini
@@ -15,7 +15,7 @@ server_addr = 127.0.0.1
server_port = 44444
[iface]
-dev = tvpnc0
+dev = teavpn2-client-001
;
; Set override_default to 1 if you want to use VPN as
diff --git a/config/server.ini b/config/server.ini
index 0afafff..f75ad2d 100644
--- a/config/server.ini
+++ b/config/server.ini
@@ -18,7 +18,7 @@ ssl_cert = data/server/default_cert.pem
ssl_priv_key = data/server/default_key.pem
[iface]
-dev = tvpns0
+dev = teavpn2-server-001
mtu = 1450
ipv4 = 10.5.5.1
ipv4_netmask = 255.255.255.0
--
2.32.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template
2022-01-22 5:06 [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template Alviro Iskandar Setiawan
` (4 preceding siblings ...)
2022-01-22 5:06 ` [PATCH teavpn2 5/5] config/{client,server}: Update interface name to teavpn2 Alviro Iskandar Setiawan
@ 2022-01-22 5:14 ` Ammar Faizi
2022-01-22 5:41 ` Ammar Faizi
5 siblings, 1 reply; 10+ messages in thread
From: Ammar Faizi @ 2022-01-22 5:14 UTC (permalink / raw)
To: Alviro Iskandar Setiawan; +Cc: Tea Inside Mailing List
On Sat, Jan 22, 2022 at 12:06 PM Alviro Iskandar Setiawan wrote:
>
> Hello sir,
> There are 5 patces in this series. 2 pathces for updating README.md file,
> 1 patch for refactor mutex helpers, 2 patches for fixing config template.
>
Applied, thanks!
--
Ammar Faizi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template
2022-01-22 5:14 ` [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template Ammar Faizi
@ 2022-01-22 5:41 ` Ammar Faizi
2022-01-22 5:44 ` Alviro Iskandar Setiawan
0 siblings, 1 reply; 10+ messages in thread
From: Ammar Faizi @ 2022-01-22 5:41 UTC (permalink / raw)
To: Alviro Iskandar Setiawan; +Cc: Tea Inside Mailing List
On 1/22/22 12:14 PM, Ammar Faizi wrote:
> On Sat, Jan 22, 2022 at 12:06 PM Alviro Iskandar Setiawan wrote:
>>
>> Hello sir,
>> There are 5 patces in this series. 2 pathces for updating README.md file,
>> 1 patch for refactor mutex helpers, 2 patches for fixing config template.
>>
>
> Applied, thanks!
>
BTW Viro, regarding the GUI support. Who will continue it? Are you still
progressing on this one?
--
Ammar Faizi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template
2022-01-22 5:41 ` Ammar Faizi
@ 2022-01-22 5:44 ` Alviro Iskandar Setiawan
2022-01-22 5:48 ` Ammar Faizi
0 siblings, 1 reply; 10+ messages in thread
From: Alviro Iskandar Setiawan @ 2022-01-22 5:44 UTC (permalink / raw)
To: Ammar Faizi; +Cc: Tea Inside Mailing List
On Sat, Jan 22, 2022 at 12:41 PM Ammar Faizi <[email protected]> wrote:
> On 1/22/22 12:14 PM, Ammar Faizi wrote:
> > On Sat, Jan 22, 2022 at 12:06 PM Alviro Iskandar Setiawan wrote:
> >>
> >> Hello sir,
> >> There are 5 patces in this series. 2 pathces for updating README.md file,
> >> 1 patch for refactor mutex helpers, 2 patches for fixing config template.
> >>
> >
> > Applied, thanks!
> >
>
> BTW Viro, regarding the GUI support. Who will continue it? Are you still
> progressing on this one?
i'm not sure sir, but khaerul was working on the config editor
https://t.me/TeaInside/48193
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH teavpn2 0/5] Update README, Refactor and Fix Config Template
2022-01-22 5:44 ` Alviro Iskandar Setiawan
@ 2022-01-22 5:48 ` Ammar Faizi
0 siblings, 0 replies; 10+ messages in thread
From: Ammar Faizi @ 2022-01-22 5:48 UTC (permalink / raw)
To: Alviro Iskandar Setiawan; +Cc: Tea Inside Mailing List
On 1/22/22 12:44 PM, Alviro Iskandar Setiawan wrote:
> On Sat, Jan 22, 2022 at 12:41 PM Ammar Faizi <[email protected]> wrote:
>> On 1/22/22 12:14 PM, Ammar Faizi wrote:
>>> On Sat, Jan 22, 2022 at 12:06 PM Alviro Iskandar Setiawan wrote:
>>>>
>>>> Hello sir,
>>>> There are 5 patces in this series. 2 pathces for updating README.md file,
>>>> 1 patch for refactor mutex helpers, 2 patches for fixing config template.
>>>>
>>>
>>> Applied, thanks!
>>>
>>
>> BTW Viro, regarding the GUI support. Who will continue it? Are you still
>> progressing on this one?
>
> i'm not sure sir, but khaerul was working on the config editor
> https://t.me/TeaInside/48193
OK, let's see how it will go.
--
Ammar Faizi
^ permalink raw reply [flat|nested] 10+ messages in thread