blob: cc5afb61208ce11c28312f9e469f72cd0e926acc [file] [log] [blame]
diff --git a/system/core/libsysutils/src/NetlinkEvent.cpp b/system/core/libsysutils/src/NetlinkEvent.cpp
old mode 100644
new mode 100755
index 23dcd62..bf8ab76
--- a/system/core/libsysutils/src/NetlinkEvent.cpp
+++ b/system/core/libsysutils/src/NetlinkEvent.cpp
@@ -28,12 +28,12 @@
#include <arpa/inet.h>
#include <net/if.h>
-#include <linux/if.h>
+//#include <linux/if.h>
#include <linux/if_addr.h>
#include <linux/if_link.h>
#include <linux/netfilter/nfnetlink.h>
#include <linux/netfilter/nfnetlink_log.h>
-#include <linux/netfilter_ipv4/ipt_ULOG.h>
+//#include <linux/netfilter_ipv4/ipt_ULOG.h>
/* From kernel's net/netfilter/xt_quota2.c */
const int LOCAL_QLOG_NL_EVENT = 112;
@@ -47,6 +47,10 @@ const int LOCAL_NFLOG_PACKET = NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET;
#include <netlink/handlers.h>
#include <netlink/msg.h>
+
+#define IFF_LOWER_UP 0x10000
+#define ND_OPT_RDNSS 25
+
NetlinkEvent::NetlinkEvent() {
mAction = Action::kUnknown;
memset(mParams, 0, sizeof(mParams));
@@ -255,23 +259,26 @@ bool NetlinkEvent::parseIfAddrMessage(const struct nlmsghdr *nh) {
* Parse a QLOG_NL_EVENT message.
*/
bool NetlinkEvent::parseUlogPacketMessage(const struct nlmsghdr *nh) {
+ #if 0
const char *devname;
ulog_packet_msg_t *pm = (ulog_packet_msg_t *) NLMSG_DATA(nh);
- if (!checkRtNetlinkLength(nh, sizeof(*pm)))
- return false;
-
devname = pm->indev_name[0] ? pm->indev_name : pm->outdev_name;
asprintf(&mParams[0], "ALERT_NAME=%s", pm->prefix);
asprintf(&mParams[1], "INTERFACE=%s", devname);
mSubsystem = strdup("qlog");
mAction = Action::kChange;
- return true;
+ #endif
+ if (nh != NULL)
+ return true;
+ else
+ return false;
}
/*
* Parse a LOCAL_NFLOG_PACKET message.
*/
bool NetlinkEvent::parseNfPacketMessage(struct nlmsghdr *nh) {
+ #if 0
int uid = -1;
int len = 0;
char* raw = NULL;
@@ -284,7 +291,7 @@ bool NetlinkEvent::parseNfPacketMessage(struct nlmsghdr *nh) {
struct nlattr *payload = nlmsg_find_attr(nh, sizeof(struct genlmsghdr), NFULA_PAYLOAD);
if (payload) {
/* First 256 bytes is plenty */
- len = nla_len(payload);
+ len = 0;//nla_len(payload);
if (len > 256) len = 256;
raw = (char*) nla_data(payload);
}
@@ -300,7 +307,11 @@ bool NetlinkEvent::parseNfPacketMessage(struct nlmsghdr *nh) {
mParams[1] = hex;
mSubsystem = strdup("strict");
mAction = Action::kChange;
- return true;
+ #endif
+ if (nh)
+ return true;
+ else
+ return false;
}
/*
@@ -399,6 +410,8 @@ bool NetlinkEvent::parseRtMessage(const struct nlmsghdr *nh) {
* Parse a RTM_NEWNDUSEROPT message.
*/
bool NetlinkEvent::parseNdUserOptMessage(const struct nlmsghdr *nh) {
+
+ #if 0
struct nduseroptmsg *msg = (struct nduseroptmsg *) NLMSG_DATA(nh);
if (!checkRtNetlinkLength(nh, sizeof(*msg)))
return false;
@@ -458,9 +471,13 @@ bool NetlinkEvent::parseNdUserOptMessage(const struct nlmsghdr *nh) {
const int numaddrs = (optlen - 1) / 2;
// Find the lifetime.
+ #if 0
struct nd_opt_rdnss *rndss_opt = (struct nd_opt_rdnss *) opthdr;
const uint32_t lifetime = ntohl(rndss_opt->nd_opt_rdnss_lifetime);
-
+ #endif
+ struct nd_opt_rdnss *rndss_opt = NULL;
+
+ const uint32_t lifetime = 0;
// Construct "SERVERS=<comma-separated string of DNS addresses>".
static const char kServerTag[] = "SERVERS=";
static const size_t kTagLength = strlen(kServerTag);
@@ -476,7 +493,8 @@ bool NetlinkEvent::parseNdUserOptMessage(const struct nlmsghdr *nh) {
}
strcpy(buf, kServerTag);
size_t pos = kTagLength;
-
+
+ #if 0
struct in6_addr *addrs = (struct in6_addr *) (rndss_opt + 1);
for (int i = 0; i < numaddrs; i++) {
if (i > 0) {
@@ -486,7 +504,7 @@ bool NetlinkEvent::parseNdUserOptMessage(const struct nlmsghdr *nh) {
pos += strlen(buf + pos);
if (IN6_IS_ADDR_LINKLOCAL(addrs + i)) {
buf[pos++] = '%';
- pos += strlcpy(buf + pos, ifname, bufsize - pos);
+ //pos += strlcpy(buf + pos, ifname, bufsize - pos);
}
}
buf[pos] = '\0';
@@ -496,12 +514,16 @@ bool NetlinkEvent::parseNdUserOptMessage(const struct nlmsghdr *nh) {
asprintf(&mParams[0], "INTERFACE=%s", ifname);
asprintf(&mParams[1], "LIFETIME=%u", lifetime);
mParams[2] = buf;
+ #endif
} else {
SLOGD("Unknown ND option type %d\n", opthdr->nd_opt_type);
return false;
}
-
- return true;
+ #endif
+ if (nh != NULL)
+ return true;
+ else
+ return false;
}
/*
diff --git a/system/core/libsysutils/src/NetlinkListener.cpp b/system/core/libsysutils/src/NetlinkListener.cpp
old mode 100644
new mode 100755
index 637aa1e..68bb596
--- a/system/core/libsysutils/src/NetlinkListener.cpp
+++ b/system/core/libsysutils/src/NetlinkListener.cpp
@@ -43,6 +43,7 @@ NetlinkListener::NetlinkListener(int socket, int format) :
bool NetlinkListener::onDataAvailable(SocketClient *cli)
{
+ #if 0
int socket = cli->getSocket();
ssize_t count;
uid_t uid = -1;
@@ -52,8 +53,8 @@ bool NetlinkListener::onDataAvailable(SocketClient *cli)
require_group = false;
}
- count = TEMP_FAILURE_RETRY(uevent_kernel_recv(socket,
- mBuffer, sizeof(mBuffer), require_group, &uid));
+ count = 0;/*(uevent_kernel_recv(socket,
+ mBuffer, sizeof(mBuffer), require_group, &uid));*/
if (count < 0) {
if (uid > 0)
LOG_EVENT_INT(65537, uid);
@@ -71,5 +72,9 @@ bool NetlinkListener::onDataAvailable(SocketClient *cli)
}
delete evt;
- return true;
+ #endif
+ if (cli)
+ return true;
+ else
+ return false;
}
diff --git a/system/core/libsysutils/src/ServiceManager.cpp b/system/core/libsysutils/src/ServiceManager.cpp
old mode 100644
new mode 100755
index 41ac1dd..28dddc0
--- a/system/core/libsysutils/src/ServiceManager.cpp
+++ b/system/core/libsysutils/src/ServiceManager.cpp
@@ -5,7 +5,7 @@
#define LOG_TAG "Service"
#include <cutils/log.h>
-#include <cutils/properties.h>
+//#include <cutils/properties.h>
ServiceManager::ServiceManager() {
}
@@ -28,7 +28,7 @@ ServiceManager::ServiceManager() {
* read its state due to the truncation of "init.svc.<name>" into a
* zero-terminated buffer of PROPERTY_KEY_MAX characters.
*/
-#define SERVICE_NAME_MAX (PROPERTY_KEY_MAX-10)
+#define SERVICE_NAME_MAX (32-10)
/* The maximum amount of time to wait for a service to start or stop,
* in micro-seconds (really an approximation) */
@@ -49,7 +49,7 @@ int ServiceManager::start(const char *name) {
}
SLOGD("Starting service '%s'", name);
- property_set("ctl.start", name);
+ //property_set("ctl.start", name);
int count = SLEEP_MAX_USEC;
while(count > 0) {
@@ -78,7 +78,7 @@ int ServiceManager::stop(const char *name) {
}
SLOGD("Stopping service '%s'", name);
- property_set("ctl.stop", name);
+ //property_set("ctl.stop", name);
int count = SLEEP_MAX_USEC;
while(count > 0) {
@@ -98,8 +98,8 @@ int ServiceManager::stop(const char *name) {
}
bool ServiceManager::isRunning(const char *name) {
- char propVal[PROPERTY_VALUE_MAX];
- char propName[PROPERTY_KEY_MAX];
+ char propVal[92];
+ char propName[92];
int ret;
ret = snprintf(propName, sizeof(propName), "init.svc.%s", name);
@@ -108,7 +108,7 @@ bool ServiceManager::isRunning(const char *name) {
return false;
}
- if (property_get(propName, propVal, NULL)) {
+ if (0) {
if (!strcmp(propVal, "running"))
return true;
}
diff --git a/system/core/libsysutils/src/SocketListener.cpp b/system/core/libsysutils/src/SocketListener.cpp
old mode 100644
new mode 100755
index 4d602a6..7b4658c
--- a/system/core/libsysutils/src/SocketListener.cpp
+++ b/system/core/libsysutils/src/SocketListener.cpp
@@ -21,6 +21,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/un.h>
+#include <fcntl.h>
#define LOG_TAG "SocketListener"
#include <cutils/log.h>