From e8716cc5c950e50411b23a7a6cafa3c063c59e90 Mon Sep 17 00:00:00 2001 From: AdrianStoenescu <51166009+AdrianStoenescu@users.noreply.github.com> Date: Thu, 25 Jul 2019 13:36:49 +0300 Subject: Add option in dlt.conf for bindAddress to specific IPs (#130) Add the possibility to have in dlt.conf an option that specifies a set of IP addresses. The daemon will do a socket bind only for this list, therefore external connections will be limited to this set of IP addresses. If this option is not given, the default INADDR_ANY is used ("0.0.0.0") as before. The option in dlt.conf can look like this: BindAddress = 160.48.199.98;160.48.199.97;160.48.199.226,160.48.199.186;160.48.199.139;172.16.222.99 There can be as many addresses but only specified on one single line. They have to be delimited by ',' or ';'. ' ' (space) delimiter does not work. IPv6 addresses are supported as well. For instance: BindAddress = fe80::255:7bff:feb5:7df7 IPv6 addresses are acceptable only if DLT_USE_IPv6 flag is ON at compile time. IPv4 addresses are acceptable only if DLT_USE_IPv6 flag is OFF at compile time. One cannot have both IPv4 and IPv6 format in the same time. Signed-off-by: Adrian Stoenescu Adrian.Stoenescu@harman.com --- include/dlt/dlt_common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') diff --git a/include/dlt/dlt_common.h b/include/dlt/dlt_common.h index 94177e3..06f91bf 100644 --- a/include/dlt/dlt_common.h +++ b/include/dlt/dlt_common.h @@ -73,6 +73,7 @@ \{ */ +# include # include # ifdef __linux__ # include @@ -810,6 +811,17 @@ typedef struct int size; } DltBufferBlockHead; +# ifdef DLT_USE_IPv6 +# define DLT_IP_SIZE (INET6_ADDRSTRLEN) +# else +# define DLT_IP_SIZE (INET_ADDRSTRLEN) +# endif +typedef struct DltBindAddress +{ + char ip[DLT_IP_SIZE]; + struct DltBindAddress *next; +} DltBindAddress_t; + # define DLT_MESSAGE_ERROR_OK 0 # define DLT_MESSAGE_ERROR_UNKNOWN -1 # define DLT_MESSAGE_ERROR_SIZE -2 -- cgit v1.2.1