[pso] for_each_netdev

Octavian Purdila tavi at cs.pub.ro
Sat Jun 27 02:54:10 EEST 2009


On Thursday 25 June 2009 01:34:04 Bogdan Tenea wrote:
> Am folosit deja for_each_netdev si a mers ok:
>
>     struct net_device *dev;
>     for_each_netdev(&init_net, dev){
>         printk(KERN_ALERT "Log level %s\n", dev->name);
>     }
>
> Jun 23 00:58:32 licenta kernel: [35478.759180] Log level lo
> Jun 23 00:58:32 licenta kernel: [35478.759635] Log level eth0
> Jun 23 00:58:32 licenta kernel: [35478.759638] Log level eth1
> Jun 23 00:58:32 licenta kernel: [35478.759640] Log level eth2
>
> Supararea era ca o sa trebuiasca sa transmit chestii gen "eth0", "lo" prin
> ioctluri si ca nu pot sa identific cumva interfetele din userspace
> printr-un index. 

Pai nu ai nevoie de nume, poti pasa ifindex-ul. Vezi pagina de manual pentru 
if_nametoindex, if_indextoname si net_device.

tavi


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the pso mailing list