gettimeofday() in hping

binto binto at triplegate.net.id
Thu Jan 24 17:58:08 PST 2008


Hi,

Sorry if a little bit insist & curious.

what is result from:
sysctl -a kern.ipc.maxsockbuf
sysctl -a net.inet.tcp.recvspace
sysctl -a net.inet.tcp.sendspace

??

binto

> Greetings,
>
> Kris Kennaway wrote:
>> Stefan Lambrev wrote:
>>
>>>> It is the socket buffer that is filling up.  Either the application
>>>> is not increasing it to large enough size or the default maximum is
>>>> too low (Linux may set a larger default).  Try increasing
>>>> kern.ipc.maxsockbuf and confirming with the source and/or ktrace
>>>> that it is doing the right setsockopt() call.
>>> Increasing kern.ipc.maxsockbuf doesn't help.
>>>
>>> Actually this is the code that failed and print this error:
>>>
>>>        result = sendto(sockraw, packet, packetsize, 0,
>>>                (struct sockaddr*)&remote, sizeof(remote));
>>>
>>>        if (result == -1 && errno != EINTR && !opt_rand_dest &&
>>> !opt_rand_source) {
>>>                perror("[send_ip] sendto");
>>>
>>> Those are the only references for setsockopt when ktracing:
>>> 3385 hping    CALL  __sysctl(0xbfbfe870,0x6,0,0xbfbfe888,0,0)
>>>  3385 hping    RET   __sysctl 0
>>>  3385 hping    CALL  __sysctl(0xbfbfe870,0x6,0x28305180,0xbfbfe888,0,0)
>>>  3385 hping    RET   __sysctl 0
>>>  3385 hping    CALL  socket(PF_INET,SOCK_DGRAM,IPPROTO_IP)
>>>  3385 hping    RET   socket 3
>>>  3385 hping    CALL
>>> setsockopt(0x3,SOL_SOCKET,SO_BROADCAST,0xbfbfe884,0x4)
>>>  3385 hping    RET   setsockopt 0
>>>  3385 hping    CALL  connect(0x3,0x8067da0,0x10)
>>>  3385 hping    RET   connect 0
>>>  3385 hping    CALL  getsockname(0x3,0xbfbfe874,0xbfbfe888)
>>>  3385 hping    RET   getsockname 0
>>>  3385 hping    CALL  close(0x3)
>>>  3385 hping    RET   close 0
>>>  3385 hping    CALL  socket(PF_INET,SOCK_RAW,IPPROTO_RAW)
>>>  3385 hping    RET   socket 3
>>>  3385 hping    CALL
>>> setsockopt(0x3,SOL_SOCKET,SO_BROADCAST,0xbfbfe914,0x4)
>>>  3385 hping    RET   setsockopt 0
>>>  3385 hping    CALL  setsockopt(0x3,0,0x2,0xbfbfe914,0x4)
>>>  3385 hping    RET   setsockopt 0
>>>  3385 hping    CALL  open(0xbfbfe8a4,O_RDWR,<unused>0)
>>>  3385 hping    NAMI  "/dev/bpf0"
>>>  3385 hping    RET   open -1 errno 16 Device busy
>>>  3385 hping    CALL  open(0xbfbfe8a4,O_RDWR,<unused>0)
>>>  3385 hping    NAMI  "/dev/bpf1"
>>>  3385 hping    RET   open 4
>>
>> OK, try adding the setsockopt(...SO_SNDBUF...) call.
> Will something like this do the trick?
>
> void socket_sndbuf(int sd)
> {
>         long int bufsize;
>         bufsize = 65536;
>         if (setsockopt(sd, SOL_SOCKET, SO_SNDBUF,
>                         (char *)&bufsize, sizeof(int)) == -1)
>         {
>                 printf("[socket_sndbuf] can't set SO_SNDBUF option\n");
>         }
> }
>
> I'm not a C developer so pardon me if I made something stupid :)
> Also how can I make bufsize = default settings*2 for example?
>
> I tried this code and here is what ktrace show now:
>  65372 hping3   CALL  socket(PF_INET,SOCK_DGRAM,IPPROTO_IP)
>  65372 hping3   RET   socket 3
>  65372 hping3   CALL
> setsockopt(0x3,SOL_SOCKET,SO_BROADCAST,0xbfbfe844,0x4)
>  65372 hping3   RET   setsockopt 0
>  65372 hping3   CALL  connect(0x3,0x8067e20,0x10)
>  65372 hping3   RET   connect 0
>  65372 hping3   CALL  getsockname(0x3,0xbfbfe834,0xbfbfe848)
>  65372 hping3   RET   getsockname 0
>  65372 hping3   CALL  close(0x3)
>  65372 hping3   RET   close 0
>  65372 hping3   CALL  socket(PF_INET,SOCK_RAW,IPPROTO_RAW)
>  65372 hping3   RET   socket 3
>  65372 hping3   CALL
> setsockopt(0x3,SOL_SOCKET,SO_BROADCAST,0xbfbfe8d4,0x4)
>  65372 hping3   RET   setsockopt 0
>  65372 hping3   CALL  setsockopt(0x3,0,0x2,0xbfbfe8d4,0x4)
>  65372 hping3   RET   setsockopt 0
>  65372 hping3   CALL  setsockopt(0x3,SOL_SOCKET,SO_SNDBUF,0xbfbfe8d4,0x4)
>  65372 hping3   RET   setsockopt 0
>
>>
>> Kris
>> _______________________________________________
>> freebsd-hackers at freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>> To unsubscribe, send any mail to
>> "freebsd-hackers-unsubscribe at freebsd.org"
>
> --
>
> Best Wishes,
> Stefan Lambrev
> ICQ# 24134177
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>




More information about the freebsd-hackers mailing list