![]() |
Problems to bring up a TUN interface
ifconfig tun0 10.0.0.1 255.255.255.0 up
gives error saying SIOIFADDR tun0 no such device I have installed the latest RPM. Peter |
I have installed an new RPM.. i still face the same problem
[root@localhost root]# modprobe tun [root@localhost root]# lsmod | grep tun tun 5696 0 (unused) [root@localhost root]# ifconfig tun0 10.0.0.1 netmask 255.255.255.0 up SIOCSIFADDR: No such device tun0: unknown interface: No such device SIOCSIFNETMASK: No such device tun0: unknown interface: No such device [root@localhost root]# uname -r 2.4.20-8 [root@localhost root]# |
I checked documentation in kernel source, copied an example code and added includes to compile (frankly, I also changed error handling to compile, but it is not so interesting). While the program runs (after it has issued ioctl), tun0 exists. So if you want a program to use tun, this program should call tun_alloc before configuring tun0 interface. This way it will already have its pipe end to get data and tun0 created.
Code:
#include <stdio.h> |
Am getting compiling errors as
[root@localhost peter]# gcc mytun.c -o tun In file included from mytun.c:3: /usr/include/linux/if.h:86: field `ifru_addr' has incomplete type /usr/include/linux/if.h:87: field `ifru_dstaddr' has incomplete type /usr/include/linux/if.h:88: field `ifru_broadaddr' has incomplete type /usr/include/linux/if.h:89: field `ifru_netmask' has incomplete type /usr/include/linux/if.h:90: field `ifru_hwaddr' has incomplete type [root@localhost peter]# |
Am I right that just that:
Code:
#include <linux/if.h> Code:
rpm -qf /usr/include/linux/if.h |
Got it fixed
|
Facing Same Problem
Hi Peter I am facing same problem how did you fix it?
/usr/include/linux/if.h:165: error: field 'ifru_addr' has incomplete type /usr/include/linux/if.h:166: error: field 'ifru_dstaddr' has incomplete type /usr/include/linux/if.h:167: error: field 'ifru_broadaddr' has incomplete type /usr/include/linux/if.h:168: error: field 'ifru_netmask' has incomplete type /usr/include/linux/if.h:169: error: field 'ifru_hwaddr' has incomplete type Hello.c:48:2: warning: no newline at end of file thanks in advance. |
I fixed it by adding...
#include <sys/socket.h> before #include <linux/if_tun.h> #include <linux/if.h> |
All times are GMT -5. The time now is 10:19 AM. |