diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-08-31 19:25:41 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-08-31 19:25:41 +0000 |
commit | 6904a4ec435fb8fc3faa22785ace288a18ed9d32 (patch) | |
tree | 01ae15b2df6cb27db6e3138b8615f954096ba076 /network/bridge.c | |
parent | a6da15f222255a207a33a67b32e16eb6cf9f61af (diff) |
network: check if bridge module is loaded
Diffstat (limited to 'network/bridge.c')
-rw-r--r-- | network/bridge.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/network/bridge.c b/network/bridge.c index a6930194..cf77d6ab 100644 --- a/network/bridge.c +++ b/network/bridge.c @@ -29,6 +29,8 @@ #include <unistd.h> #include <string.h> #include <sys/ioctl.h> +#include <sys/stat.h> +#include <sys/types.h> #include <net/if.h> #include <linux/sockios.h> @@ -39,6 +41,11 @@ static int bridge_socket = -1; int bridge_init(void) { + struct stat st; + + if (stat("/sys/module/bridge", &st) < 0) + return -EOPNOTSUPP; + bridge_socket = socket(AF_INET, SOCK_STREAM, 0); if (bridge_socket < 0) return -errno; |