jedisct1 / dsvpn

A Dead Simple VPN.
MIT License
5.17k stars 395 forks source link

doesn't compile on debian #43

Closed mimoo closed 5 years ago

mimoo commented 5 years ago

Thanks for this!

I might not have time to investigate, so just copy/pasting the error I'm getting:

cc -march=native -Ofast -Wall -W -Wshadow -Wmissing-prototypes  -Iinclude -o dsvpn src/vpn.c src/charm.c src/os.c
src/charm.c: In function ‘uc_randombytes_buf’:
src/charm.c:329:26: error: ‘SYS_getrandom’ undeclared (first use in this function)
     if ((size_t) syscall(SYS_getrandom, buf, (int) len, 0) != len) {
                          ^
src/charm.c:329:26: note: each undeclared identifier is reported only once for each function it appears in
Makefile:7: recipe for target 'dsvpn' failed
make: *** [dsvpn] Error 1
mimoo commented 5 years ago

Looks like debian jessie does not provide getrandom

jedisct1 commented 5 years ago

See https://github.com/jedisct1/dsvpn/issues/22

The software Debian Jessie comes with is very old.

mimoo commented 5 years ago

I realized that I really needed to update :D

On stretch I get -1 when calling syscall(SYS_getrandom, buf, (int) len, 0);. Mmmm

jedisct1 commented 5 years ago

What do you get in errno?

mimoo commented 5 years ago

is there a way to analyze errno without modifying the code? I had to modify it and include errno.h to do that:

Value of errno: 38
Error printed by perror: Function not implemented

(I'm on debian buster now)

EDIT:

getrandom() was introduced in version 3.17 of the Linux kernel. Support was added to glibc in version 2.25.

➜  dsvpn git:(master) ✗ uname -a       
Linux martinez 3.16.0-7-amd64 #1 SMP Debian 3.16.59-1 (2018-10-03) x86_64 GNU/Linux

damn it getrandom :P

made it work by updating my kernel! It's awesome :)

jedisct1 commented 5 years ago

is there a way to analyze errno without modifying the code?

You can use the strace command.