]> git.ipfire.org Git - thirdparty/openvpn.git/commit
networking: extend API for better memory management
authorAntonio Quartulli <antonio@openvpn.net>
Fri, 16 Aug 2019 20:26:54 +0000 (22:26 +0200)
committerGert Doering <gert@greenie.muc.de>
Sat, 17 Aug 2019 18:14:24 +0000 (20:14 +0200)
commit59fde742a113a450fe65a4d6b2cb9122425c1920
tree93b6924c96f5c4ab88f34dffc24d2ff6f4fd656f
parent2a74fc3f66bb9f73fc957719d187256922ca003f
networking: extend API for better memory management

Networking backend implementations may need to allocate dynamic
resources that require an explicit free/release.
Since these cleanup are perfomed not very often, and only at specific
times, it makes sense to have the upper layer signal when it's the right
time to do so, by means of a new API call.

For this purpose two news APIs have been implemented:
- net_ctx_free() to release all backend specific resources. Expected to
  be called at application cleanup time;
- net_ctx_reset() to let backends release temporary resources (i.e.
  reset garbage collectors). To be invoked after routines that
  are expected to allocate memory (i.e. tun setup or shutdown).

In this patch related implementations for iproute2 and sitnl are also
provided.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20190816202654.19388-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg18780.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/networking.h
src/openvpn/networking_iproute2.c
src/openvpn/networking_iproute2.h
src/openvpn/networking_sitnl.c
src/openvpn/openvpn.c
src/openvpn/route.c
src/openvpn/tun.c