From 2923175afa8b253cffdea00c1087c29e877d7fea Mon Sep 17 00:00:00 2001 From: Arnaud Patard Date: Fri, 18 Mar 2011 21:21:26 +0000 Subject: - try to handle the built-in module case before trying to load a module. --- mdk-stage1/network.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'mdk-stage1/network.c') diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c index 85704b805..a1af8af0f 100644 --- a/mdk-stage1/network.c +++ b/mdk-stage1/network.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -568,8 +569,15 @@ static enum return_type bringup_networking(struct interface_info * intf) { static struct interface_info loopback; enum return_type results; - - my_insmod("af_packet", ANY_DRIVER_TYPE, NULL, 1); + int fd; + + /* try to find if module already loaded or built-in to avoid failing */ + /* badly */ + fd = open("/proc/net/packet", O_RDONLY); + if (fd < 0) + my_insmod("af_packet", ANY_DRIVER_TYPE, NULL, 1); + else + close(fd); do { results = configure_wireless(intf->device); -- cgit v1.2.1