drop support for IPX

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
Stephen Hemminger 2018-11-15 11:26:13 -08:00 committed by David Ahern
parent 27f4e51003
commit ce5071eda6
9 changed files with 5 additions and 195 deletions

View File

@ -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

View File

@ -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
@ -204,9 +197,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);

View File

@ -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) {

View File

@ -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"

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1000,8 +1000,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, } };

View File

@ -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 " [ "

View File

@ -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