Andrew Scott
6299bdbf04
src/common: return -1 from get_addr on error
...
getaddrinfo will typically return negative values for errors, but this
is not the case for all systems. For example, glibc defines the errors
as negative, but the WSA equivalents are all positive. This commit
unifies the approach within iodine by always returning -1 in the event
getaddrinfo is unsuccessful.
2024-10-29 18:37:31 -04:00
Erik Ekman
2c7940cf77
Fix clang warning
...
"a function declaration without a prototype is deprecated in all versions of C"
2024-07-15 23:54:25 +02:00
Erik Ekman
6be47466f2
Try to include relevant parts of macos if_utun.h
...
To compile without it (pre 10.6)
See bug #98
2024-07-15 23:46:22 +02:00
Erik Ekman
ec5c89a368
Merge pull request #93 from ffontaine/master
...
src/osflags: fully fix cross-compilation
2023-11-30 00:29:17 +01:00
François Revol
39c3154a77
Haiku has daemon() in libbsd
2023-11-18 18:20:22 +01:00
François Revol
8ba813f08e
osflags: on Haiku, require BSD headers and lib
2023-11-18 18:19:14 +01:00
Fabrice Fontaine
a5d71d0761
src/osflags: fully fix cross-compilation
...
Cross-compilation was only partially fixed by
024481c94b
as selinux was still enabled depending on host file existence
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2023-11-02 23:03:15 +01:00
Pouria Mousavizadeh Tehrani
9262863cae
tzsetwall() is deprecated, use tzset() instead.
...
/usr/ports/net/iodine/work/iodine-0.8.0/src/iodined.c:2757: warning: warning: tzsetwall() is deprecated, use tzset() instead.
2023-04-19 00:21:08 +03:30
Erik Ekman
3cb6a1eec2
user: Expand newip char array
...
Avoid warning
../src/user.c:66:17: note: ‘snprintf’ output between 8 and 18 bytes into a destination of size 16
2022-07-18 23:35:54 +02:00
Erik Ekman
17169e3444
tun: Add openvpn componentid prefix
...
Some drivers use root prefix. See https://patchwork.openvpn.net/patch/555/
Hopefully helping with bugs #46 and #73 .
2022-07-18 23:31:13 +02:00
Erik Ekman
3818a59541
util: Remove duplicate assignments of rv to NULL
2021-08-25 22:05:19 +02:00
Erik Ekman
95fde8b3ee
Handle wildcard prefix of allowed tunnel domain names
2021-08-25 01:24:58 +02:00
Erik Ekman
f1e7823a3d
Add helper for matching topdomain and getting data length
2021-08-25 01:13:48 +02:00
Erik Ekman
589027568b
Add option to allow wildcard as start of topdomain
2021-08-24 23:32:57 +02:00
Erik Ekman
f5a82afe29
Initialize get_resolvconf_addr variable rv to NULL
...
Getting warning compiling for Android:
./util.c:35:6: warning: variable 'rv' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (sscanf(buf, "%15s", addr) == 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./util.c:79:9: note: uninitialized use occurs here
return rv;
^~
2021-08-16 15:06:02 +02:00
Erik Ekman
569a86a140
Fix Android cross-compile
...
./common.h:136:29: error: unknown type name 'va_list'
void vwarn(const char *fmt, va_list list);
^
2021-08-16 14:45:02 +02:00
Erik Ekman
cb6cbecba1
Make it clearer that iodine is asking for a password
...
To not confuse it with sudo or similar
2021-08-16 10:34:41 +02:00
Erik Ekman
ee623a2d84
Rework handling of IPv6 address failures
...
Skip IPv6 on any error getting the default address (::) if IPv6 is not
explicitly chosen.
2021-08-11 09:23:03 +02:00
Erik Ekman
43a82ef6be
Print getaddrinfo failure properly
2021-08-09 13:42:49 +02:00
Erik Ekman
559dafb030
Attempt skipping IPv6 if not supported
2021-08-09 12:14:42 +02:00
Erik Ekman
f2b619faad
Allow looking up external address and listen to it
2021-06-04 19:06:03 +02:00
Erik Ekman
a6d82b1a44
Allow listen adresses to be non-numeric (using domains)
2021-06-04 18:57:34 +02:00
Erik Ekman
8041e0368c
Print address when failing to bind
2021-06-04 18:38:50 +02:00
Erik Ekman
d02f1b4f41
tun: Fix warning
...
tun.c:389:19: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (addr.sc_unit < 0) {
~~~~~~~~~~~~ ^ ~
2021-05-14 13:38:51 +02:00
Erik Ekman
02173b8352
Fix iteration of utun devices on macos
...
Pass the constructed name instead of NULL to open_utun
Also add some error handling to utun_unit.
2021-05-13 20:13:00 +02:00
Erik Ekman
dc307b7183
Add prototypes for vwarn/vwarnx
...
Fixes this warning:
common.c:406:1: warning: no previous prototype for 'vwarn' [-Wmissing-prototypes]
406 | vwarn(const char *fmt, va_list list)
| ^~~~~
common.c:429:1: warning: no previous prototype for 'vwarnx' [-Wmissing-prototypes]
429 | vwarnx(const char *fmt, va_list list)
| ^~~~~~
Also move err() to have non-x versions first.
2021-01-31 14:08:27 +01:00
Erik Ekman
6a7763c210
More compact no-op of Windows syslog
2021-01-31 14:01:13 +01:00
Erik Ekman
cc51ee6f02
Formatting: Indent multi-line prints less
2021-01-31 13:54:09 +01:00
Erik Ekman
4b3d6e2962
Formatting: Use tabs for indents
2021-01-31 13:46:12 +01:00
Erik Ekman
a9045705ba
tun: Automatically attempt to use utun on mac
...
Once /dev/tunX has been tried without success
2021-01-21 17:40:22 +01:00
Erik Ekman
39356163d9
Formatting: Fix mixed use of tabs and spaces
2020-08-01 17:29:49 +02:00
Erik Ekman
9a041683be
Formatting: Fix lines starting with spaces
2020-08-01 17:19:37 +02:00
Erik Ekman
8d2c86c73d
Fix strncat size argument in send_handshake_query
...
Found by clang:
client.c:1276:26: warning: the value of the size argument in 'strncat' is too large, might lead to a buffer overflow [-Wstrncat-size]
strncat(buf, topdomain, sizeof(buf) - strlen(buf));
^~~~~~~~~~~~~~~~~~~~~~~~~
2020-07-25 15:45:24 +02:00
Erik Ekman
b7b1082dc6
client: Stop passing static variable userid to local functions
2020-07-24 21:17:18 +02:00
Erik Ekman
c399f915b7
Improve logging around getting server address
2020-07-24 21:01:38 +02:00
Erik Ekman
bbb604db06
Use send_handshake_query inside send_lazy_switch
2020-07-24 20:49:39 +02:00
Erik Ekman
ba90706429
Replace send_downenc_switch with send_handshake_query
2020-07-24 20:38:45 +02:00
Erik Ekman
9cba3299c4
Replace send_ip_request with send_handshake_query
2020-07-24 20:36:51 +02:00
Erik Ekman
5de13805d8
Replace send_codec_switch with send_handshake_query
2020-07-24 20:36:41 +02:00
Erik Ekman
d74939d323
Add send_handshake_query helper function
...
Convert send_downenctest to use it.
Remove unused data/len args from send_downenctest.
2020-07-24 20:18:07 +02:00
Erik Ekman
a8a20f570e
Formatting: spaces around operators
2020-07-24 19:15:02 +02:00
Erik Ekman
aeacfbc2c0
Formatting: No spaces after '(' or before ')'
2020-07-24 19:02:41 +02:00
Erik Ekman
15f12d0693
Formatting: Space between 'for' and parenthesis
2020-07-24 18:57:57 +02:00
Erik Ekman
19d0d1be64
Formatting: Space between 'if' and parenthesis
2020-07-24 18:56:30 +02:00
Erik Ekman
310aedac8e
Formatting: no space before parenthesis in function call.
2020-07-24 18:51:05 +02:00
Erik Ekman
cde0b7632d
Set additional record count properly in NS reply
...
For when there is no IPv4 address to return.
2020-07-23 22:12:07 +02:00
Erik Ekman
ec6a1ac308
Fix IPv4 address in replies to A or NS queries (github issue #38 )
...
The destination field in struct query was changed from in_addr_t to
struct sockaddr_storage, wihtout updating the functions sending it
in src/dns.c.
Only add extra A answer for NS queries if destination refers to an
IPv4 address, and fail if trying to encode a reply to an A query
if destination is not IPv4.
This means NS requests received over IPv6 will not contain an address
and A requests will be ignored, unless the -n option is used, or the
www subdomain is requested which sets a fixed address (127.0.0.1).
2020-07-23 21:49:46 +02:00
Erik Ekman
d8f3ac8971
Add helper function tun_uses_header()
...
Remove code duplication and hide some ifdefs
2020-07-03 17:06:14 +02:00
Erik Ekman
07b2978326
Only check for utun if tun_device was given
...
Fixes github issue #37 hopefully.
2020-07-03 16:53:30 +02:00
Erik Ekman
2032b44949
Look up external IP via DNS instead of HTTP
...
Use myip.opendns.com via their resolver.
The code is now TCP free again :)
2020-05-24 16:06:41 +02:00