Bug 315636 - vlan monitoring does not work. netdev.c in function processNetDev_(void) uses fixed position 7 parsing address when vlan names are longer
Summary: vlan monitoring does not work. netdev.c in function processNetDev_(void) use...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: ksysguard
Classification: Unmaintained
Component: ksysguardd (show other bugs)
Version: 4.8
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-22 16:48 UTC by whitehat.cog
Modified: 2024-09-23 20:59 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description whitehat.cog 2013-02-22 16:48:08 UTC
I am monitoring vlan traffic with ksysguard on Ubuntu 12.04LTS.  As this is Canonical's long term release used in server environments and I haven't spotted any mentions of fixes for new releases, this bug seems relavant.  The problem I had is while primarily interfaces like eth0 and eth1 would show up and give me stats, something like vlan.101 would show up in the lists, but no stats would show up in the graph.  I traced the problem in the source (supplied by Ubuntu's package manager) to ksysguard/ksysguardd/Linux/netdev.c where the /proc/net/dev file is parsed.  The specific issue I found with the parsing code is it expects the delimiter between the device name and stats (a ':') to always be at position 7 in the line.  However when the device name is say eth0.101, that is 9 characters, not 7.  My solution is to make the location dynamically located as opposed to a static number as detailed in the following code snippet starting at line 173 of netdev.c:

 int delim_name_offset= 7;
  char* label_delim_pos;

  sprintf( format, "%%%d[^\n]\n", (int)sizeof( buf ) - 1 );
  sprintf( devFormat, "%%%ds", (int)sizeof( tag ) - 1 );

  /*Update the values for the wifi interfaces if there is a /proc/net/wireless file*/
  if (*netDevBufP != '\0') {
                /* skip 2 first lines */
                for (i = 0; i < 2; i++) {
                        sscanf(netDevBufP, format, buf);
                        buf[sizeof(buf) - 1] = '\0';
                        netDevBufP += strlen(buf) + 1; /* move netDevBufP to next line */
                }

                for (i = 0; sscanf(netDevBufP, format, buf) == 1; ++i) {
                        buf[sizeof(buf) - 1] = '\0';
                        netDevBufP += strlen(buf) + 1; /* move netDevBufP to next line */

                        if (sscanf(buf, devFormat, tag)) {
                                char* pos = strchr(tag, ':');
                                if (pos) {
                                        label_delim_pos= strchr(buf, ':'); /* Dynamically find delimiter positon */
                                        delim_name_offset= label_delim_pos - buf + 1; /* Find offset in the line being scanned in. */
                                        FORALL( DEFVARS );
                                        *pos = '\0';
                                        FORALL( SETZERO );
                                        sscanf(buf + delim_name_offset, "%llu %llu %llu %llu %llu %llu %llu %llu " /* Use dynamically found offset when scanning in the stats so it does not break on device names over 7 characters in length as the previous code did. */

Reproducible: Always

Steps to Reproduce:
1. Connect ksysguard front end to machine with vlans
2. Go into stat list of machine, select a vlan device, and select any stat, say data rate on Transmission.  Have it display in say a line graph
3. Send on vlan and watch nothing happen in the graph.
Actual Results:  
Graph line for vlan is flat no matter how much data is sent.  Graph for regular lan works as expected.

Expected Results:  
Graph for vlan and graph for regular lan device work the same.

This is run on Ubuntu 12.04LTS 64-bit.  Regular LAN traffic displays fine.  VLAN traffic does not.
Comment 1 Andrew Crouthamel 2018-11-10 03:12:26 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 2 Andrew Crouthamel 2018-11-20 04:07:10 UTC
Dear Bug Submitter,

This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? This bug will be moved back to REPORTED Status for manual review later, which may take a while. If you are able to, please lend us a hand.

Thank you for helping us make KDE software even better for everyone!
Comment 3 fire f. 2019-08-09 06:05:24 UTC
line 196 is still

sscanf(strchr(buf, ':') + 1, "%llu .....


https://github.com/KDE/ksysguard/blob/master/ksysguardd/Linux/netdev.c


while Gnome's NetworkManager can do VLAN fine, KDE's plasma-nm package is "untested" and indeed is not working with VLANs really neither BOND etc.
Comment 4 Christoph Cullmann 2024-09-23 20:59:53 UTC
ksysguard is no longer maintained, in Plasma 6 there is the Plasma system monitor for this task.

If your issue still happens with the Plasma 6 replacement, please re-open and we can move this bug to the new product, thanks!