Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 22 Nov 2017, 10:52
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Network
netmon_wce - network tray monitor
Post new topic   Reply to topic View previous topic :: View next topic
Page 5 of 6 [77 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Author Message
peebee


Joined: 21 Sep 2008
Posts: 3011
Location: Worcestershire, UK

PostPosted: Sun 04 Oct 2015, 05:48    Post subject:  

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 ::
Quote:
# 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

_________________
LxPup = Puppy + LXDE
Back to top
View user's profile Send private message Visit poster's website 
ASRI éducation


Joined: 09 May 2009
Posts: 3203
Location: France

PostPosted: Sun 04 Oct 2015, 06:13    Post subject:  

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

Thank you.

_________________
Projet ASRI éducation => Association | Forum | Dépôt | Espace kids
Back to top
View user's profile Send private message Visit poster's website 
Iguleder


Joined: 11 Aug 2009
Posts: 2031
Location: Israel, somewhere in the beautiful desert

PostPosted: Sun 04 Oct 2015, 06:23    Post subject:  

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 Laughing).
_________________
My homepage
My GitHub profile
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 8659
Location: qld

PostPosted: Sun 04 Oct 2015, 17:35    Post subject:  

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 Laughing).

yes I will.

Thanks fro fr trans @ASRI éducation

_________________
Puppy Linux Blog - contact me for access
Back to top
View user's profile Send private message Visit poster's website 
peebee


Joined: 21 Sep 2008
Posts: 3011
Location: Worcestershire, UK

PostPosted: Thu 15 Oct 2015, 06:16    Post subject: Alternative icons  

Here are some alternative icons for netmon_wce.......
netmon_wce_lx_icons-1.pet
Description 
pet

 Download 
Filename  netmon_wce_lx_icons-1.pet 
Filesize  6.52 KB 
Downloaded  200 Time(s) 
lx_icons.png
 Description   
 Filesize   20.17 KB
 Viewed   724 Time(s)

lx_icons.png


_________________
LxPup = Puppy + LXDE
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 8659
Location: qld

PostPosted: Tue 05 Jan 2016, 22:18    Post subject: Added support for ppp(N) interface  

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:
make


Put the icons in /usr/share/pixmaps/puppy/
Then kill you current netmon or network_tray and run it from that directory
Code:
./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.
icon(1).jpg
 Description   
 Filesize   4.6 KB
 Viewed   557 Time(s)

icon(1).jpg


_________________
Puppy Linux Blog - contact me for access

Last edited by 01micko on Wed 13 Jan 2016, 06:56; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website 
rufwoof

Joined: 24 Feb 2014
Posts: 2163

PostPosted: Tue 05 Jan 2016, 23:29    Post subject: Re: Added support for ppp(N) interface  

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.php?p=878962#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.php?p=855176#855176

Obviously not as lean as a proper SVG, but a easy alternative option.
Back to top
View user's profile Send private message 
peebee


Joined: 21 Sep 2008
Posts: 3011
Location: Worcestershire, UK

PostPosted: Wed 06 Jan 2016, 03:26    Post subject:  

I have these if you want them....
icons.png
 Description   
 Filesize   12.69 KB
 Viewed   525 Time(s)

icons.png


_________________
LxPup = Puppy + LXDE
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 8659
Location: qld

PostPosted: Sun 10 Jan 2016, 02:54    Post subject:  

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

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.
icons.jpg
 Description   
 Filesize   48.56 KB
 Viewed   479 Time(s)

icons.jpg

dark_net_icons-0.1.pet
Description  ORIGINAL darker colours
pet

 Download 
Filename  dark_net_icons-0.1.pet 
Filesize  2.47 KB 
Downloaded  156 Time(s) 
light_net_icons-0.1.pet
Description  lighter colours
pet

 Download 
Filename  light_net_icons-0.1.pet 
Filesize  2.48 KB 
Downloaded  157 Time(s) 

_________________
Puppy Linux Blog - contact me for access
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 8659
Location: qld

PostPosted: Sun 10 Jan 2016, 04:08    Post subject:  

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 Laughing).


Yeah.. the fact that it could very well overflow annoys me. I think I'll just exit the program when we get close. Rolling Eyes

Code:
        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
Back to top
View user's profile Send private message Visit poster's website 
rufwoof

Joined: 24 Feb 2014
Posts: 2163

PostPosted: Tue 12 Jan 2016, 16:30    Post subject:  

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.
ni.jpg
 Description   
 Filesize   2.08 KB
 Viewed   411 Time(s)

ni.jpg

Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 8659
Location: qld

PostPosted: Tue 12 Jan 2016, 22:45    Post subject:  

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 Cool

---------------------------------

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. Shocked Laughing

I wrote a simple prog to demonstrate;

Code:
#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:
# 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 .. Laughing

_________________
Puppy Linux Blog - contact me for access
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 8659
Location: qld

PostPosted: Wed 13 Jan 2016, 06:55    Post subject:  

netmon_wce-3.0 is now available.

See main post

_________________
Puppy Linux Blog - contact me for access
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 8659
Location: qld

PostPosted: Wed 20 Jan 2016, 18:11    Post subject:  

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
Back to top
View user's profile Send private message Visit poster's website 
mcewanw

Joined: 16 Aug 2007
Posts: 3194
Location: New Zealand

PostPosted: Tue 07 Jun 2016, 20:14    Post subject: iface_info not serving actual memory space etc
Subject description: but relying on local variable storage which is invalid
 

@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:
return info[i - 1]; //grab the first live one


doesn't actually work as it looks (as things stand, return info[i - 3] 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:
 //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:
//      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:
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/viewtopic.php?p=906792#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:
    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:
    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
netmon_wce.c.tar
Description  Just remove the dummy tar and use search mcewanw changes
tar

 Download 
Filename  netmon_wce.c.tar 
Filesize  20.15 KB 
Downloaded  106 Time(s) 

_________________
SomeOfMyWork with links:
dCoreDog
weX, scrox, Precord, Premote, fokSyfEyeR, xhippo-mod, flite_hts_pet
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 5 of 6 [77 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Network
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0684s ][ Queries: 12 (0.0066s) ][ GZIP on ]