Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8876927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:20:17+00:00 2026-06-14T19:20:17+00:00

When I create a packet filter (eg for only tcp traffic) with tcpdump -dd

  • 0

When I create a packet filter (eg for only tcp traffic) with

tcpdump -dd tcp

the packet filter output is

{ 0x28, 0, 0, 0x0000000c },
{ 0x15, 0, 2, 0x000086dd },
{ 0x30, 0, 0, 0x00000014 },
{ 0x15, 3, 4, 0x00000006 },
{ 0x15, 0, 3, 0x00000800 },
{ 0x30, 0, 0, 0x00000017 },
{ 0x15, 0, 1, 0x00000006 },
{ 0x6, 0, 0, 0x0000ffff },
{ 0x6, 0, 0, 0x00000000 },

But when I do the same programatically;

pcap_compile_nopcap(1500, DLT_EN10MB, &fcode, "tcp", 1, 0);
struct bpf_insn *insn = fcode.bf_insns;

for (i = 0; i < fcode.bf_len; ++insn, ++i)
{
  printf("{ 0x%x, %d, %d, 0x%08x },\n",
     insn->code, insn->jt, insn->jf, insn->k);
}

I get the following packet filter output:

{ 0x28, 0, 0, 0x0000000c },
{ 0x15, 0, 5, 0x000086dd },
{ 0x30, 0, 0, 0x00000014 },
{ 0x15, 6, 0, 0x00000006 },
{ 0x15, 0, 6, 0x0000002c },
{ 0x30, 0, 0, 0x00000036 },
{ 0x15, 3, 4, 0x00000006 },
{ 0x15, 0, 3, 0x00000800 },
{ 0x30, 0, 0, 0x00000017 },
{ 0x15, 0, 1, 0x00000006 },
{ 0x6, 0, 0, 0x000005dc },
{ 0x6, 0, 0, 0x00000000 },

Why are the two packet filters different?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:20:18+00:00Added an answer on June 14, 2026 at 7:20 pm

    Probably because the tcpdump on your system is built with an older version of libpcap than your program. The tcpdump on your system is probably using a libpcap without this change:

    commit 58275c05a5cf9c3512bcbb1192ff351d32ccccbd
    Author: Guy Harris <guy@alum.mit.edu>
    Date:   Thu Sep 1 22:21:45 2011 -0700
    
        Handle some amount of IPv6 fragmentation.
    
        If we're checking for a particular protocol running on top of IPv6, and
        we're not doing full protocol-chain chasing for all "running on top of
        IPv6" tests, at least check for a fragmentation header before the header
        for the protocol.
    

    and your program is probably using a libpcap with that change. That change went into libpcap somewhere in the libpcap 1.3.x timeframe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am using pcap to create a packet sniffer. i have this tcp structure:
I am using the Windows Filtering Platform. I want to create a traffic filter,
I'm using Spreadsheet::WriteExcel packet to create some Excel files. Everything works fine but when
I want to create a data packet and write it to socket. This packet
Hi I am trying to create a packet that I want to send over
I'm using scapy, and I want to create a packet and calculate its' checksum
i have application how open Tshark process and start capturing packet, this process create
I would like to create a packet and the data load is an array.
In order to implement tcp/ip simulation I have for each layer create packets. Since
CREATE OR REPLACE PACKAGE packet AS TYPE tip IS RECORD(a1 INT,a2 VARCHAR2(20)); FUNCTION getrow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.