summaryrefslogtreecommitdiffstats
path: root/gatchat
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-08-24 14:16:39 +0200
committerDenis Kenzior <denkenz@gmail.com>2012-08-30 17:06:09 -0500
commitef7a4bc3a76af66009cd8ba622627ca641bfc4b8 (patch)
tree6c5dc7ec9a04481f1bb320246f2189a45cd73c5a /gatchat
parent50d6f2c6077bbdb02e90bea208d49621cd86c6fa (diff)
downloadofono-ef7a4bc3a76af66009cd8ba622627ca641bfc4b8.tar.bz2
gatchat: Print error message if opening tun failes
This is a very common mistake. Let's help the users to configure their system correctly.
Diffstat (limited to 'gatchat')
-rw-r--r--gatchat/ppp_net.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
index 1609b99e..813ed9b5 100644
--- a/gatchat/ppp_net.c
+++ b/gatchat/ppp_net.c
@@ -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");