Networking Forums

Networking Forums > Computer Networking > Linux Networking > bpf filter to prevent echo reply and request messages

Reply
Thread Tools Display Modes

bpf filter to prevent echo reply and request messages

 
 
jdamelia@gmail.com
Guest
Posts: n/a

 
      06-12-2006, 09:28 PM
I am struggling to come up with a bpf filter (or lsf I guess because I
am using Linux) that will allow me to receive only the 5 necessary
messages for ipv6 neighbor discovery on my raw socket. These would
include neighbor solicitations, neighbor advertisements, router
solicitations, router advertisements, and redirects. The socket I am
creating in my C++ code is:

sock=socket(PF_PACKET, SOCK_RAW,htons(ETH_P_IPV6));

I have used tcpdump to make a filter to limit packets on this socket to
only icmp6 messages. However, I need to limit it further so my
application cannot be bombarded with echo requests and replies.
Tcpdump does not have support for the necessary type of expression
(i.e. icmp6[x]), so I cannot utilize it to create the bpf and must
instead come up with it on my own. Being a novice at bpf, this is
proving difficult.

Can anyone help or at least point me in the right direction?

My current filter (limiting to all icmp6 traffic) is:

struct sock_filter bpf[] = {
{ 0x28, 0, 0, 0x0000000c },
{ 0x15, 0, 3, 0x000086dd },
{ 0x30, 0, 0, 0x00000014 },
{ 0x15, 0, 1, 0x0000003a },
{ 0x6, 0, 0, 0x00000060 },
{ 0x6, 0, 0, 0x00000000 }
};

Thanks in advance for the help.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Einbahnstraße: kein echo reply nach request Benjamin Casa Linux Networking 0 09-26-2008 07:56 AM
DNS request - reply from unexpected source mkdj Windows Networking 0 08-27-2007 01:24 PM
ask about whether RPC can guarantee the integrality of request/reply ZhHuan@gmail.com Linux Networking 0 09-07-2005 08:49 AM
unable to reply or forward messages kas Broadband Hardware 2 05-09-2005 01:02 AM
ARP Request packet??plz reply soon ANaiveProgrammer Linux Networking 5 11-25-2004 01:47 PM



1 2 3 4 5 6 7 8 9 10 11