From 5b8c1090e58b5fa459c1b9045bb55a19bb2146e5 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 11 Sep 2012 18:39:42 +0000 Subject: [PATCH] Add specifiers for source address and interface in route_dst_netlink. We previously restricted by destination address; do it for source address as well. This can matter in some configurations. http://seclists.org/nmap-dev/2012/q3/831 There still seems to be a problem with the wrong route being chosen with --send-ip, but this patch is reported to work with --send-eth. --- libnetutil/netutil.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index c68fd6772..f4c024635 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -3093,6 +3093,10 @@ static int route_dst_netlink(const struct sockaddr_storage *dst, /* Add rtattrs for destination address and interface. */ add_rtattr_addr(nlmsg, &rtattr, &len, RTA_DST, dst); + if (spoofss != NULL) { + /* Add rtattrs for source address and interface. */ + add_rtattr_addr(nlmsg, &rtattr, &len, RTA_SRC, spoofss); + } iov.iov_base = nlmsg; iov.iov_len = nlmsg->nlmsg_len;