Index: netcat-1.10/netcat.c =================================================================== --- netcat-1.10.orig/netcat.c 2007-09-17 22:04:23.000000000 +0200 +++ netcat-1.10/netcat.c 2007-09-17 22:40:48.000000000 +0200 @@ -86,6 +86,9 @@ #include #endif +/* quick hack to make it working without patched kernel source */ +#define IP_TRANSPARENT 19 + /* handy stuff: */ #define SA struct sockaddr /* socket overgeneralization braindeath */ #define SAI struct sockaddr_in /* ... whoever came up with this model */ @@ -179,6 +182,7 @@ USHORT o_zero = 0; int o_quit = -1; /* 0 == quit-now; >0 == quit after o_quit seconds */ int o_keepalive = 0; +int o_transparent = 0; #ifdef IP_TOS unsigned char o_tos = 0; #endif @@ -689,6 +693,13 @@ holler("nnetfd set keepalive failed"); } } + if (o_transparent) { + x = 1; + rr = setsockopt(nnetfd, SOL_IP, IP_TRANSPARENT, &x, sizeof(x)); + if (rr == -1) { + holler("nnetfd set transparent failed"); + } + } #if 0 /* If you want to screw with RCVBUF/SNDBUF, do it here. Liudvikas Bukys at Rochester sent this example, which would involve YET MORE options and is @@ -1508,7 +1519,7 @@ /* If your shitbox doesn't have getopt, step into the nineties already. */ /* optarg, optind = next-argv-component [i.e. flag arg]; optopt = last-char */ - while ((x = getopt (argc, argv, "abc:e:g:G:hi:klno:p:q:rs:tuvw:x:z")) != EOF) { + while ((x = getopt (argc, argv, "abc:e:g:G:hi:klno:p:q:rs:tTuvw:x:z")) != EOF) { /* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) */ switch (x) { case 'a': @@ -1557,6 +1568,8 @@ break; case 'k': o_keepalive = 1; break; + case 'T': + o_transparent = 1; break; case 'l': /* listen mode */ o_listen++; break; case 'n': /* numeric-only, no DNS lookups */ @@ -1822,6 +1835,7 @@ -t answer TELNET negotiation"); #endif holler ("\ + -T set IP_TRANSPARENT for the socket\n\ -u UDP mode\n\ -v verbose [use twice to be more verbose]\n\ -w secs timeout for connects and final net reads");