lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171126201118.6550-1-stephen@networkplumber.org>
Date:   Sun, 26 Nov 2017 12:11:18 -0800
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     netdev@...r.kernel.org
Cc:     Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2] drop support for DECnet

Nothing has been done in Linux to maintain DECnet
for years. The code is buggy and does not support net namespace.
This patch removes all support of it from iproute2

Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
 Makefile        |   3 --
 README.decnet   |  33 ------------------
 README.lnstat   |   2 +-
 include/utils.h |   3 --
 ip/ip.c         |   2 +-
 ip/ipaddress.c  |   2 --
 ip/ipntable.c   |   2 --
 lib/dnet_ntop.c | 101 --------------------------------------------------------
 lib/dnet_pton.c |  75 -----------------------------------------
 lib/utils.c     |  27 ++-------------
 man/man8/ip.8   |   5 ---
 11 files changed, 4 insertions(+), 251 deletions(-)
 delete mode 100644 README.decnet
 delete mode 100644 lib/dnet_ntop.c
 delete mode 100644 lib/dnet_pton.c

diff --git a/Makefile b/Makefile
index 6a51e0db9107..f3c2d5b90f7b 100644
--- a/Makefile
+++ b/Makefile
@@ -29,9 +29,6 @@ endif
 
 DEFINES+=-DCONFDIR=\"$(CONFDIR)\"
 
-#options for decnet
-ADDLIB+=dnet_ntop.o dnet_pton.o
-
 #options for ipx
 ADDLIB+=ipx_ntop.o ipx_pton.o
 
diff --git a/README.decnet b/README.decnet
deleted file mode 100644
index 4300f906d97b..000000000000
--- a/README.decnet
+++ /dev/null
@@ -1,33 +0,0 @@
-
-Here are a few quick points about DECnet support...
-
- o iproute2 is the tool of choice for configuring the DECnet support for
-   Linux. For many features, it is the only tool which can be used to
-   configure them.
-
- o No name resolution is available as yet, all addresses must be
-   entered numerically.
-
- o Remember to set the hardware address of the interface using: 
-
-   ip link set ethX address xx:xx:xx:xx:xx:xx
-      (where xx:xx:xx:xx:xx:xx is the MAC address for your DECnet node
-       address)
-
-   if your Ethernet card won't listen to more than one unicast
-   mac address at once. If the Linux DECnet stack doesn't talk to
-   any other DECnet nodes, then check this with tcpdump and if its
-   a problem, change the mac address (but do this _before_ starting
-   any other network protocol on the interface)
-
- o Whilst you can use ip addr add to add more than one DECnet address to an
-   interface, don't expect addresses which are not the same as the
-   kernels node address to work properly with 2.4 kernels. This should
-   be fine with 2.6 kernels as the routing code has been extensively
-   modified and improved.
-
- o The DECnet support is currently self contained. It does not depend on
-   the libdnet library.
-
-Steve Whitehouse <steve@...gwyn.com>
-
diff --git a/README.lnstat b/README.lnstat
index 057925f671b7..59134a158c3b 100644
--- a/README.lnstat
+++ b/README.lnstat
@@ -9,7 +9,7 @@ In addition to routing cache statistics, it supports any kind of statistics
 the linux kernel exports via a file in /proc/net/stat.  In a stock 2.6.9
 kernel, this is 
 	per-protocol neighbour cache statistics 
-		(ipv4, ipv6, atm, decnet)
+		(ipv4, ipv6, atm)
 	routing cache statistics
 		(ipv4)
 	connection tracking statistics
diff --git a/include/utils.h b/include/utils.h
index d3895d562726..fb7b5d295254 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -142,9 +142,6 @@ int get_ifname(char *, const char *);
 int matches(const char *arg, const char *pattern);
 int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits);
 
-const char *dnet_ntop(int af, const void *addr, char *str, size_t len);
-int dnet_pton(int af, const char *src, void *addr);
-
 const char *ipx_ntop(int af, const void *addr, char *str, size_t len);
 int ipx_pton(int af, const char *src, void *addr);
 
diff --git a/ip/ip.c b/ip/ip.c
index b15e6b66b3f6..bc95d0ab95cb 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -216,7 +216,7 @@ int main(int argc, char **argv)
 		} else if (strcmp(opt, "-I") == 0) {
 			preferred_family = AF_IPX;
 		} else if (strcmp(opt, "-D") == 0) {
-			preferred_family = AF_DECnet;
+			invarg("DECnet is not supported", opt);
 		} else if (strcmp(opt, "-M") == 0) {
 			preferred_family = AF_MPLS;
 		} else if (strcmp(opt, "-B") == 0) {
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 8057011ef525..2a4939340be2 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1576,8 +1576,6 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
 			print_string(PRINT_ANY, "family", "    %s ", "inet");
 		else if (ifa->ifa_family == AF_INET6)
 			print_string(PRINT_ANY, "family", "    %s ", "inet6");
-		else if (ifa->ifa_family == AF_DECnet)
-			print_string(PRINT_ANY, "family", "    %s ", "dnet");
 		else if (ifa->ifa_family == AF_IPX)
 			print_string(PRINT_ANY, "family", "     %s ", "ipx");
 		else
diff --git a/ip/ipntable.c b/ip/ipntable.c
index 2f72c989f35d..a33bcdcf9f76 100644
--- a/ip/ipntable.c
+++ b/ip/ipntable.c
@@ -389,8 +389,6 @@ static int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void
 		fprintf(fp, "inet ");
 	else if (ndtm->ndtm_family == AF_INET6)
 		fprintf(fp, "inet6 ");
-	else if (ndtm->ndtm_family == AF_DECnet)
-		fprintf(fp, "dnet ");
 	else
 		fprintf(fp, "(%d) ", ndtm->ndtm_family);
 
diff --git a/lib/dnet_ntop.c b/lib/dnet_ntop.c
deleted file mode 100644
index 17d960e30881..000000000000
--- a/lib/dnet_ntop.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-
-#include "utils.h"
-
-static __inline__ u_int16_t dn_ntohs(u_int16_t addr)
-{
-	union {
-		u_int8_t byte[2];
-		u_int16_t word;
-	} u;
-
-	u.word = addr;
-	return ((u_int16_t)u.byte[0]) | (((u_int16_t)u.byte[1]) << 8);
-}
-
-static __inline__ int do_digit(char *str, u_int16_t *addr, u_int16_t scale, size_t *pos, size_t len, int *started)
-{
-	u_int16_t tmp = *addr / scale;
-
-	if (*pos == len)
-		return 1;
-
-	if (((tmp) > 0) || *started || (scale == 1)) {
-		*str = tmp + '0';
-		*started = 1;
-		(*pos)++;
-		*addr -= (tmp * scale);
-	}
-
-	return 0;
-}
-
-
-static const char *dnet_ntop1(const struct dn_naddr *dna, char *str, size_t len)
-{
-	u_int16_t addr, area;
-	size_t pos = 0;
-	int started = 0;
-
-	memcpy(&addr, dna->a_addr, sizeof(addr));
-	addr = dn_ntohs(addr);
-	area = addr >> 10;
-
-	if (dna->a_len != 2)
-		return NULL;
-
-	addr &= 0x03ff;
-
-	if (len == 0)
-		return str;
-
-	if (do_digit(str + pos, &area, 10, &pos, len, &started))
-		return str;
-
-	if (do_digit(str + pos, &area, 1, &pos, len, &started))
-		return str;
-
-	if (pos == len)
-		return str;
-
-	*(str + pos) = '.';
-	pos++;
-	started = 0;
-
-	if (do_digit(str + pos, &addr, 1000, &pos, len, &started))
-		return str;
-
-	if (do_digit(str + pos, &addr, 100, &pos, len, &started))
-		return str;
-
-	if (do_digit(str + pos, &addr, 10, &pos, len, &started))
-		return str;
-
-	if (do_digit(str + pos, &addr, 1, &pos, len, &started))
-		return str;
-
-	if (pos == len)
-		return str;
-
-	*(str + pos) = 0;
-
-	return str;
-}
-
-
-const char *dnet_ntop(int af, const void *addr, char *str, size_t len)
-{
-	switch(af) {
-		case AF_DECnet:
-			errno = 0;
-			return dnet_ntop1((struct dn_naddr *)addr, str, len);
-		default:
-			errno = EAFNOSUPPORT;
-	}
-
-	return NULL;
-}
diff --git a/lib/dnet_pton.c b/lib/dnet_pton.c
deleted file mode 100644
index 1cf54e51868d..000000000000
--- a/lib/dnet_pton.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-
-#include "utils.h"
-
-static __inline__ u_int16_t dn_htons(u_int16_t addr)
-{
-        union {
-                u_int8_t byte[2];
-                u_int16_t word;
-        } u;
-
-        u.word = addr;
-        return ((u_int16_t)u.byte[0]) | (((u_int16_t)u.byte[1]) << 8);
-}
-
-
-static int dnet_num(const char *src, u_int16_t * dst)
-{
-	int rv = 0;
-	int tmp;
-	*dst = 0;
-
-	while ((tmp = *src++) != 0) {
-		tmp -= '0';
-		if ((tmp < 0) || (tmp > 9))
-			return rv;
-
-		rv++;
-		(*dst) *= 10;
-		(*dst) += tmp;
-	}
-
-	return rv;
-}
-
-static int dnet_pton1(const char *src, struct dn_naddr *dna)
-{
-	u_int16_t addr;
-	u_int16_t area = 0;
-	u_int16_t node = 0;
-	int pos;
-
-	pos = dnet_num(src, &area);
-	if ((pos == 0) || (area > 63) || (*(src + pos) != '.'))
-		return 0;
-	pos = dnet_num(src + pos + 1, &node);
-	if ((pos == 0) || (node > 1023))
-		return 0;
-	dna->a_len = 2;
-	addr = dn_htons((area << 10) | node);
-	memcpy(dna->a_addr, &addr, sizeof(addr));
-
-	return 1;
-}
-
-int dnet_pton(int af, const char *src, void *addr)
-{
-	int err;
-
-	switch (af) {
-	case AF_DECnet:
-		errno = 0;
-		err = dnet_pton1(src, (struct dn_naddr *)addr);
-		break;
-	default:
-		errno = EAFNOSUPPORT;
-		err = -1;
-	}
-
-	return err;
-}
diff --git a/lib/utils.c b/lib/utils.c
index 7ced8c061cb0..522acf2e1e35 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -541,7 +541,7 @@ int get_addr_1(inet_prefix *addr, const char *name, int family)
 	if (strcmp(name, "default") == 0 ||
 	    strcmp(name, "all") == 0 ||
 	    strcmp(name, "any") == 0) {
-		if ((family == AF_DECnet) || (family == AF_MPLS))
+		if (family == AF_MPLS)
 			return -1;
 		addr->family = family;
 		addr->bytelen = (family == AF_INET6 ? 16 : 4);
@@ -574,18 +574,6 @@ int get_addr_1(inet_prefix *addr, const char *name, int family)
 		return 0;
 	}
 
-	if (family == AF_DECnet) {
-		struct dn_naddr dna;
-
-		addr->family = AF_DECnet;
-		if (dnet_pton(AF_DECnet, name, &dna) <= 0)
-			return -1;
-		memcpy(addr->data, dna.a_addr, 2);
-		addr->bytelen = 2;
-		addr->bitlen = -1;
-		return 0;
-	}
-
 	if (family == AF_MPLS) {
 		unsigned int maxlabels;
 		int i;
@@ -653,7 +641,7 @@ int get_prefix_1(inet_prefix *dst, char *arg, int family)
 	if (strcmp(arg, "default") == 0 ||
 	    strcmp(arg, "any") == 0 ||
 	    strcmp(arg, "all") == 0) {
-		if ((family == AF_DECnet) || (family == AF_MPLS))
+		if (family == AF_MPLS)
 			return -1;
 		dst->family = family;
 		dst->bytelen = 0;
@@ -886,13 +874,6 @@ const char *rt_addr_n2a_r(int af, int len,
 		return mpls_ntop(af, addr, buf, buflen);
 	case AF_IPX:
 		return ipx_ntop(af, addr, buf, buflen);
-	case AF_DECnet:
-	{
-		struct dn_naddr dna = { 2, { 0, 0, } };
-
-		memcpy(dna.a_addr, addr, 2);
-		return dnet_ntop(af, &dna, buf, buflen);
-	}
 	case AF_PACKET:
 		return ll_addr_n2a(addr, len, ARPHRD_VOID, buf, buflen);
 	default:
@@ -915,8 +896,6 @@ int read_family(const char *name)
 		family = AF_INET;
 	else if (strcmp(name, "inet6") == 0)
 		family = AF_INET6;
-	else if (strcmp(name, "dnet") == 0)
-		family = AF_DECnet;
 	else if (strcmp(name, "link") == 0)
 		family = AF_PACKET;
 	else if (strcmp(name, "ipx") == 0)
@@ -934,8 +913,6 @@ const char *family_name(int family)
 		return "inet";
 	if (family == AF_INET6)
 		return "inet6";
-	if (family == AF_DECnet)
-		return "dnet";
 	if (family == AF_PACKET)
 		return "link";
 	if (family == AF_IPX)
diff --git a/man/man8/ip.8 b/man/man8/ip.8
index ae018fdf11ac..77f9f20f6ed8 100644
--- a/man/man8/ip.8
+++ b/man/man8/ip.8
@@ -125,11 +125,6 @@ shortcut for
 .BR "\-family bridge" .
 
 .TP
-.B \-D
-shortcut for
-.BR "\-family decnet" .
-
-.TP
 .B \-I
 shortcut for
 .BR "\-family ipx" .
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ