LCDproc development and user support list

Text archives Help


[Lcdproc] [PATCH] make lcdproc parse Linux interface names properly


Chronological Thread 
  • From: aeriksson2 at gmail.com (Anders Eriksson)
  • Subject: [Lcdproc] [PATCH] make lcdproc parse Linux interface names properly
  • Date: Sat, 27 Apr 2013 19:33:26 +0200

Hi all,

Linux interface names like eth0 and eth0.1, i.e. where one name is a
substring of the other.
Current code in lcdproc iface fails to pick up the right interface name
under these circumstances. This patch fixes that by checking for ':' at the
end of the interface name in /proc/net/dev.

diff -Naur lcdproc-0.5.2/clients/lcdproc/machine_Linux.c
lcdproc-0.5.2_new/clients/lcdproc/machine_Linux.c
--- lcdproc-0.5.2/clients/lcdproc/machine_Linux.c 2007-04-14
16:38:15.000000000 +0200
+++ lcdproc-0.5.2_new/clients/lcdproc/machine_Linux.c 2013-04-27
19:22:02.000000000 +0200
@@ -534,7 +534,8 @@

/* Search iface_name and scan values */
while ((fgets(buffer, sizeof(buffer), file) != NULL)) {
- if (strstr(buffer, interface->name)) {
+ char *s;
+ if ((s=strstr(buffer, interface->name)) &&
s[strlen(interface->name)]==':') {
/* interface exists */
interface->status = up; /* is up */
interface->last_online = time(NULL); /*
save actual time */
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.omnipotent.net/pipermail/lcdproc/attachments/20130427/f0653837/attachment.html>



  • [Lcdproc] [PATCH] make lcdproc parse Linux interface names properly, Anders Eriksson, 04/27/2013

Archive powered by MHonArc 2.6.18.

Top of page