Package: netcat-traditional
Version: 1.10-39
Severity: wishlist
Netcat does not have an option for disabling udp checksums on outgoing
packets. The attached patch adds this feature. Applies against fully
patched netcat 1.10-39.
-- System Information:
Debian Release: wheezy/sid
APT prefers oneiric-updates
APT policy: (500, 'oneiric-updates'), (500, 'oneiric-security'), (500,
'oneiric')
Architecture: amd64 (x86_64)
Kernel: Linux 3.0.4-030004-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages netcat-traditional depends on:
ii libc6 2.13-20ubuntu5 Embedded GNU C Library: Shared lib
netcat-traditional recommends no packages.
netcat-traditional suggests no packages.
-- no debconf information
diff --git a/netcat.c b/netcat.c
index 18ee0a8..3816973 100644
--- a/netcat.c
+++ b/netcat.c
@@ -172,6 +172,7 @@ unsigned char * stage = NULL; /* hexdump line buffer */
/* global cmd flags: */
USHORT o_alla = 0;
USHORT o_allowbroad = 0;
+USHORT o_noudpchecksum = 0;
unsigned int o_interval = 0;
USHORT o_listen = 0;
USHORT o_nflag = 0;
@@ -674,6 +675,13 @@ newskt:
holler ("nnetfd reuseaddr failed"); /* ??? */
}
#endif
+#ifdef SO_NO_CHECK
+ if (o_noudpchecksum) {
+ rr = setsockopt (nnetfd, SOL_SOCKET, SO_NO_CHECK, &x, sizeof (x));
+ if (rr == -1)
+ holler ("nnetfd so_no_check failed"); /* ??? */
+ }
+#endif
#ifdef SO_REUSEPORT /* doesnt exist everywhere... */
rr = setsockopt (nnetfd, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x));
if (rr == -1)
@@ -1512,7 +1520,7 @@ main (argc, argv)
/* 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:T:tuvw:z")) != EOF) {
+ while ((x = getopt (argc, argv, "abc:e:g:G:hi:klnNo:p:q:rs:T:tuvw:z")) != EOF) {
/* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) */
switch (x) {
case 'a':
@@ -1565,6 +1573,8 @@ main (argc, argv)
o_listen++; break;
case 'n': /* numeric-only, no DNS lookups */
o_nflag++; break;
+ case 'N':
+ o_noudpchecksum++; break; /* No udp checksum */
case 'o': /* hexdump log */
stage = (unsigned char *) optarg;
o_wfile++; break;
@@ -1816,6 +1826,7 @@ options:");
-k set keepalive option on socket\n\
-l listen mode, for inbound connects\n\
-n numeric-only IP addresses, no DNS\n\
+ -N No checksum for udp\n\
-o file hex dump of traffic\n\
-p port local port number\n\
-r randomize local and remote ports\n\