Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail if interface specified is actually a file or directory #74

Closed
fklassen opened this issue Mar 10, 2014 · 1 comment
Closed

Fail if interface specified is actually a file or directory #74

fklassen opened this issue Mar 10, 2014 · 1 comment
Assignees
Milestone

Comments

@fklassen
Copy link
Member

As reported...

The problem, in a nutshell:

# tcpreplay -t -i p1p1 big.pcap

Fatal Error:
%s is not a valid Tcpreplay character device

Two issues.
(1) This seems to have intended to be routed through a printf function,
but doesn¹t seem to be (see missing args below).
(2) It doesn¹t work, whereas old tcpreplay 3.4.4 works fine.


This problem seems independent of the pcap file specified.
It has been reproduced on a different CentOS 6.5 system, but with 똪o¹,
and with a more recent kernel.

Yes, I am root (uid=0). No, SELinux is not running.


Any thoughts? Details follow ...

Thanks for any help you can offer.

kind regards,

Seth

. . . .

CentOS 6.3, 2.6.32-279.19.1.el6.x86_64 kernel.

tcpreplay version: 4.0.3 (build git:v4.0.3)
Copyright 2013-2014 by Fred Klassen <tcpreplay at appneta dot com> -
AppNeta Inc.
Copyright 2000-2012 by Aaron Turner <aturner at synfin dot net>
The entire Tcpreplay Suite is licensed under the GPLv3
Cache file supported: 04
Not compiled with libdnet.
Compiled against libpcap: 1.4.0
64 bit packet counters: enabled
Verbose printing via tcpdump: enabled
Packet editing: disabled
Fragroute engine: disabled
Injection method: PF_PACKET send()

driver: ixgbe
version: 3.12.6
firmware-version: 0x61bd0001
bus-info: 0000:01:00.0

# tcpreplay 땗istnics
Available network interfaces:
p1p1
p1p2
em1
em2
any

#0  0x000000370e6acea0 in _exit () from /lib64/libc.so.6
#1  0x000000370e635d52 in exit () from /lib64/libc.so.6
#2  0x000000000040ab7c in sendpacket_open (device=0x832a50 "p1p1",
    errbuf=0x7fffffffdcb0 "", direction=TCPR_DIR_C2S,
    sendpacket_type=<value optimized out>) at sendpacket.c:555
#3  0x0000000000407258 in tcpreplay_post_args (ctx=0x827010,
    argc=<value optimized out>) at tcpreplay_api.c:289
#4  0x00000000004054f5 in main (argc=1, argv=0x7fffffffe610) at
tcpreplay.c:73

#2  0x000000000040ab7c in sendpacket_open (device=0x832a50 "p1p1",
    errbuf=0x7fffffffdcb0 "", direction=TCPR_DIR_C2S,
    sendpacket_type=<value optimized out>) at sendpacket.c:555
555             err(1, "%s is not a valid Tcpreplay character device²);

(gdb) list
550         if (((sdata.st_mode & S_IFMT) == S_IFCHR)) {
551
552             sp = sendpacket_open_khial(device, errbuf);
553
554         } else {
555             err(1, "%s is not a valid Tcpreplay character device");
556         }
557     } else {
558 #ifdef HAVE_NETMAP
559         if (sendpacket_type == SP_TYPE_NETMAP)
(gdb) p /x sdata.st_mode
$2 = 0x41ed

Also ...

Based on this comment and running strace on tcpreplay and stat, I am 90%
sure that the problem is that some other user created a directory called
Œp1p1¹. It didn¹t occur to me to look for this until you said that.
You can probably reproduce my issue by doing a Œmkdir <ifacename>¹ and
then trying to invoke 'tcpreplay -i <ifacename>¹ from that directory.

When I run tcpreplay from /tmp, the problem goes away. So you could say I
have a workaround.
@fklassen fklassen added the bug label Mar 10, 2014
@fklassen fklassen self-assigned this Mar 21, 2014
@fklassen fklassen added this to the 4.0.4 milestone Mar 22, 2014
@fklassen fklassen added 4.0.x and removed 4.0.x labels Mar 22, 2014
@fklassen
Copy link
Member Author

Added following commit...
e590431

Unable to reproduce on my ixgbe Ubuntu machine. Notice the stack trace during --listnics with assertion on ebuf. Suspect stack overflow, so moved ebuf from stack to heap.

Will close for now and reopen if this bug is recreated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant