Nmap Development mailing list archives

Re: Nping not sending UDP broadcasts


From: David Fifield <david () bamsoftware com>
Date: Tue, 21 Sep 2010 14:38:06 -0600

On Tue, Sep 21, 2010 at 07:46:48PM +0200, Luis MartinGarcia. wrote:
On 09/18/2010 09:28 PM, David Fifield wrote:
On Sat, Sep 18, 2010 at 08:39:45PM +0200, Luis MartinGarcia. wrote:
  
Hi, David.

Thanks for the report. I've just added a to-do item for this. I guess
making a setsockopt() call for the SO_BROADCAST option will fix it.
Hopefully, next week I'll have some free time to fix this and the
nsi_delete() problem. 
    
I think you can use nsp_setbroadcast.

I've been looking into this but I haven't been able to find the problem.
Using nsp_setbroadcast(nsp, 1) does not help. I've seen that this only
happens for broadcast addresses for your current subnet (in my case
fails for 192.168.1.255 but works for any other .255). Also, I've found
that sending the packets at the raw ethernet level works fine (option
--send-eth).

I checked this out some more. When I was running before, I was running
as root. The problem also exists for unprivileged UDP, but the error
looks different:

$ nping --udp 192.168.0.255 -d

Starting Nping 0.5.35DC18 ( http://nmap.org/nping ) at 2010-09-21 13:32 PDT
ERR: (0.0000s) CONNECT to 192.168.0.255:40125 failed: Permission denied
ERR: (0.0000s) WRITE to 192.168.0.255:40125 failed: Destination address required

Calling nsp_setbroadcast in ProbeMode::init_nsock fixes that for me. I
committed it.

For privileged mode, I think you need to call setsockopt on rawipsd.
Sorry, I thought that privileged mode was using Nsock also, but it has
to be done separately.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: