Libnet
FreeBSD libnet_pblock_find() problem Mar 01 2005 02:30AM
Victor Lima (sena urbi com br) (2 replies)
Re: FreeBSD libnet_pblock_find() problem Mar 01 2005 08:53PM
Mike Schiffman (mike infonexus com) (1 replies)
Re: FreeBSD libnet_pblock_find() problem Mar 03 2005 07:21PM
Mustafa Abu Sedera (tifa_80 hotmail com)
Re: FreeBSD libnet_pblock_find() problem Mar 01 2005 07:16PM
Frédéric Raynal (frederic raynal security-labs org)
On Mon, Feb 28, 2005 at 11:30:12PM -0300, Victor Lima wrote:
> void
> echo_server ( const unsigned char *packet ) {
> ...
> libnet_t *lnet;
> ...
> udp = libnet_build_udp( ntohs( udp_hdr->uh_dport ),
> ntohs( udp_hdr->uh_sport ),
> LIBNET_UDP_H + strlen( payload ),
> 0,
> payload,
> strlen(payload),
> lnet,
> udp );
>
> if( udp == -1 ) {
> fprintf (stderr, "%s: libnet_build_udp() failed: %s\n",
> prefix, libnet_geterror(lnet));
> goto bad;
> }
> -----------------------
>
> Whenever I run it, it first blocks on libpcap listening for
> packets, after it recieves one it sends the packet to echo_server, where
> the appropriate headers are pointed to the correct places in the packet,
> so that I can build a response based on the received information. The
> code compiles with no problem except that when I run it, libnet_build_udp
> returns -1 and the following error message appears:
>
> ---
> libnet_pblock_find() - couldn't find protocol block
> ---
> Ive googled a bit, and found a few misleading answers none that
> solved my problem, so I came here. Hope you guys can help me...

Just a try ...

Your udp variable is not initialised. So I guess it is not 0. Hence,
libnet_build_udp() tries to find the pblock referred by this value,
but cant find it.

Try to set udp = 0; during the initialisation, and it should run
properly.

Fred Raynal

[ reply ]


 

Privacy Statement
Copyright 2010, SecurityFocus