gatchat: Print error message if opening tun failes

This is a very common mistake. Let's help the users to
configure their system correctly.
This commit is contained in:
Daniel Wagner 2012-08-24 14:16:39 +02:00 committed by Denis Kenzior
parent 50d6f2c607
commit ef7a4bc3a7
1 changed files with 5 additions and 1 deletions

View File

@ -155,8 +155,12 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp, int fd)
if (fd < 0) {
/* open a tun interface */
fd = open("/dev/net/tun", O_RDWR);
if (fd < 0)
if (fd < 0) {
ppp_debug(ppp, "Couldn't open tun device. "
"Do you run oFono as root and do you "
"have the TUN module loaded?");
goto error;
}
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
strcpy(ifr.ifr_name, "ppp%d");