The output of ifconfig changed in recent versions, breaking
parsing the available interfaces. Use that as a good excuse
for switching from ifconfig to ip.
The 's/@.*//' is required to strip the '@ethX0' from the interface
names 'vlan42@eth0', since in /sys/class/net/ only vlan42 exists
as such and not vlan42@eth0.