[WLUG] GCC compiling help - No TUN device

Jay Nugent jjn at nuge.com
Fri Jul 20 01:42:59 EDT 2018


Greetings fellow LUG folk,
    It has been 10 years since I have mucked around compiling C code, and 
as is usually the case, roadblocks and hurdles pop up that stretch my 
limits.

    I am trying to compile the latest version of JNOS (Packet Radio 
software) on a 64-bit machine running Debian Stretch 4.13.0-45-generic.

    I have tried to find what package contains the TUN device, and simply 
APT INSTALL it, but it has been no joy.  I am leary to just make a node 
(mknod) and I'm not entiry sure that is what is needed.  Searching Google 
has just added 100 more doubts into which is the correct way to go?

    Once JNOS is compiled, I will need to set up a Point-to-Point Tunnel 
between the Linux kernel and the JNOS application.  This is typically done 
with the commands:

(within JNOS)
    attach tun tun0 1500 0
    ifconfig tun0 ipaddress 192.168.2.1
    ifconfig tun0 mtu 1500

(then within Linux)
    ifconfig tun0 192.168.2.2 pointtopoint 192.168.2.1 mtu 1500 up


    But there is no TUN device on Linux so the ifconfig fails.  And I 
belive since the TUN device doesn't exist on the Linux box, that is why 
the compile of JNOS is failing.  At least the ERROR messages during the 
compile seem to indicate so...

    The compile goes along well until it needs to work with the TUN 
interface (tun.c).  Then it spews some errors, and exits without creating 
the executable:

....
....
gcc -DUNIX -g3   -DDEBUG -Wall   -c -o devparam.o devparam.c
gcc -DUNIX -g3   -DDEBUG -Wall   -c -o md5.o md5.c
gcc -DUNIX -g3   -DDEBUG -Wall   -c -o tun.o tun.c
In file included from netuser.h:38:0,
                  from tcp.h:26,
                  from iface.h:25,
                  from tun.c:26:
socket.h:85:21: error: expected identifier before numeric constant
  #define SOCK_STREAM 0
                      ^
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:33:0,
                  from /usr/include/linux/if.h:27,
                  from tun.c:41:
/usr/include/x86_64-linux-gnu/bits/socket.h:174:8: error: redefinition of 
‘struct sockaddr’
  struct sockaddr
         ^~~~~~~~
In file included from socket.h:22:0,
                  from netuser.h:38,
                  from tcp.h:26,
                  from iface.h:25,
                  from tun.c:26:
sockaddr.h:13:8: note: originally defined here
  struct sockaddr {
         ^~~~~~~~
<builtin>: recipe for target 'tun.o' failed
make: *** [tun.o] Error 1
root at SkyLake2:~/jnos-source#


    Any compile savy folk have any suggestions?  I think if I can determine 
how to install the package that contains the /dev/tun it *may* get me over 
this hurdle.


    Thanks!
       --- Jay


More information about the washlug mailing list