netmon_wce - network tray monitor

Configuration wizards, scanners, remote desktop, etc.
Message
Author
User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#61 Post by peebee »

01micko wrote:The new 2.7 pets and source are posted.
Hi Mick

The netmon_wce compiled in LibrePup does not work in Slacko-5.9.3 as it expects libiw.so.30 ::
# netmon_wce
netmon_wce: error while loading shared libraries: libiw.so.30: cannot open shared object file: No such file or directory
# ls /usr/lib/libiw.so.*
/usr/lib/libiw.so.27 /usr/lib/libiw.so.28 /usr/lib/libiw.so.29
# ln -s /usr/lib/libiw.so.29 /usr/lib/libiw.so.30
# netmon_wce
^C
#
with a link it does work

Cheers
Peter
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

User avatar
ASRI éducation
Posts: 3197
Joined: Sat 09 May 2009, 12:10
Location: France
Contact:

#62 Post by ASRI éducation »

01micko wrote:The new 2.7 pets and source are posted.
Thank you.
Projet ASRI éducation => [url=http://asri-education.org/]Association[/url] | [url=http://forum.asri-education.org/]Forum[/url] | [url=http://dl01.asri-education.org/]Dépôt[/url] | [url=http://kids.asri-education.org/]Espace kids[/url]

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#63 Post by Iguleder »

01micko, you should change rxaccmonth, txacc, etc' to unsigned long long and print them with %llu. Their value cannot be negative and the use of unsigned means the maximum value is higher (i.e the overflow still happens, but later :lol:).
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#64 Post by 01micko »

Iguleder wrote:01micko, you should change rxaccmonth, txacc, etc' to unsigned long long and print them with %llu. Their value cannot be negative and the use of unsigned means the maximum value is higher (i.e the overflow still happens, but later :lol:).
yes I will.

Thanks fro fr trans @ASRI éducation
Puppy Linux Blog - contact me for access

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

Alternative icons

#65 Post by peebee »

Here are some alternative icons for netmon_wce.......
Attachments
netmon_wce_lx_icons-1.pet
(6.52 KiB) Downloaded 468 times
lx_icons.png
(20.17 KiB) Downloaded 930 times
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

Added support for ppp(N) interface

#66 Post by 01micko »

Attached is netmon_wce-3.0beta (source code only for now) as it is rather experimental.

It has experimental support for new icons that use the ppp tool to connect to the internet, such as 3G modems, cell phones. (old modems should show the icon too, but IDK anyone who has one. Dilaup over POTS is slated to die in Australia next month). Any svg artists.. the icons could use some work!

To build it, make sure you have devx loaded, extract the archive, change into the netmon_wce-3.0beta directory and run in a terminal

Code: Select all

make
Put the icons in /usr/share/pixmaps/puppy/
Then kill you current netmon or network_tray and run it from that directory

Code: Select all

./netmon_wce
[edit - reuploaded attachment]

If you are happy with it put the netmon_wce binary into /usr/bin/ (overwriting the old version if you have it)

EDIT: beta source removed, see main post.
Attachments
icon(1).jpg
(4.6 KiB) Downloaded 762 times
Last edited by 01micko on Wed 13 Jan 2016, 10:56, edited 2 times in total.
Puppy Linux Blog - contact me for access

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

Re: Added support for ppp(N) interface

#67 Post by rufwoof »

01micko wrote:Any svg artists.. the icons could use some work!
I'm using a dark tray colour and didn't like the standard dark netmon tray icons that came with Tahr 6.0.5, so I created alternatives for myself that are more generic (ok with light or dark trays). http://murga-linux.com/puppy/viewtopic. ... 962#878962

I didn't have a clue about SVG but hunting around Geoffrey had kindly posted a tool to imbed a png inside a svg wrapper which is the method I used to create the svg's.
http://murga-linux.com/puppy/viewtopic. ... 176#855176

Obviously not as lean as a proper SVG, but a easy alternative option.
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#68 Post by peebee »

I have these if you want them....
Attachments
icons.png
(12.69 KiB) Downloaded 726 times
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#69 Post by 01micko »

peebee wrote:I have these if you want them....
Um .. I made those :P

Anyway, I improved the cell icons somewhat . Pets are available below in the dark (original) and light flavours. I didn't touch the wireless icons, they seem ok in dark and light themes.
Attachments
icons.jpg
(48.56 KiB) Downloaded 687 times
dark_net_icons-0.1.pet
ORIGINAL darker colours
(2.47 KiB) Downloaded 407 times
light_net_icons-0.1.pet
lighter colours
(2.48 KiB) Downloaded 421 times
Puppy Linux Blog - contact me for access

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#70 Post by 01micko »

Iguleder wrote:01micko, you should change rxaccmonth, txacc, etc' to unsigned long long and print them with %llu. Their value cannot be negative and the use of unsigned means the maximum value is higher (i.e the overflow still happens, but later :lol:).
Yeah.. the fact that it could very well overflow annoys me. I think I'll just exit the program when we get close. :roll:

Code: Select all

        if ((txacc > (ULLONG_MAX - 10)) || (rxacc > (ULLONG_MAX - 10))) {
			perror ("Exiting due to imminent overflow condition");
			exit (EXIT_FAILURE);
		}
But maybe I'll increase that buffer a bit.. 10 bytes isn't much and we could have already overflowed before the condition is met. Maybe 1024 bytes (1kB) is safer.
Puppy Linux Blog - contact me for access

User avatar
rufwoof
Posts: 3690
Joined: Mon 24 Feb 2014, 17:47

#71 Post by rufwoof »

01micko wrote:Anyway, I improved the cell icons somewhat . Pets are available below in the dark (original) and light flavours
Much nicer thanks 01micko. For darker tray theme colours such as dark blue at least you can now see that there is a icon there rather than just a dark region when no net activity.
Attachments
ni.jpg
(2.08 KiB) Downloaded 613 times
[size=75]( ͡° ͜ʖ ͡°) :wq[/size]
[url=http://murga-linux.com/puppy/viewtopic.php?p=1028256#1028256][size=75]Fatdog multi-session usb[/url][/size]
[size=75][url=https://hashbang.sh]echo url|sed -e 's/^/(c/' -e 's/$/ hashbang.sh)/'|sh[/url][/size]

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#72 Post by 01micko »

rufwoof wrote:
01micko wrote:Anyway, I improved the cell icons somewhat . Pets are available below in the dark (original) and light flavours
Much nicer thanks 01micko. For darker tray theme colours such as dark blue at least you can now see that there is a icon there rather than just a dark region when no net activity.
Good 8)

---------------------------------
I wrote:But maybe I'll increase that buffer a bit.. 10 bytes isn't much and we could have already overflowed before the condition is met. Maybe 1024 bytes (1kB) is safer.
Using unsigned long long (which on 64 bit system is the same as unsigned long - not on 32) we can accumulate up to 17179869183 GB in a month before we reach overflow. :shock: :lol:

I wrote a simple prog to demonstrate;

Code: Select all

#include <stdio.h>
#include <limits.h>

int main() {
	unsigned long long myB = ULLONG_MAX;
	unsigned long long mykB = myB / 1024;
	unsigned long long myMB =  mykB / 1024;
	unsigned long long myGB =  myMB / 1024;
	printf("%llu B\n", myB);
	printf("%llu KB\n", mykB);
	printf("%llu MB\n", myMB);
	printf("%llu GB\n", myGB);
	return 0;
}
and the output

Code: Select all

# cc -o longint longint.c           
# ./longint              
18446744073709551615 B
18014398509481983 KB
17592186044415 MB
17179869183 GB
18446744073709551615 is the value of ULLONG_MAX

Unless running a high throughput server, I don't think there would be too many cases of rx or tx exceeding 17179869183 GB in a month, but that said I suppose it could be possible. Then say someone has really fast internet @ 2Gb/s (that's 2 giga bits) it would be more than safe if I exited the program at (ULLONG_MAX - 1073741824) or 18446744072635809791 B .. :lol:
Puppy Linux Blog - contact me for access

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#73 Post by 01micko »

netmon_wce-3.0 is now available.

See main post
Puppy Linux Blog - contact me for access

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#74 Post by 01micko »

netmon_wce-3.0 is now available.

See main post


Adds IPv6 support. Not perfect but saves it crashing when ipv6 module is loaded.
Puppy Linux Blog - contact me for access

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

iface_info not serving actual memory space etc

#75 Post by mcewanw »

@01micko

Hi Mick,

Bug report (of sort):

Currently netmon_wce contains a struct iface_info which contains char pointers to interface name (iname) and IP address (ip_address). However, no actual storage for these items has been reserved (despite the program apparently working).

As it stands, the program finds the IP address, for example, via struct iface_info now (now.ip_address) but that actually points to char array host() in memory (but since no longer in the get_info() function when used, host() no longer really exists (since local to the function) - it is still finding it, but thats just by chance that system hasn't cleared that memory area IMO. Similarly, for example, now.iname will point to addrs->ifa_name, but since struct ifaddrs *addrs was also local to function get_info(), it no longer really remains valid in memory.

One other side effect of no reserved memory actually being allocated for iname and ip_address is that the info[] array doesn't actually hold the list of interfaces/ip_addresses as I presume was intended. Thus:

Code: Select all

return info[i - 1]; //grab the first live one
doesn't actually work as it looks (as things stand, return info for example will be found to contain exactly the same info iname and ip_addresses (which is the last one found). This causes a major side-effect:

If the active interface happens to have an IPv6 address assigned as well as an IPv4 address then the last entry found in the list is actually the IPv6 address, which then appears (undesired I expect) rather than the IPv4 address when hovering over the network tray icon with the mouse. XenialPup doesn't exhibit this effect so either the code was changed there compared to what you publish in post 1 or it only has an IPv4 address assigned. I tried netmon_wce on XenialDog with wireless connection - as on MintPup (and presumable Ubuntu and Linux Mint proper), the wifi interface has both an IPv4 and IPv6 address so latter is displayed even though actually using IPv4.

So, one way to 'fix' the needed memory storage (and thus also operation of info[] array) is to use this iface_info structure instead:

Code: Select all

 //type to hold interface and ip address
struct iface_info {
//	char *iname; // mcewanw
//	char *ip_address; // mcewanw
	char iname[IFACE_NAMELEN];          // mcewanw
	char ip_address[INET6_ADDRSTRLEN];  // mcewanw
};
Then, instead of simply copying pointers, copy the actual strings across into these char strings. From get_info() function:

Code: Select all

//		info[i].iname = tmp->ifa_name; // mcewanw
//		info[i].ip_address = host;  // mcewanw
		strcpy(info[i].iname,tmp->ifa_name); // mcewanw
		strcpy(info[i].ip_address, host); //mcewanw
Yes, that's a bit slower, but pointer needs to have a place to point to!

For use on systems (such as XenialDog and MintPup etc) which have IPv4 and IPv6 assigned to the active interface the problem still remains that the IPv6 address is being displayed. But because of the above alterations, I can now print the IPv4 address instead by using:

Code: Select all

return info[i - 3]; //grab the first live one
That works for XenialDog/MintPup, on my machine, because info[4] is returning the relevant IPv4 wifi info to now variable. Having said that, this is not a proper fix for that IPv4/IPv6 problem. Easier may be in fact just to use bash for IP address finding as Fred from XenialDog suggested here:

http://www.murga-linux.com/puppy/viewto ... 792#906792
fredx181 wrote: I am really not a C programmer, but looked at the network_tray source and this seems to be how it's done for it

Code: Select all

 	fp = (FILE *)popen("/sbin/ifconfig|grep -iE 'Bcast|P-t-P'|tr -s ' '|tr ' ' ':'|cut -d ':' -f4" , "r");
	fgets(ipa,sizeof ipa,fp);
	pclose(fp); 
Maybe to hackish but replacing in netmon_wce.c line 219:

Code: Select all

 	sprintf(ipa, "%s", now.ip_address);
with the above code from network_tray works well for me displaying the ip address
Anyway, since it works on Puppy at the moment I'm sure it isn't urgent, but for your interest I've attached my revised netmon_wce, which contains my comments and changes above (just search for mcewanw in the code).

Aside from the IPv6 issue I've had, I must say I like this program!

William
Attachments
netmon_wce.c.tar
Just remove the dummy tar and use search mcewanw changes
(20.15 KiB) Downloaded 375 times
github mcewanw

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#76 Post by 01micko »

Thank you William!

Apologies for the lateness of the reply but I had not been monitoring this thread.

I can see what I did is quite wrong, and potentially a severe bug, with assingning char * some_var; as opposed to char some_var[SOME_SIZE];. Of course in the first instance if memory is not allocated with malloc() then bad things can happen. Lesson noted. :)

Yes the ipv6 support did need some work and my 'solution' was only ever meant to be a stop-gap to prevent the app from crashing if ipv6.ko is loaded. Thanks for making sense out of that, and thanks to Fred too.

I'll make new packages and update the first post.

Cheers!
Puppy Linux Blog - contact me for access

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

Network monthly data read from ?

#77 Post by davids45 »

G'day 01micko et al,

I have a selection of Pups on one computer and just wondered if it is possible for the network tray monitor to read the progressive monthly ups and downs from a common location on the computer so, regardless of which Pup I start up, the tray monitor data will represent the computer's month's usage, not just each Pup's?

Screenshot shows different monthly data for a sequential booting of two Pups today. The monthly data are quite different as you'd expect for the present tray app.

I have in mind sym-linking the cumulative monthly values to+from a mounted-at-boot data partition as an option that could keep track of the computer's usage, regardless of the Pup.

Where are these monthly data stored in each Pup, by the way?

Thanks for any advice,

David S.
Attachments
activeinterfaces.jpg
same computer, same day, different Pups, different Month data
(81.04 KiB) Downloaded 275 times

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

wifi signal strength tool-tip under netmon_wce

#78 Post by mikeslr »

About half an eternity or so ago I inquired about something which would indicate the strength of the wifi signal being received, http://murga-linux.com/puppy/viewtopic. ... 116#721116. A number of solutions were provided which work well under 32-bit OSes*. But, it was then suggested that 01micko was working on a more comprehensive wifi application, netmon_wce.

AFAIK netmon_wce is now built into all Puppies.

As indicated by peebee's post, http://www.murga-linux.com/puppy/viewto ... 407#855407 --see the screenshot-- the mouse-over tool-tip of initial version(s) of netmon_wce did give notice of the wifi-signal strength. The versions appearing in Xenialpup64 and BionicPup64 do not.

Can wifi signal strength (quality) information be turned on so that the tool-tip will show it? and if so how? Or is that something which has to be provided at the Woof-level?

IMHO, having netmon_wce's tool tip provide a read-out of wifi-strength/quality would be superior to using a separate tool for that purpose.

-------
* The solutions which work under 32-bit OSes works under BionicPup64 and kind-of worked under Xenialpup64 (32-bit compatibility libs may be necessary in both). Under Xenialpup64 a location on the tray (task-bar) is created and mousing over it provides a reading. But the location does not have an icon. It was originally thought that the icons had inadvertently not been included in the application. But neither including those subsequently provided nor editing the desktop file to specify any produced an icon in the launcher; either initially, after restarting-X, restarting the 'panel' or after Saving and rebooting produced a launcher with an icon.

Post Reply