aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_netinfo.c
diff options
context:
space:
mode:
authorvolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2010-01-05 22:29:16 +0000
committervolker <volker@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2010-01-05 22:29:16 +0000
commit55e86007a4860af150cf3a8613e49294183c6b8e (patch)
tree955f08719382ba4ff56823e467b8d5f72594a237 /plugin_netinfo.c
parentda4098a3eb744d224600627237ae251fd71a9807 (diff)
downloadlcd4linux-55e86007a4860af150cf3a8613e49294183c6b8e.tar.gz
plugins work on MacOS X: proc_stat, cpuinfo
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1077 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_netinfo.c')
-rw-r--r--plugin_netinfo.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugin_netinfo.c b/plugin_netinfo.c
index c2af6fd..57c79b2 100644
--- a/plugin_netinfo.c
+++ b/plugin_netinfo.c
@@ -143,8 +143,10 @@ static void my_hwaddr(RESULT * result, RESULT * arg1)
}
strncpy(ifreq.ifr_name, R2S(arg1), sizeof(ifreq.ifr_name));
- if (ioctl(socknr, SIOCGIFHWADDR, &ifreq) < 0) {
- errcount++;
+ // if (ioctl(socknr, SIOCGIFHWADDR, &ifreq) < 0) {
+ // if (ioctl(socknr, SIOCGIFMAC, &ifreq) < 0) {
+ if (ioctl(socknr, SIOCGLIFPHYADDR, &ifreq) < 0) {
+ errcount++;
if (1 == errcount % 1000) {
error("%s: ioctl(IFHWADDR %s) failed: %s", "plugin_netinfo", ifreq.ifr_name, strerror(errno));
error(" (skip next 1000 errors)");
@@ -152,7 +154,8 @@ static void my_hwaddr(RESULT * result, RESULT * arg1)
SetResult(&result, R_STRING, "");
return;
}
- hw = (unsigned char *) ifreq.ifr_hwaddr.sa_data;
+ // hw = (unsigned char *) ifreq.ifr_hwaddr.sa_data;
+ hw = (unsigned char *) ifreq.ifr_data;
qprintf(value, sizeof(value), "%02x:%02x:%02x:%02x:%02x:%02x",
*hw, *(hw + 1), *(hw + 2), *(hw + 3), *(hw + 4), *(hw + 5));
@@ -215,7 +218,8 @@ static void my_netmask(RESULT * result, RESULT * arg1)
SetResult(&result, R_STRING, "");
return;
}
- sin = (struct sockaddr_in *) &ifreq.ifr_netmask;
+ // sin = (struct sockaddr_in *) &ifreq.ifr_netmask;
+ sin = (struct sockaddr_in *) &ifreq.ifr_data;
qprintf(value, sizeof(value), "%s", inet_ntoa(sin->sin_addr));
SetResult(&result, R_STRING, value);