On Thu, Sep 30, 2010 at 08:25:39PM +0200, Jonathan Armani wrote: > On Thu, 30 Sep 2010 16:42:39 +0200 > Laurent Ghigonis <laur...@gouloum.fr> wrote: > > > Hello :) > > Hi, > > Yes you need to create a lot of bpf to get a fully functionnal scapy. > Attached is a diff that make bpf device clonable if you want to give > it a try (Apply it on a -current src). >
Bad advise since clonable bpf has a maximum of IIRC 64 devices since it uses a int64_t as bitfield. The correct fix would probably be to fix the pcapdnet code to close bpf interfaces after use or make scapy close/cache them. > N'hesite pas à repondre en français / si tu as des questions. > > > > > When I send packets with scapy from packages or lastest mercurial, on > > OpenBSD > > -current, I quickly end up with all my /dev/bpf devices used. > > I tried to find the problem in the scapy source without success. Also > > searched for the problem in scapy ml, but it seems that scapy v2 works > > for everybody ... > > > > Here, scapy seems to use one bpf per paket sent : > > > > mia# /usr/local/bin/scapy > > INFO: Can't import python gnuplot wrapper . Won't be able to plot. > > INFO: Can't import PyX. Won't be able to use psdump() or pdfdump(). > > Welcome to Scapy (2.0.1) > > >>> sendp(Ether(dst="00:08:a1:88:26:19")/IP(dst="192.168.3.254")/ICMP(),iface="em0") > > . > > Sent 1 packets. > > >>> sendp(Ether(dst="00:08:a1:88:26:19")/IP(dst="192.168.3.254")/ICMP(),iface="em0") > > . > > Sent 1 packets. > > >>> sendp(Ether(dst="00:08:a1:88:26:19")/IP(dst="192.168.3.254")/ICMP(),iface="em0") > > . > > Sent 1 packets. > > >>> > > > > mia$ fstat |grep bpf > > root python2.6 13450 7 / 26794 crw------- rw bpf4 > > root python2.6 13450 8 / 26795 crw------- rw bpf5 > > root python2.6 13450 10 / 26796 crw------- rw bpf6 > > _tcpdump tcpdump 21353 3 / 26793 crw------- r bpf3 > > _dhcp dhclient 9089 8 / 26792 crw------- rw bpf2 > > _tcpdump tcpdump 13399 3 / 26791 crw------- r bpf1 > > _pflogd pflogd 24999 3 / 26790 crw------- rw bpf0 > > root pflogd 4077 3 / 26790 crw------- rw bpf0 > > > > After sending a few more packets, it has used all bpf devices, and i get > > > > >>> sendp(Ether(dst="00:08:a1:88:26:03")/IP(dst="192.168.3.254")/ICMP(),iface="em0") > > Traceback (most recent call last): > > File "<console>", line 1, in <module> > > File "/usr/local/lib/python2.6/site-packages/scapy/sendrecv.py", line 243, > > in sendp > > __gen_send(conf.L2socket(iface=iface, *args, **kargs), x, inter=inter, > > loop=loop, count=count, verbose=verbose) > > File "/usr/local/lib/python2.6/site-packages/scapy/arch/pcapdnet.py", line > > 293, in __init__ > > self.outs = dnet.eth(iface) > > File "dnet.pyx", line 112, in dnet.eth.__init__ > > OSError: No such file or directory > > > > and for all the following tries > > > > >>> sendp(Ether(dst="00:08:a1:88:26:03")/IP(dst="192.168.3.254")/ICMP(),iface="em0") > > Traceback (most recent call last): > > File "<console>", line 1, in <module> > > File "/usr/local/lib/python2.6/site-packages/scapy/sendrecv.py", line 243, > > in sendp > > __gen_send(conf.L2socket(iface=iface, *args, **kargs), x, inter=inter, > > loop=loop, count=count, verbose=verbose) > > File "/usr/local/lib/python2.6/site-packages/scapy/arch/pcapdnet.py", line > > 270, in __init__ > > self.ins = open_pcap(iface, 1600, 0, 100) > > File "/usr/local/lib/python2.6/site-packages/scapy/arch/pcapdnet.py", line > > 53, in <lambda> > > open_pcap = lambda *args,**kargs: _PcapWrapper_libpcap(*args,**kargs) > > File "/usr/local/lib/python2.6/site-packages/scapy/arch/pcapdnet.py", line > > 42, in __init__ > > self.pcap.open_live(*args, **kargs) > > File "/usr/local/lib/python2.6/site-packages/pcap.py", line 86, in open_live > > def open_live(*args): return _pcap.pcapObject_open_live(*args) > > Exception: /dev/bpf11: No such file or directory > > > > It tries bpf11 because i created bpf10 just to see. > > I specify the mac address manualy because if i don't i get > > "WARNING: Mac address to reach destination not found. Using broadcast." > > and it uses one more bpf device per paket sent. > > > > Huhu. Help appreciated :) > > laurent > > > > > > > -- > Jonathan Armani -- :wq Claudio