mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +00:00
Call socket_bindtodevice in nmap_raw_socket.
This commit is contained in:
5
tcpip.cc
5
tcpip.cc
@@ -142,11 +142,13 @@ static PacketCounter PktCt;
|
|||||||
* Emit a fatal error on Windows.
|
* Emit a fatal error on Windows.
|
||||||
* Set SO_BROADCAST.
|
* Set SO_BROADCAST.
|
||||||
* Set IP_HDRINCL.
|
* Set IP_HDRINCL.
|
||||||
|
* Bind to an interface with SO_BINDTODEVICE (if o.device is set).
|
||||||
The socket is created with address family AF_INET, but may be usable for
|
The socket is created with address family AF_INET, but may be usable for
|
||||||
AF_INET6, depending on the operating system.
|
AF_INET6, depending on the operating system.
|
||||||
|
|
||||||
The argument warning_device_name is used *only* in the Windows fatal error
|
The argument warning_device_name is used *only* in the Windows fatal error
|
||||||
message, and does not affect any socket characteristics. */
|
message, and does not affect any socket characteristics. The global o.device
|
||||||
|
controls which interface to bind to with SO_BINDTODEVICE. */
|
||||||
int nmap_raw_socket(const char *warning_device_name) {
|
int nmap_raw_socket(const char *warning_device_name) {
|
||||||
int rawsd;
|
int rawsd;
|
||||||
|
|
||||||
@@ -159,6 +161,7 @@ int nmap_raw_socket(const char *warning_device_name) {
|
|||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
sethdrinclude(rawsd);
|
sethdrinclude(rawsd);
|
||||||
#endif
|
#endif
|
||||||
|
socket_bindtodevice(rawsd, o.device);
|
||||||
|
|
||||||
return rawsd;
|
return rawsd;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user