Re: Netlink Implementation.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 20 October 2004 08:17 pm, Eric Bambach wrote:
> Hello,
>

In response to my previous message, maybe my questions were not specific 
enough. I have been debugging/understanding the code for a little time now 
and constantly run into this problem. I get a SIGSEGV here

Program received signal SIGSEGV, Segmentation fault.
0x08048a5a in Route::add(unsigned long*, unsigned long*) (this=0xbffff637,
    destination=0xbffff630, gateway=0xbffff630)
    at /home/bot403/programming/projects/route_test_driver/src/route.cpp:106
106                 while(RTA_OK(rta, len)) {
(gdb) print *rta
Cannot access memory at address 0xc0006544

It seems that the processing loop, does not know when to stop. I am at a bit 
of a loss as to how to detect the end of data as bytes from recv() far exceed 
the useful data that it returns. Recv will read up to 1200+ bytes, however it 
seems to include only one nlmsg packet. The loop keeps trying to process the 
payload and it (as expected) fails. How can I detect the end of data if the 
data ends at a few hundred bytes but the bytecount from recv is 1000+? Here 
is a gdb of the packet  just before the SIGSEGV. RTA_OK will happily print 
and process this packet even though it is obviously invalid.

Breakpoint 1, Route::add(unsigned long*, unsigned long*) (this=0xbffff637,
    destination=0xbffff630, gateway=0xbffff630)
    at /home/bot403/programming/projects/route_test_driver/src/route.cpp:106
106                 while(RTA_OK(rta, len)) {
(gdb) print *rta
$7 = {rta_len = 25956, rta_type = 30050}

and at this point

(gdb) print bytes
$8 = 324
(gdb)

There is still data in the buffer. Why is there still data from recv() but not 
processable data?

P.S. How big should my reply buffer be? recv() in this case tops out at about 
1200 but I am wondering if that much is even needed. Can anyone suggest a 
good value?

Any help is appreciated. Thanks.
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux