tcpdump mailing list archives

Re: scan_sys_class_net bug in pcap-linux.c


From: Guy Harris <guy () alum mit edu>
Date: Sun, 2 Dec 2012 18:36:45 -0800


On Oct 31, 2012, at 1:59 PM, Paul Sheer <paulsheer () gmail com> wrote:

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, "..") ||

Yes.

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

No.

That wires in a particular name, and when the *next* weird file gets added by some future kernel revision, we won't 
handle it, and would end up wiring in another name, lather, rinse, repeat.

Instead, it should ignore "." and "..", ignore all *plain files* (rather than directories), and check whether there's a 
"subsystem" item underneath the item (just in case there are directories, or symlinks that point to directories, in 
there that *don't* correspond to devices, either now or in the future).

I've checked that change into the trunk and the 1.3 branch.

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


Current thread: