mirror of git://git.sysmocom.de/ofono
at/cdma/ifxmodem: Use /dev/net/tun to check for TUN support
Previously, these drivers would check /sys/devices/virtual/misc/tun to see if TUN is supported, and bail out otherwise. However, the tun module can sometimes be autoloaded by opening the /dev/net/tun file. In this case the /dev file already exists, but the /sys file only gets created after the modul is loaded. Additionally, the ppp code does not use the /sys file, but only the /dev file, so checking for the existence of the latter seems a better indicator of expected success.
This commit is contained in:
parent
fb17995721
commit
8d690efa83
|
@ -43,7 +43,7 @@
|
||||||
#include "atmodem.h"
|
#include "atmodem.h"
|
||||||
#include "vendor.h"
|
#include "vendor.h"
|
||||||
|
|
||||||
#define TUN_SYSFS_DIR "/sys/devices/virtual/misc/tun"
|
#define TUN_DEV "/dev/net/tun"
|
||||||
|
|
||||||
#define STATIC_IP_NETMASK "255.255.255.255"
|
#define STATIC_IP_NETMASK "255.255.255.255"
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ static int at_gprs_context_probe(struct ofono_gprs_context *gc,
|
||||||
|
|
||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
if (stat(TUN_SYSFS_DIR, &st) < 0) {
|
if (stat(TUN_DEV, &st) < 0) {
|
||||||
ofono_error("Missing support for TUN/TAP devices");
|
ofono_error("Missing support for TUN/TAP devices");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#include "cdmamodem.h"
|
#include "cdmamodem.h"
|
||||||
#include "drivers/atmodem/vendor.h"
|
#include "drivers/atmodem/vendor.h"
|
||||||
|
|
||||||
#define TUN_SYSFS_DIR "/sys/devices/virtual/misc/tun"
|
#define TUN_DEV "/dev/net/tun"
|
||||||
|
|
||||||
#define STATIC_IP_NETMASK "255.255.255.255"
|
#define STATIC_IP_NETMASK "255.255.255.255"
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ static int cdma_connman_probe(struct ofono_cdma_connman *cm,
|
||||||
|
|
||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
if (stat(TUN_SYSFS_DIR, &st) < 0) {
|
if (stat(TUN_DEV, &st) < 0) {
|
||||||
ofono_error("Missing support for TUN/TAP devices");
|
ofono_error("Missing support for TUN/TAP devices");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
#include "ifxmodem.h"
|
#include "ifxmodem.h"
|
||||||
|
|
||||||
#define TUN_SYSFS_DIR "/sys/devices/virtual/misc/tun"
|
#define TUN_DEV "/dev/net/tun"
|
||||||
|
|
||||||
#define STATIC_IP_NETMASK "255.255.255.255"
|
#define STATIC_IP_NETMASK "255.255.255.255"
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ static int ifx_gprs_context_probe(struct ofono_gprs_context *gc,
|
||||||
|
|
||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
if (stat(TUN_SYSFS_DIR, &st) < 0) {
|
if (stat(TUN_DEV, &st) < 0) {
|
||||||
ofono_error("Missing support for TUN/TAP devices");
|
ofono_error("Missing support for TUN/TAP devices");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue