Index: tcpip.cc
===================================================================
--- tcpip.cc	(revision 5985)
+++ tcpip.cc	(working copy)
@@ -161,6 +161,16 @@
 #endif
 }
 
+void set_ttl(int sd, int ttl)
+{
+#ifdef IP_TTL
+	if (sd == -1)
+		return;
+
+	setsockopt(sd, IPPROTO_IP, IP_TTL, &ttl, sizeof ttl);
+#endif
+}
+
 // Takes a protocol number like IPPROTO_TCP, IPPROTO_UDP, or
 // IPPROTO_IP and returns a ascii representation (or "unknown" if it
 // doesn't recognize the number).  If uppercase is true, the returned
Index: tcpip.h
===================================================================
--- tcpip.h	(revision 5985)
+++ tcpip.h	(working copy)
@@ -663,6 +663,8 @@
 struct sys_route *getsysroutes(int *howmany);
 void sethdrinclude(int sd);
 
+void set_ttl(int sd, int ttl);
+
 /* Fill buf (up to buflen -- truncate if necessary but always
    terminate) with a short representation of the packet stats.
    Returns buf.  Aborts if there is a problem. */
Index: scan_engine.cc
===================================================================
--- scan_engine.cc	(revision 5985)
+++ scan_engine.cc	(working copy)
@@ -2458,6 +2458,7 @@
   if (CP->sd == -1) pfatal("Socket creation in %s", __func__);
   unblock_socket(CP->sd);
   init_socket(CP->sd);
+  set_ttl(CP->sd, o.ttl);
   if (hss->target->TargetSockAddr(&sock, &socklen) != 0) {
     fatal("Failed to get target socket address in %s", __func__);
   }
