Linuxカーネルでstruct net_deviceの一覧を取得する

struct net init_netがグローバル変数で宣言されているので、これを利用するらしい。

#include <linux/netdevice.h>

struct net_device *dev;

dev = first_net_device(&init_net);
while (dev) {
    printk(KERN_INFO "found [%s]\n", dev->name);
    dev = next_net_device(dev);
}

Getting list of network devices inside the Linux kernel - Stack Overflow
http://stackoverflow.com/questions/4494307/getting-list-of-network-devices-inside-the-linux-kernel