mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1061993 - Add lock to ifc_* functions. r=chucklee
This commit is contained in:
parent
ebdd8c16cf
commit
ee3010da62
@ -61,6 +61,11 @@ DEFINE_DLFUNC(ifc_remove_host_routes, int32_t, const char*)
|
||||
DEFINE_DLFUNC(ifc_remove_default_route, int32_t, const char*)
|
||||
DEFINE_DLFUNC(dhcp_stop, int32_t, const char*)
|
||||
|
||||
NetUtils::NetUtils()
|
||||
: mIfcMutex("NetUtils::mIfcMutex")
|
||||
{
|
||||
}
|
||||
|
||||
int32_t NetUtils::do_ifc_enable(const char *ifname)
|
||||
{
|
||||
USE_DLFUNC(ifc_enable)
|
||||
@ -81,6 +86,7 @@ int32_t NetUtils::do_ifc_configure(const char *ifname,
|
||||
in_addr_t dns2)
|
||||
{
|
||||
USE_DLFUNC(ifc_configure)
|
||||
mozilla::MutexAutoLock lock(mIfcMutex);
|
||||
int32_t ret = ifc_configure(ifname, address, prefixLength, gateway, dns1, dns2);
|
||||
return ret;
|
||||
}
|
||||
@ -89,6 +95,7 @@ int32_t NetUtils::do_ifc_reset_connections(const char *ifname,
|
||||
const int32_t resetMask)
|
||||
{
|
||||
USE_DLFUNC(ifc_reset_connections)
|
||||
mozilla::MutexAutoLock lock(mIfcMutex);
|
||||
return ifc_reset_connections(ifname, resetMask);
|
||||
}
|
||||
|
||||
@ -96,6 +103,7 @@ int32_t NetUtils::do_ifc_set_default_route(const char *ifname,
|
||||
in_addr_t gateway)
|
||||
{
|
||||
USE_DLFUNC(ifc_set_default_route)
|
||||
mozilla::MutexAutoLock lock(mIfcMutex);
|
||||
return ifc_set_default_route(ifname, gateway);
|
||||
}
|
||||
|
||||
@ -105,6 +113,7 @@ int32_t NetUtils::do_ifc_add_route(const char *ifname,
|
||||
const char *gateway)
|
||||
{
|
||||
USE_DLFUNC(ifc_add_route)
|
||||
mozilla::MutexAutoLock lock(mIfcMutex);
|
||||
return ifc_add_route(ifname, dst, prefixLength, gateway);
|
||||
}
|
||||
|
||||
@ -114,18 +123,21 @@ int32_t NetUtils::do_ifc_remove_route(const char *ifname,
|
||||
const char *gateway)
|
||||
{
|
||||
USE_DLFUNC(ifc_remove_route)
|
||||
mozilla::MutexAutoLock lock(mIfcMutex);
|
||||
return ifc_remove_route(ifname, dst, prefixLength, gateway);
|
||||
}
|
||||
|
||||
int32_t NetUtils::do_ifc_remove_host_routes(const char *ifname)
|
||||
{
|
||||
USE_DLFUNC(ifc_remove_host_routes)
|
||||
mozilla::MutexAutoLock lock(mIfcMutex);
|
||||
return ifc_remove_host_routes(ifname);
|
||||
}
|
||||
|
||||
int32_t NetUtils::do_ifc_remove_default_route(const char *ifname)
|
||||
{
|
||||
USE_DLFUNC(ifc_remove_default_route)
|
||||
mozilla::MutexAutoLock lock(mIfcMutex);
|
||||
return ifc_remove_default_route(ifname);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define NetUtils_h
|
||||
|
||||
#include "arpa/inet.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
||||
// Copied from ifc.h
|
||||
#define RESET_IPV4_ADDRESSES 0x01
|
||||
@ -24,6 +25,8 @@ class NetUtils
|
||||
public:
|
||||
static void* GetSharedLibrary();
|
||||
|
||||
NetUtils();
|
||||
|
||||
int32_t do_ifc_enable(const char *ifname);
|
||||
int32_t do_ifc_disable(const char *ifname);
|
||||
int32_t do_ifc_configure(const char *ifname,
|
||||
@ -56,6 +59,9 @@ public:
|
||||
char* vendorinfo);
|
||||
|
||||
static int32_t SdkVersion();
|
||||
|
||||
private:
|
||||
mozilla::Mutex mIfcMutex;
|
||||
};
|
||||
|
||||
// Defines a function type with the right arguments and return type.
|
||||
|
Loading…
Reference in New Issue
Block a user