Results 1 to 3 of 3

Thread: [Patch] Timeout for pcap_open_live()

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    13

    Post [Patch] Timeout for pcap_open_live()

    I have submitted a one line patch to add a timeout value to pcap_open_live() in packet.cpp.

    This ensures compatibility with FreeBSD kernels >4.2-RELEASE, and should improve performance under packet intensive circumstances for newer FreeBSD and Linux kernels.

    Systems that do not support timeouts will ignore this value.

    The disadvantage to a zero timeout is that packets are read from kernel to user space as they arrive. This is expensive.

    The patch sets the timeout to 100ms, and should be quite sufficient for ShowEQ purposes.
    Last edited by segv; 01-02-2002 at 03:25 AM.

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    247

    Timeout for pcap_open_live

    Segv,

    Please explain in detail how this affects compatibility with FreeBSD. From the crappy pcap docs, this value is described as a read timeout. I'm not sure I follow how setting a timeout of any length will affect kernel load or compatibility. If you are seeing problems with BSD and packets coming from the BPF to user-land, it is probably related to BIOCIMMEDIATE not being set. See SINS packet.cpp for an example of this.

    If you want to easy the load packet capture places on your system by showeq, I would recommend not setting the packet capture thread to realtime.

    fee

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    13
    Setting BIOCIMMEDIATE causes packets to be copied to userland as they are received. This is expensive.

    A feature was introduced after 4.2-RELEASE that creates a default buffer (32k if I remember correctly) for BPF packet capture. Packets will not be copied to userland until this buffer has been filled unless an explicit timeout has been set (or BIOCIMMEDIATE is set). This feature was implemented to help the kernel cope with packet capture on high traffic (>50MBps) networks. My understanding is that a similar feature has been implemented in more recent versions of the Linux kernel, although I have not kept up with the Linux kernel since the 2.0.x train. Older Linux kernels do not support a timeout, and hence tend to drop packets while capturing on high traffic networks.

    Setting a small timeout (100ms) makes more sense than setting BIOCIMMEDIATE if the data stream exceeds 10pps during gameplay, particularly since ShowEQ runs at a default of 10fps. For systems that support a timeout, this should equate to slightly better performance during packet intensive (>10pps) conditions.

    As I recall, there was some fairly detailed discussion of this issue on the tcpdump mailing list a while back. It might be worth a browse.

    -- segv
    Last edited by segv; 01-03-2002 at 03:50 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

You may post new threads
You may post replies
You may post attachments
You may edit your posts
HTML code is Off
vB code is On
Smilies are On
[IMG] code is On