LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 09-25-2012, 11:34 AM   #1
REmaxer
LQ Newbie
 
Registered: Sep 2012
Location: Rome
Distribution: Gentoo
Posts: 5

Rep: Reputation: Disabled
Unhappy Libnet Seg. Fault calling libnet_pblock_new() from libnet_build_tcp()


Solved previous problem i got another one.
In building a TCP packet through libnet function libnet_build_tcp() i got a SIGSEV in calling of libnet_pblock_new() function.

This is what libnet shows:

Code:
#0  0x00007ffff7bd0bf9 in libnet_pblock_new () from /usr/lib64/libnet.so.1
No symbol table info available.
#1  0x00007ffff7bcda52 in libnet_build_tcp () from /usr/lib64/libnet.so.1
No symbol table info available.
#2  0x000000000040172c in caught_packet (user_args=0x7fffffffe458 "\020\060`", 
    cap_header=0x7fffffffe3a0, packet=0x7ffff73d4046 "") at rst_hijack.c:86
        libnet_ctx = 0x7fffffffe458
        bcount = 0
        IPhdr = 0x7ffff73d4054
        TCPhdr = 0x7ffff73d4068
        source_ip = 1008806360678825902
        dest_ip = 9214452798765137930
and the SIGSEV:

Code:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bd0bf9 in libnet_pblock_new () from /usr/lib64/libnet.so.1
My code:

Code:
	libnet_build_tcp(htons(TCPhdr->th_dport),//Source port
				htons(TCPhdr->th_sport),//Destination port
				htonl(TCPhdr->th_ack),//SEQ
				htonl(libnet_get_prand(LIBNET_PRu32)),//Ack
				TH_RST,//control flags
				libnet_get_prand(LIBNET_PRu16),//Win Size
				0,//Sum
				0,//Urgent pointer
				LIBNET_TCP_H,//tcp len
				NULL,//Payload
				0,//Payload length
				libnet_ctx,//Libnet Context
				0//Ptag IPv4 Header
		                );
TCPhdr is a struct which contains a TCP header, libnet_ctx is a libnet context .

What's wrong with it ?
 
  


Reply

Tags
error, libnet, sigsev


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
seg fault / mem fault - in cron, but works in shell? kauaikat Red Hat 1 04-29-2008 05:24 PM
seg fault / mem fault - in cron, but works in shell? kauaikat Linux - Software 1 04-29-2008 09:21 AM
Qt: seg fault when calling treewidget Ephracis Programming 8 02-23-2007 06:38 AM
C seg fault drigz Programming 5 10-01-2004 04:35 PM


All times are GMT -5. The time now is 11:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration