Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Oct 2004 01:27:04 -0700 (PDT)
From:      kamal kc <rosey_kc@yahoo.com>
To:        freebsd-net@freebsd.org
Subject:   Bridge--using Packet Capture Library(libpcap.a) -- efficiency ?????
Message-ID:  <20041031082704.30632.qmail@web13009.mail.yahoo.com>

next in thread | raw e-mail | index | archive | help
I have made a bridge using the Packet Capture Library
I set the two nics to promiscous mode and transfer packet
between the two packet capture handles
A piece of the code I use for initializing the packet capture device descriptor---
.....
pcap_t *pd;
pd = (pcap_t *)malloc(sizeof(*pd));
 if (pd == NULL) {
  printf("memory allocation error");
 }
 if((pd=pcap_open_live(device,BUFFSIZE,1,0,errbuf))==NULL)
  {printf("pcap_open_live: %s",errbuf);
   exit(1);
  };
 v = 1;
 if (ioctl(pd->fd, BIOCIMMEDIATE, &v) < 0) {
  printf("can't set BIOCIMMEDIATE");
  exit(1);
  }
..................
Now the problem is efficiency !!!
The RTT for a ping packet to traverse across the bridge takes a fastest of about 3ms when
run as normal process
and about 2ms when run as daemon. But when setting
gateway_enable="YES"
in rc.conf the RTT is less than 1 ms. (i.e. FreeBSD Box acting as bridge)
I have FreeBSD 5.1 BOX.
I used Packet Capture Library(libpcap.a) because I could find of none libraries in capturing packets that
could return with the ethernet header. Further I could not find good usage maunal on BPF.
In the above code setting the TIMEOUT value to 0 also didn't improve the time taken to
capture and transmit the packets across the network.
Each packet is processed by a separate thread that is envoked by the main thread listening on
the packet capture handle.
++++++++++++++++
So finally
Could anyone suggest a way on improving the time delay and making the bridge process packets faster
with improved response time.
Solutions using Packet Capture Library would be great !!
Thanks in advance
Kamal
++++++++++++++++++++

		
---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041031082704.30632.qmail>