IPX has been depracted then removed from upstream kernels.
Drop support from ip route as well.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 Makefile               |  3 --
 include/utils.h        | 10 -----
 ip/ip.c                |  4 +-
 ip/iproute.c           |  2 +-
 lib/ipx_ntop.c         | 71 -------------------------------
 lib/ipx_pton.c         | 97 ------------------------------------------
 lib/utils.c            |  2 -
 man/man8/ip-route.8.in |  2 +-
 man/man8/ip.8          |  9 +---
 9 files changed, 5 insertions(+), 195 deletions(-)
 delete mode 100644 lib/ipx_ntop.c
 delete mode 100644 lib/ipx_pton.c

diff --git a/Makefile b/Makefile
index b7488addc6f2..7d62468c6638 100644
--- a/Makefile
+++ b/Makefile
@@ -43,9 +43,6 @@ DEFINES+=-DCONFDIR=\"$(CONFDIR)\" \
 #options for decnet
 ADDLIB+=dnet_ntop.o dnet_pton.o
 
-#options for ipx
-ADDLIB+=ipx_ntop.o ipx_pton.o
-
 #options for mpls
 ADDLIB+=mpls_ntop.o mpls_pton.o
 
diff --git a/include/utils.h b/include/utils.h
index bf6dea23df66..12c003c874c4 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -116,13 +116,6 @@ struct dn_naddr
         unsigned char a_addr[DN_MAXADDL];
 };
 
-#define IPX_NODE_LEN 6
-
-struct ipx_addr {
-       u_int32_t ipx_net;
-       u_int8_t  ipx_node[IPX_NODE_LEN];
-};
-
 #ifndef AF_MPLS
 # define AF_MPLS 28
 #endif
@@ -207,9 +200,6 @@ int inet_addr_match_rta(const inet_prefix *m, const struct 
rtattr *rta);
 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);
-
 const char *mpls_ntop(int af, const void *addr, char *str, size_t len);
 int mpls_pton(int af, const char *src, void *addr, size_t alen);
 
diff --git a/ip/ip.c b/ip/ip.c
index c324120f9fc5..11dbed72842f 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -53,7 +53,7 @@ static void usage(void)
 "                   vrf | sr }\n"
 "       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
 "                    -h[uman-readable] | -iec | -j[son] | -p[retty] |\n"
-"                    -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | 
link } |\n"
+"                    -f[amily] { inet | inet6 | dnet | mpls | bridge | link } 
|\n"
 "                    -4 | -6 | -I | -D | -M | -B | -0 |\n"
 "                    -l[oops] { maximum-addr-flush-attempts } | -br[ief] |\n"
 "                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] 
[filename] |\n"
@@ -225,8 +225,6 @@ int main(int argc, char **argv)
                        preferred_family = AF_INET6;
                } else if (strcmp(opt, "-0") == 0) {
                        preferred_family = AF_PACKET;
-               } else if (strcmp(opt, "-I") == 0) {
-                       preferred_family = AF_IPX;
                } else if (strcmp(opt, "-D") == 0) {
                        preferred_family = AF_DECnet;
                } else if (strcmp(opt, "-M") == 0) {
diff --git a/ip/iproute.c b/ip/iproute.c
index b039f35b0ccd..26f7cd8915bf 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -83,7 +83,7 @@ static void usage(void)
                "INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...\n"
                "NH := [ encap ENCAPTYPE ENCAPHDR ] [ via [ FAMILY ] ADDRESS 
]\n"
                "           [ dev STRING ] [ weight NUMBER ] NHFLAGS\n"
-               "FAMILY := [ inet | inet6 | ipx | dnet | mpls | bridge | link 
]\n"
+               "FAMILY := [ inet | inet6 | dnet | mpls | bridge | link ]\n"
                "OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ as [ to ] 
ADDRESS ]\n"
                "           [ rtt TIME ] [ rttvar TIME ] [ reordering NUMBER 
]\n"
                "           [ window NUMBER ] [ cwnd NUMBER ] [ initcwnd NUMBER 
]\n"
diff --git a/lib/ipx_ntop.c b/lib/ipx_ntop.c
deleted file mode 100644
index 80b8a34e1a70..000000000000
--- a/lib/ipx_ntop.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include "utils.h"
-
-static __inline__ int do_digit(char *str, u_int32_t addr, u_int32_t scale, 
size_t *pos, size_t len)
-{
-       u_int32_t tmp = addr >> (scale * 4);
-
-       if (*pos == len)
-               return 1;
-
-       tmp &= 0x0f;
-       if (tmp > 9)
-               *str = tmp + 'A' - 10;
-       else
-               *str = tmp + '0';
-       (*pos)++;
-
-       return 0;
-}
-
-static const char *ipx_ntop1(const struct ipx_addr *addr, char *str, size_t 
len)
-{
-       int i;
-       size_t pos = 0;
-
-       if (len == 0)
-               return str;
-
-       for(i = 7; i >= 0; i--)
-               if (do_digit(str + pos, ntohl(addr->ipx_net), i, &pos, len))
-                       return str;
-
-       if (pos == len)
-               return str;
-
-       *(str + pos) = '.';
-       pos++;
-
-       for(i = 0; i < 6; i++) {
-               if (do_digit(str + pos, addr->ipx_node[i], 1, &pos, len))
-                       return str;
-               if (do_digit(str + pos, addr->ipx_node[i], 0, &pos, len))
-                       return str;
-       }
-
-       if (pos == len)
-               return str;
-
-       *(str + pos) = 0;
-
-       return str;
-}
-
-
-const char *ipx_ntop(int af, const void *addr, char *str, size_t len)
-{
-       switch(af) {
-               case AF_IPX:
-                       errno = 0;
-                       return ipx_ntop1((struct ipx_addr *)addr, str, len);
-               default:
-                       errno = EAFNOSUPPORT;
-       }
-
-       return NULL;
-}
diff --git a/lib/ipx_pton.c b/lib/ipx_pton.c
deleted file mode 100644
index a97c1c1bc7bf..000000000000
--- a/lib/ipx_pton.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include "utils.h"
-
-static int ipx_getnet(u_int32_t *net, const char *str)
-{
-       int i;
-       u_int32_t tmp;
-
-       for(i = 0; *str && (i < 8); i++) {
-
-               if ((tmp = get_hex(*str)) == -1) {
-                       if (*str == '.')
-                               return 0;
-                       else
-                               return -1;
-               }
-
-               str++;
-               (*net) <<= 4;
-               (*net) |= tmp;
-       }
-
-       if (*str == 0)
-               return 0;
-
-       return -1;
-}
-
-static int ipx_getnode(u_int8_t *node, const char *str)
-{
-       int i;
-       u_int32_t tmp;
-
-       for(i = 0; i < 6; i++) {
-               if ((tmp = get_hex(*str++)) == -1)
-                       return -1;
-               node[i] = (u_int8_t)tmp;
-               node[i] <<= 4;
-               if ((tmp = get_hex(*str++)) == -1)
-                       return -1;
-               node[i] |= (u_int8_t)tmp;
-               if (*str == ':')
-                       str++;
-       }
-
-       return 0;
-}
-
-static int ipx_pton1(const char *src, struct ipx_addr *addr)
-{
-       char *sep = (char *)src;
-       int no_node = 0;
-
-       memset(addr, 0, sizeof(struct ipx_addr));
-
-       while(*sep && (*sep != '.'))
-               sep++;
-
-       if (*sep != '.')
-               no_node = 1;
-
-       if (ipx_getnet(&addr->ipx_net, src))
-               return 0;
-
-       addr->ipx_net = htonl(addr->ipx_net);
-
-       if (no_node)
-               return 1;
-
-       if (ipx_getnode(addr->ipx_node, sep + 1))
-               return 0;
-
-       return 1;
-}
-
-int ipx_pton(int af, const char *src, void *addr)
-{
-       int err;
-
-       switch (af) {
-       case AF_IPX:
-               errno = 0;
-               err = ipx_pton1(src, (struct ipx_addr *)addr);
-               break;
-       default:
-               errno = EAFNOSUPPORT;
-               err = -1;
-       }
-
-       return err;
-}
diff --git a/lib/utils.c b/lib/utils.c
index 345630d04929..8e1261f376cf 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -1033,8 +1033,6 @@ const char *rt_addr_n2a_r(int af, int len,
                return inet_ntop(af, addr, buf, buflen);
        case AF_MPLS:
                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, } };
diff --git a/man/man8/ip-route.8.in b/man/man8/ip-route.8.in
index a33ce1f0f400..809dc4252bc4 100644
--- a/man/man8/ip-route.8.in
+++ b/man/man8/ip-route.8.in
@@ -107,7 +107,7 @@ replace " } "
 
 .ti -8
 .IR FAMILY " := [ "
-.BR inet " | " inet6 " | " ipx " | " dnet " | " mpls " | " bridge " | " link " 
]"
+.BR inet " | " inet6 " | " dnet " | " mpls " | " bridge " | " link " ]"
 
 .ti -8
 .IR OPTIONS " := " FLAGS " [ "
diff --git a/man/man8/ip.8 b/man/man8/ip.8
index 1d358879ec39..16867efbeaf8 100644
--- a/man/man8/ip.8
+++ b/man/man8/ip.8
@@ -34,7 +34,7 @@ ip \- show / manipulate routing, network devices, interfaces 
and tunnels
 \fB\-r\fR[\fIesolve\fR] |
 \fB\-iec\fR |
 \fB\-f\fR[\fIamily\fR] {
-.BR inet " | " inet6 " | " ipx " | " dnet " | " link " } | "
+.BR inet " | " inet6 " | " dnet " | " link " } | "
 \fB-4\fR |
 \fB-6\fR |
 \fB-I\fR |
@@ -94,7 +94,7 @@ Zero (0) means loop until all addresses are removed.
 .TP
 .BR "\-f" , " \-family " <FAMILY>
 Specifies the protocol family to use. The protocol family identifier can be 
one of
-.BR "inet" , " inet6" , " bridge" , " ipx" , " dnet" , " mpls"
+.BR "inet" , " inet6" , " bridge" ,  " dnet" , " mpls"
 or
 .BR link .
 If this option is not present,
@@ -130,11 +130,6 @@ shortcut for
 shortcut for
 .BR "\-family decnet" .
 
-.TP
-.B \-I
-shortcut for
-.BR "\-family ipx" .
-
 .TP
 .B \-M
 shortcut for
-- 
2.17.1

Reply via email to