This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: raw socket at link layer
- To: Weilong Li <weilongli2000 at yahoo dot com>
- Subject: Re: [ECOS] raw socket at link layer
- From: Andrew Lunn <andrew dot lunn at ascom dot ch>
- Date: Wed, 18 Jul 2001 15:22:43 +0200
- Cc: ecos-discuss at sourceware dot cygnus dot com
- References: <20010718085140.28709.qmail@web14306.mail.yahoo.com>
On Wed, Jul 18, 2001 at 01:51:40AM -0700, Weilong Li wrote:
> I am trying to do sniff under ecos.
> However, in linux, it eithers give me choice to
> use SOCK_PACKET, or use PF_PACKET to make socket
> at link layer level,
>
> int fd=socket(PF_PACKET, SOCK_RAW, htons(ETH_P_IP));
> or
> int fd=socket(AF_INET, SOCK_PACKET, htons(ETH_P_IP));
>
> but under ecos's tcp/ip stack,
> it neither gives SOCK_PACKET, or PF_PACKET, or
> ETH_P_IP, so how to do the sniff?
In OpenBSD this is done using the BPF, the Berkley Packet Filter. The
eCos port of the OpenBSD stack does not include the BPF code. So you
first need to add in the BPF code into the eCos stack. Goto
www.openbsd.org for the code you need to intergrate.
Andrew