mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Call socket_bindtodevice for -sT scan.
This commit is contained in:
@@ -2978,7 +2978,8 @@ static void ultrascan_port_probe_update(UltraScanInfo *USI, HostScanStats *hss,
|
||||
|
||||
|
||||
/* Set the socket lingering so we will RST connections instead of wasting
|
||||
bandwidth with the four-step close. Set the source address if needed. */
|
||||
bandwidth with the four-step close. Set the source address if needed. Bind to
|
||||
a specific interface if needed. */
|
||||
static void init_socket(int sd) {
|
||||
static int bind_failed = 0;
|
||||
struct linger l;
|
||||
@@ -3000,6 +3001,14 @@ static void init_socket(int sd) {
|
||||
bind_failed = 1;
|
||||
}
|
||||
}
|
||||
errno = 0;
|
||||
if (!socket_bindtodevice(sd, o.device)) {
|
||||
/* EPERM is expected when not running as root. */
|
||||
if (errno != EPERM) {
|
||||
error("Problem binding to interface %s, errno: %d", o.device, socket_errno());
|
||||
perror("socket_bindtodevice");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is NOT a ping probe, set pingseq to 0. Otherwise it will be the
|
||||
|
||||
Reference in New Issue
Block a user