forwarding to list

-paul


---------- Forwarded message ----------
From: Paul Sheer <paulsh...@gmail.com>
Date: Tue, Oct 30, 2012 at 7:40 PM
Subject: scan_sys_class_net bug in pcap-linux.c
To: Bill Fenner <fen...@research.att.com>, Fulvio Risso <ri...@polito.it>,
Guy Harris <g...@alum.mit.edu>, Hannes Gredler <han...@juniper.net>, Michael
Richardson <m...@sandelman.ottawa.on.ca>



Hi there!

I notice you guys have in scan_sys_class_net() -

if (ent->d_type == DT_DIR) continue;

I believe this should be -

if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..") ||
!strcmp(ent->d_name, "bonding_masters")) continue;

Take for instance this system (all directories):

[root@machine1 /tmp]# ls -la /sys/class/net
total 0
drwxr-xr-x  6 root root 0 Oct 10 18:44 .
drwxr-xr-x 31 root root 0 Oct 25 16:11 ..
drwxr-xr-x  3 root root 0 Oct 10 18:44 eth0
drwxr-xr-x  3 root root 0 Oct 10 18:44 eth1
drwxr-xr-x  3 root root 0 Oct 10 18:44 lo
drwxr-xr-x  3 root root 0 Oct 30 18:32 sit0

compared to another system (all links):

[root@machine2 /tmp]# ls -la /sys/class/net
total 0
drwxr-xr-x  2 root root 0 Oct 30 17:34 .
drwxr-xr-x 42 root root 0 Oct 30 16:01 ..
lrwxrwxrwx  1 root root 0 Oct 30 17:34 eth0 ->
../../devices/pci0000:00/0000:00:11.0/0000:02:01.0/net/eth0
lrwxrwxrwx  1 root root 0 Oct 30 17:34 lo -> ../../devices/virtual/net/lo

BUT note also a  third system:

[root@machine3 /tmp]# ls -la /sys/class/net
total 0
drwxr-xr-x  2 root root    0 Oct 25 18:34 .
drwxr-xr-x 43 root root    0 Oct 25 18:35 ..
lrwxrwxrwx  1 root root    0 Oct 25 18:34 bond0 ->
../../devices/virtual/net/bond0
lrwxrwxrwx  1 root root    0 Oct 25 18:34 bond0.3 ->
../../devices/virtual/net/bond0.3
lrwxrwxrwx  1 root root    0 Oct 25 18:34 bond0.4 ->
../../devices/virtual/net/bond0.4
lrwxrwxrwx  1 root root    0 Oct 25 18:34 bond1 ->
../../devices/virtual/net/bond1
lrwxrwxrwx  1 root root    0 Oct 25 18:34 bond2 ->
../../devices/virtual/net/bond2
lrwxrwxrwx  1 root root    0 Oct 25 18:34 bond3 ->
../../devices/virtual/net/bond3
-rw-r--r--  1 root root 4096 Oct 25 19:32 *bonding_masters*
lrwxrwxrwx  1 root root    0 Oct 25 18:34 eth01 ->
../../devices/pci0000:00/0000:00:01.0/0000:02:00.0/net/eth01
lrwxrwxrwx  1 root root    0 Oct 25 18:34 eth02 ->
../../devices/pci0000:00/0000:00:01.0/0000:02:00.1/net/eth02
lrwxrwxrwx  1 root root    0 Oct 25 18:34 eth21 ->
../../devices/pci0000:00/0000:00:09.0/0000:09:00.0/net/eth21
lrwxrwxrwx  1 root root    0 Oct 25 18:34 eth21.9 ->
../../devices/virtual/net/eth21.9
lrwxrwxrwx  1 root root    0 Oct 25 18:34 eth22 ->
../../devices/pci0000:00/0000:00:09.0/0000:09:00.1/net/eth22
lrwxrwxrwx  1 root root    0 Oct 25 18:34 lo -> ../../devices/virtual/net/lo

See how you have to avoid "bonding_masters" in this list?

Hope this helps.

Best wishes.

-paul
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Reply via email to