Skip to content

Added support to alias interfaces (e.g., ifname0:1)#317

Merged
shirou merged 1 commit intoshirou:masterfrom
pdcleyn:support-alias-interfaces
Feb 21, 2017
Merged

Added support to alias interfaces (e.g., ifname0:1)#317
shirou merged 1 commit intoshirou:masterfrom
pdcleyn:support-alias-interfaces

Conversation

@pdcleyn
Copy link

@pdcleyn pdcleyn commented Feb 21, 2017

In linux, alias interfaces can end up in /proc/net/dev as shown below:

[root@host ~]# cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo: 1638928809 4771634    0    0    0     0          0         0 1638928809 4771634    0    0    0     0       0          0
  eth0: 1000866899965 764654426    0    0    0     0          0         0 1267144066 5373060    0    0    0     0       0          0
tun999999:       0       0    0    0    0     0          0         0        0       0    0   15    0     0       0          0
tun10001:1:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
tun10001:2:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          

Current parsing will delimit field on a : only which results in :1 as the first element of a line with an alias interface. This will result in an error as :1 will not be parseable to an int later on.

This PR changes the delimiter to : (space added), correctly parsing alias interfaces as well.

@pdcleyn
Copy link
Author

pdcleyn commented Feb 21, 2017

This issue causes telegraf to fail. I create an issue on the telegraf project for this and referred to this PR.

@shirou
Copy link
Owner

shirou commented Feb 21, 2017

Thank you for reporting. I did not aware like tun10:1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants