Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37728921
en ru br
Репозитории ALT
S:4.0.20100725-alt3
5.1: 4.0.20061122-alt2
4.1: 4.0.20061122-alt1
4.0: 4.0.20061122-alt1
3.0: 3.6-alt2
www.altlinux.org/Changes

Группа :: Сети/Прочее
Пакет: netcat

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: netcat-4.0.20061122-alt-bsdsockopts.patch
Скачать


--- netcat-4.0.20061122/usr.bin/nc/nc.1
+++ netcat-4.0.20061122/usr.bin/nc/nc.1
@@ -146,6 +146,8 @@ instead of sequentially within a range or in the order that the system
 assigns them.
 .It Fl S
 Enables the RFC 2385 TCP MD5 signature option.
+.Ar NOTE:
+This option is supported under OpenBSD, but not under Linux now.
 .It Fl s Ar source_ip_address
 Specifies the IP of the interface which is used to send the packets.
 It is an error to use this option in conjunction with the
--- netcat-4.0.20061122/usr.bin/nc/netcat.c
+++ netcat-4.0.20061122/usr.bin/nc/netcat.c
@@ -56,6 +56,14 @@
 #include "atomicio.h"
 #include <time.h>
 
+#if defined(TCP_MD5SIG)
+#define HAVE_TCP_MD5SIG 1
+#endif
+
+#if defined(SO_JUMBO)
+#define HAVE_SO_JUMBO 1
+#endif
+
 #ifndef SUN_LEN
 #define SUN_LEN(su) \
 	(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
@@ -67,7 +75,9 @@
 /* Command Line Options */
 int	dflag;					/* detached, no stdin */
 unsigned int iflag;				/* Interval Flag */
+#if defined(HAVE_SO_JUMBO)
 int	jflag;					/* use jumbo frames if we can */
+#endif
 int	kflag;					/* More than one connect */
 int	lflag;					/* Bind to local port */
 int	nflag;					/* Don't do name look up */
@@ -81,7 +91,9 @@ int	vflag;					/* Verbosity */
 int	xflag;					/* Socks proxy */
 int	zflag;					/* Port Scan Flag */
 int	Dflag;					/* sodebug */
+#if defined(HAVE_TCP_MD5SIG)
 int	Sflag;					/* TCP MD5 signature option */
+#endif
 int	Tflag = -1;				/* IP Type of Service */
 
 int timeout = -1;
@@ -160,7 +172,11 @@ main(int argc, char *argv[])
 				errx(1, "interval %s: %s", errstr, optarg);
 			break;
 		case 'j':
+#if defined(HAVE_SO_JUMBO)
 			jflag = 1;
+#else
+			errx(1, "-j requires SO_JUMBO kernel support that's missing under Linux now");
+#endif
 			break;
 		case 'k':
 			kflag = 1;
@@ -211,7 +227,11 @@ main(int argc, char *argv[])
 			Dflag = 1;
 			break;
 		case 'S':
+#if defined(HAVE_TCP_MD5SIG)
 			Sflag = 1;
+#else
+			errx(1, "-S requires TCP_MD5SIG kernel support that's missing under Linux now");
+#endif
 			break;
 		case 'T':
 			Tflag = parse_iptos(optarg);
@@ -311,7 +331,11 @@ main(int argc, char *argv[])
 				struct sockaddr_storage z;
 
 				len = sizeof(z);
+#if defined(HAVE_SO_JUMBO)
 				plen = jflag ? 8192 : 1024;
+#else
+				plen = sizeof(buf);
+#endif
 				rv = recvfrom(s, buf, plen, MSG_PEEK,
 				    (struct sockaddr *)&z, &len);
 				if (rv < 0)
@@ -608,7 +632,11 @@ readwrite(int nfd)
 	int lfd = fileno(stdout);
 	int plen;
 
+#if defined(HAVE_SO_JUMBO)
 	plen = jflag ? 8192 : 1024;
+#else
+	plen = sizeof(buf);
+#endif
 
 	/* Setup Network FD */
 	pfd[0].fd = nfd;
@@ -772,26 +800,32 @@ set_common_sockopts(int s)
 {
 	int x = 1;
 
+#if defined(HAVE_TCP_MD5SIG)
 	if (Sflag) {
 		if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
 			&x, sizeof(x)) == -1)
 			err(1, NULL);
 	}
+#endif
 	if (Dflag) {
 		if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
 			&x, sizeof(x)) == -1)
 			err(1, NULL);
 	}
+#if defined(HAVE_SO_JUMBO)
 	if (jflag) {
 		if (setsockopt(s, SOL_SOCKET, SO_JUMBO,
 			&x, sizeof(x)) == -1)
 			err(1, NULL);
 	}
+#endif
 	if (Tflag != -1) {
 		if (setsockopt(s, IPPROTO_IP, IP_TOS,
 		    &Tflag, sizeof(Tflag)) == -1)
 			err(1, "set IP ToS");
 	}
+
+	return;
 }
 
 int
@@ -827,9 +861,13 @@ help(void)
 	\t-n		Suppress name/port resolutions\n\
 	\t-P proxyuser\tUsername for proxy authentication\n\
 	\t-p port\t	Specify local port for remote connects\n\
-	\t-r		Randomize remote ports\n\
-	\t-S		Enable the TCP MD5 signature option\n\
-	\t-s addr\t	Local source address\n\
+	\t-r		Randomize remote ports\n"
+#if defined (HAVE_TCP_MD5SIG)
+"	\t-S		Enable the TCP MD5 signature option\n"
+#else
+"	\t-S		Enable the TCP MD5 signature option (BSD only!)\n"
+#endif
+"	\t-s addr\t	Local source address\n\
 	\t-T ToS\t	Set IP Type of Service\n\
 	\t-t		Answer TELNET negotiation\n\
 	\t-U		Use UNIX domain socket\n\
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin