Page 4 of 4

Posted: Sun 04 Oct 2015, 09:48
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

Posted: Sun 04 Oct 2015, 10:13
by ASRI éducation
01micko wrote:The new 2.7 pets and source are posted.
Thank you.

Posted: Sun 04 Oct 2015, 10:23
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:).

Posted: Sun 04 Oct 2015, 21:35
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

Alternative icons

Posted: Thu 15 Oct 2015, 10:16
by peebee
Here are some alternative icons for netmon_wce.......

Added support for ppp(N) interface

Posted: Wed 06 Jan 2016, 02:18
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.

Re: Added support for ppp(N) interface

Posted: Wed 06 Jan 2016, 03:29
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.

Posted: Wed 06 Jan 2016, 07:26
by peebee
I have these if you want them....

Posted: Sun 10 Jan 2016, 06:54
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.

Posted: Sun 10 Jan 2016, 08:08
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.

Posted: Tue 12 Jan 2016, 20:30
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.

Posted: Wed 13 Jan 2016, 02:45
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:

Posted: Wed 13 Jan 2016, 10:55
by 01micko
netmon_wce-3.0 is now available.

See main post

Posted: Wed 20 Jan 2016, 22:11
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.

iface_info not serving actual memory space etc

Posted: Wed 08 Jun 2016, 00:14
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

Posted: Sun 02 Oct 2016, 23:26
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!

Network monthly data read from ?

Posted: Sun 28 May 2017, 03:50
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.

wifi signal strength tool-tip under netmon_wce

Posted: Sat 19 Oct 2019, 00:49
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.