Bug #9486
openifindex values used for softflowd are incorrect
0%
Description
With this patch, we now pass ifIndex values to softflowd for inclusion in the flow packets:
https://github.com/pfsense/FreeBSD-ports/pull/501/files#diff-451c93a8b870e13a749022e7ecf64cd6R52
However, the values used are arbitrary and do not line up with the values used by other services on the system such as snmpd:
ps ax | grep soft 91600 - Ss 0:00.64 /usr/local/sbin/softflowd -i 1:igb1 -n 127.0.0.1:8877 -v 5 -T full -t general=60 -p /var/run/softflowd.igb1.pid -c /var/r 91913 - Is 0:00.00 /usr/local/sbin/softflowd -i 2:igb1.2 -n 127.0.0.1:8877 -v 5 -T full -t general=60 -p /var/run/softflowd.igb1.2.pid -c /v 92156 - Is 0:00.00 /usr/local/sbin/softflowd -i 3:igb1.3 -n 127.0.0.1:8877 -v 5 -T full -t general=60 -p /var/run/softflowd.igb1.3.pid -c /v 92774 - Is 0:00.00 /usr/local/sbin/softflowd -i 4:ovpnc2 -n 127.0.0.1:8877 -v 5 -T full -t general=60 -p /var/run/softflowd.ovpnc2.pid -c /v 93644 - Ss 0:00.69 /usr/local/sbin/softflowd -i 5:igb0 -n 127.0.0.1:8877 -v 5 -T full -t general=60 -p /var/run/softflowd.igb0.pid -c /var/r 93969 - Is 0:00.00 /usr/local/sbin/softflowd -i 6:lo0 -n 127.0.0.1:8877 -v 5 -T full -t general=60 -p /var/run/softflowd.lo0.pid -c /var/run
$ snmpwalk -c public -v 2c 10.1.1.1 IF-MIB::ifDescr IF-MIB::ifDescr.1 = STRING: igb0 IF-MIB::ifDescr.2 = STRING: igb1 IF-MIB::ifDescr.3 = STRING: enc0 IF-MIB::ifDescr.4 = STRING: lo0 IF-MIB::ifDescr.5 = STRING: pflog0 IF-MIB::ifDescr.6 = STRING: pfsync0 IF-MIB::ifDescr.7 = STRING: igb1.2 IF-MIB::ifDescr.8 = STRING: igb1.3 IF-MIB::ifDescr.9 = STRING: ovpnc2
For example igb1.2 is set to ifIndex 2, but it should really be 7.
The proper ifIndex can be retrieved using:
https://www.freebsd.org/cgi/man.cgi?query=if_nametoindex&apropos=0&sektion=3&manpath=FreeBSD+11.0-RELEASE&arch=default&format=html
Updated by Jim Pingle over 5 years ago
- Project changed from pfSense to pfSense Packages
- Category set to softflowd
- Priority changed from Normal to Very Low
- Affected Version deleted (
2.4.4_2)
Not sure there is a viable way for the softflowd to do that. The linked function is a C function in FreeBSD, but the code generating the softflowd config is PHP. Writing a C program just for getting the index seems excessive.
I had hoped maybe the output of ifconfig -l
might be useful but it doesn't line up with the index values used by SNMP either.