PDA

View Full Version : [C] socket raw su windows


Teo@Unix
29-03-2010, 22:12
Stò realizzando una utility che usa i socket raw sotto windows 7.:p

E' una mia impressione oppure c'è una limitazione al loro utilizzo nei moderni sistemi windows?:mad:
L'errore che ho è sempre su sendto() che torna 10014 --> "bas address".

Vi risulta? Facendo una ricerchina in rete mi sembra di si... Non c'è modo di ovviare vero? Thanks.

lupoxxx87
29-03-2010, 22:15
hai controllato il firewall di sistema ?

Teo@Unix
29-03-2010, 22:26
grazie,

disabilitato, ma non credo che questo sia il punto.
la funzione sendto() fallisce e WSAGetLastError() mi ritorna quel tipo di errore, stavo leggendo ora che da NT 6.0 in avanti ci sono restruizioni sui socket raw e non credo si possano bypassare....

tomminno
29-03-2010, 22:27
Stò realizzando una utility che usa i socket raw sotto windows 7.:p

E' una mia impressione oppure c'è una limitazione al loro utilizzo nei moderni sistemi windows?:mad:
L'errore che ho è sempre su sendto() che torna 10014 --> "bas address".

Vi risulta? Facendo una ricerchina in rete mi sembra di si... Non c'è modo di ovviare vero? Thanks.

Mi risulta che da XP SP1 in poi non sia più possibile utilizzare i socket raw. Salvo l'installazione di software tipo Wireshark (o comunque driver di rete appositi) e utilizzo delle relative api.

Teo@Unix
29-03-2010, 22:30
già :mbe: uffa...

da MSDN:

Limitations on Raw Sockets

On Windows 7, Windows Server 2008 R2, Windows Vista, and Windows XP with Service Pack 2 (SP2), the ability to send traffic over raw sockets has been restricted in several ways:

TCP data cannot be sent over raw sockets.
UDP datagrams with an invalid source address cannot be sent over raw sockets. The IP source address for any outgoing UDP datagram must exist on a network interface or the datagram is dropped. This change was made to limit the ability of malicious code to create distributed denial-of-service attacks and limits the ability to send spoofed packets (TCP/IP packets with a forged source IP address).
A call to the bind function with a raw socket is not allowed.

These above restrictions do not apply to Windows Server 2008 , Windows Server 2003, or to versions of the operating system earlier than Windows XP with SP2.

me ne torno su linux, spero che stessa cosa non sia stata fatta anche per gli ultimi kernel.

shinya
30-03-2010, 09:08
Ma con WinPcap non riesci?

Teo@Unix
30-03-2010, 09:59
Ma con WinPcap non riesci?

certo, libpcap ha i suoi driver quindi non ci dovrebbero essere problemi.

Questa è un'altra alternativa che si può usare, oppure libnet.

Mi sposto su linux perchè volevo vedere subito un risultato senza stare a modificare ora il codice.

Su windows invece dovrò fare come hai giustamente indicato.:D

Grazie.

Teo@Unix
30-03-2010, 20:57
per informazione sull'ultimo kernel linux tutto OK!:)