Skip to content

Commit ca89ebc

Browse files
committed
DAG: Remove the strrchr() call from pcap_create(). [skip ci]
The original intention was likely to skip the optional "/dev/" in "/dev/dag0" to support a larger subset of what dag_parse_name() implements. It does not work this way because the pointer strrchr() returns points to the last '/' and the test for the first three characters being "dag" in "/dag0" is always negative: $ tcpdump -ni /dev/dag0 tcpdump: This version of libpcap only supports DAG cards Remove the broken code for now to simplify the module refactoring. If there is a good reason to support DAG device aliases in addition to the nominal names in libpcap, it will not be difficult to add that.
1 parent 1a2a5a9 commit ca89ebc

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pcap-dag.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,7 @@ pcap_t *dag_create(const char *device, char *ebuf, int *is_ours)
902902
long stream = 0;
903903

904904
/* Does this look like a DAG device? */
905-
cp = strrchr(device, '/');
906-
if (cp == NULL)
907-
cp = device;
905+
cp = device;
908906
/* Does it begin with "dag"? */
909907
if (strncmp(cp, "dag", 3) != 0) {
910908
/* Nope, doesn't begin with "dag" */

0 commit comments

Comments
 (0)