summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2014-03-14 02:58:48 +0000
committerglebius <glebius@FreeBSD.org>2014-03-14 02:58:48 +0000
commitd494babace1c51efd0d2c4582515a1e1ae5fa9d2 (patch)
tree289644ca4a3bc9d349466888b297c5a34d00e321
parenta4fb4957a59109b80df9cabe72982fd067c6f5d1 (diff)
downloadFreeBSD-src-d494babace1c51efd0d2c4582515a1e1ae5fa9d2.zip
FreeBSD-src-d494babace1c51efd0d2c4582515a1e1ae5fa9d2.tar.gz
Remove IPX support.
IPX was a network transport protocol in Novell's NetWare network operating system from late 80s and then 90s. The NetWare itself switched to TCP/IP as default transport in 1998. Later, in this century the Novell Open Enterprise Server became successor of Novell NetWare. The last release that claimed to still support IPX was OES 2 in 2007. Routing equipment vendors (e.g. Cisco) discontinued support for IPX in 2011. Thus, IPX won't be supported in FreeBSD 11.0-RELEASE.
-rw-r--r--Makefile.inc16
-rw-r--r--ObsoleteFiles.inc24
-rw-r--r--contrib/mdocml/lib.in1
-rw-r--r--etc/defaults/rc.conf4
-rw-r--r--etc/mtree/BSD.include.dist2
-rw-r--r--etc/network.subr57
-rw-r--r--etc/nsmb.conf2
-rw-r--r--etc/rc.d/Makefile5
-rwxr-xr-xetc/rc.d/ipxrouted19
-rwxr-xr-xetc/rc.d/routing33
-rw-r--r--gnu/usr.bin/groff/tmac/fr.ISO8859-11
-rw-r--r--gnu/usr.bin/groff/tmac/ru.KOI8-R1
-rw-r--r--include/Makefile9
-rw-r--r--lib/Makefile5
-rw-r--r--lib/libipx/Makefile11
-rw-r--r--lib/libipx/ipx.3125
-rw-r--r--lib/libipx/ipx_addr.c227
-rw-r--r--lib/libipx/ipx_ntoa.c99
-rw-r--r--release/picobsd/bridge/crunch.conf1
-rw-r--r--release/picobsd/qemu/crunch.conf1
-rw-r--r--rescue/rescue/Makefile3
-rw-r--r--sbin/ifconfig/Makefile5
-rw-r--r--sbin/ifconfig/af_ipx.c118
-rw-r--r--sbin/ifconfig/ifconfig.810
-rw-r--r--sbin/ifconfig/ifconfig.c15
-rw-r--r--sbin/route/route.81
-rw-r--r--share/man/man4/Makefile1
-rw-r--r--share/man/man4/ef.4111
-rw-r--r--share/man/man4/netgraph.42
-rw-r--r--share/man/man4/ng_iface.44
-rw-r--r--share/man/man5/nsmb.conf.59
-rw-r--r--share/man/man5/rc.conf.521
-rw-r--r--share/man/man5/src.conf.518
-rw-r--r--share/man/man7/hier.72
-rw-r--r--share/man/man9/netisr.92
-rw-r--r--share/mk/bsd.libnames.mk3
-rw-r--r--share/mk/bsd.own.mk2
-rw-r--r--sys/Makefile2
-rw-r--r--sys/amd64/amd64/machdep.c1
-rw-r--r--sys/conf/NOTES10
-rw-r--r--sys/conf/files11
-rw-r--r--sys/conf/options5
-rw-r--r--sys/i386/i386/machdep.c1
-rw-r--r--sys/kern/Make.tags.inc2
-rw-r--r--sys/kern/kern_jail.c6
-rw-r--r--sys/mips/rmi/rootfs_list.txt2
-rw-r--r--sys/modules/Makefile1
-rw-r--r--sys/modules/arcnet/Makefile5
-rw-r--r--sys/modules/if_ef/Makefile36
-rw-r--r--sys/modules/if_tun/Makefile5
-rw-r--r--sys/modules/netgraph/iface/Makefile5
-rw-r--r--sys/modules/smbfs/Makefile11
-rw-r--r--sys/modules/sppp/Makefile5
-rw-r--r--sys/modules/wlan/Makefile4
-rw-r--r--sys/net/if_arcsubr.c42
-rw-r--r--sys/net/if_ef.c603
-rw-r--r--sys/net/if_ethersubr.c54
-rw-r--r--sys/net/if_fddisubr.c43
-rw-r--r--sys/net/if_iso88025subr.c68
-rw-r--r--sys/net/if_loop.c12
-rw-r--r--sys/net/if_spppfr.c16
-rw-r--r--sys/net/if_spppsubr.c26
-rw-r--r--sys/net/if_tun.c6
-rw-r--r--sys/net/if_types.h1
-rw-r--r--sys/net/netisr.h2
-rw-r--r--sys/net/rtsock.c7
-rw-r--r--sys/net80211/ieee80211_ioctl.c24
-rw-r--r--sys/netgraph/ng_cisco.c4
-rw-r--r--sys/netgraph/ng_iface.c9
-rw-r--r--sys/netgraph/ng_iface.h1
-rw-r--r--sys/netgraph/ng_ksocket.c3
-rw-r--r--sys/netinet/in_proto.c1
-rw-r--r--sys/netipx/README41
-rw-r--r--sys/netipx/ipx.c457
-rw-r--r--sys/netipx/ipx.h194
-rw-r--r--sys/netipx/ipx_cksum.c140
-rw-r--r--sys/netipx/ipx_if.h129
-rw-r--r--sys/netipx/ipx_input.c469
-rw-r--r--sys/netipx/ipx_outputfl.c288
-rw-r--r--sys/netipx/ipx_pcb.c429
-rw-r--r--sys/netipx/ipx_pcb.h150
-rw-r--r--sys/netipx/ipx_proto.c159
-rw-r--r--sys/netipx/ipx_usrreq.c687
-rw-r--r--sys/netipx/ipx_var.h129
-rw-r--r--sys/netipx/spx.h210
-rw-r--r--sys/netipx/spx_debug.c196
-rw-r--r--sys/netipx/spx_debug.h103
-rw-r--r--sys/netipx/spx_reass.c451
-rw-r--r--sys/netipx/spx_timer.h149
-rw-r--r--sys/netipx/spx_usrreq.c1793
-rw-r--r--sys/netipx/spx_var.h160
-rw-r--r--sys/netsmb/netbios.h6
-rw-r--r--sys/pc98/pc98/machdep.c1
-rw-r--r--sys/security/mac_biba/mac_biba.c2
-rw-r--r--sys/security/mac_lomac/mac_lomac.c2
-rw-r--r--sys/sys/param.h2
-rw-r--r--sys/sys/priv.h6
-rw-r--r--tools/bsdbox/Makefile3
-rw-r--r--tools/bsdbox/Makefile.net2
-rw-r--r--tools/build/mk/OptionalObsoleteFiles.inc19
-rw-r--r--tools/build/options/WITHOUT_IPX2
-rw-r--r--tools/build/options/WITHOUT_IPX_SUPPORT2
-rw-r--r--tools/regression/netipx/README11
-rw-r--r--tools/regression/netipx/ipxdgramloopback/Makefile12
-rw-r--r--tools/regression/netipx/ipxdgramloopback/ipxdgramloopback.c118
-rw-r--r--tools/regression/netipx/ipxsocket/Makefile8
-rw-r--r--tools/regression/netipx/ipxsocket/ipxsocket.c93
-rw-r--r--tools/regression/netipx/spxabort/Makefile12
-rw-r--r--tools/regression/netipx/spxabort/spxabort.c96
-rw-r--r--tools/regression/netipx/spxloopback/Makefile12
-rw-r--r--tools/regression/netipx/spxloopback/spxloopback.c237
-rw-r--r--tools/tools/nanobsd/gateworks/common1
-rw-r--r--usr.bin/kdump/kdump.c17
-rw-r--r--usr.bin/netstat/Makefile7
-rw-r--r--usr.bin/netstat/if.c18
-rw-r--r--usr.bin/netstat/ipx.c350
-rw-r--r--usr.bin/netstat/main.c117
-rw-r--r--usr.bin/netstat/netstat.16
-rw-r--r--usr.bin/netstat/netstat.h10
-rw-r--r--usr.bin/netstat/route.c119
-rw-r--r--usr.sbin/IPXrouted/IPXrouted.8224
-rw-r--r--usr.sbin/IPXrouted/Makefile11
-rw-r--r--usr.sbin/IPXrouted/af.c294
-rw-r--r--usr.sbin/IPXrouted/af.h77
-rw-r--r--usr.sbin/IPXrouted/defs.h108
-rw-r--r--usr.sbin/IPXrouted/if.c151
-rw-r--r--usr.sbin/IPXrouted/input.c304
-rw-r--r--usr.sbin/IPXrouted/interface.h95
-rw-r--r--usr.sbin/IPXrouted/main.c401
-rw-r--r--usr.sbin/IPXrouted/output.c231
-rw-r--r--usr.sbin/IPXrouted/protocol.h92
-rw-r--r--usr.sbin/IPXrouted/sap.h108
-rw-r--r--usr.sbin/IPXrouted/sap_input.c215
-rw-r--r--usr.sbin/IPXrouted/sap_output.c198
-rw-r--r--usr.sbin/IPXrouted/sap_tables.c321
-rw-r--r--usr.sbin/IPXrouted/startup.c278
-rw-r--r--usr.sbin/IPXrouted/table.h115
-rw-r--r--usr.sbin/IPXrouted/tables.c419
-rw-r--r--usr.sbin/IPXrouted/timer.c239
-rw-r--r--usr.sbin/IPXrouted/trace.c520
-rw-r--r--usr.sbin/IPXrouted/trace.h138
-rw-r--r--usr.sbin/Makefile4
142 files changed, 91 insertions, 14071 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 000bec6..00f60e1 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1486,7 +1486,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_lib_atf} \
lib/libbz2 ${_libcom_err} lib/libcrypt \
lib/libelf lib/libexpat \
- ${_lib_libgssapi} ${_lib_libipx} \
+ ${_lib_libgssapi} \
lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
${_lib_libcapsicum} \
lib/ncurses/ncurses lib/ncurses/ncursesw \
@@ -1588,10 +1588,6 @@ kerberos5/lib/libheimsqlite__L: lib/libthr__L
_lib_libgssapi= lib/libgssapi
.endif
-.if ${MK_IPX} != "no"
-_lib_libipx= lib/libipx
-.endif
-
.if ${MK_KERBEROS} != "no"
_kerberos5_lib= kerberos5/lib
_kerberos5_lib_libasn1= kerberos5/lib/libasn1
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 4c91184..2a0bb67 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -38,6 +38,30 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20140314: Remove IPX/SPX
+OLD_LIBS+=lib/libipx.so.5
+OLD_FILES+=usr/include/netipx/ipx.h
+OLD_FILES+=usr/include/netipx/ipx_if.h
+OLD_FILES+=usr/include/netipx/ipx_pcb.h
+OLD_FILES+=usr/include/netipx/ipx_var.h
+OLD_FILES+=usr/include/netipx/spx.h
+OLD_FILES+=usr/include/netipx/spx_debug.h
+OLD_FILES+=usr/include/netipx/spx_timer.h
+OLD_FILES+=usr/include/netipx/spx_var.h
+OLD_DIRS+=usr/include/netipx
+OLD_FILES+=usr/lib/libipx.a
+OLD_FILES+=usr/lib/libipx.so
+OLD_FILES+=usr/lib/libipx_p.a
+OLD_FILES+=usr/lib32/libipx.a
+OLD_FILES+=usr/lib32/libipx.so
+OLD_LIBS+=usr/lib32/libipx.so.5
+OLD_FILES+=usr/lib32/libipx_p.a
+OLD_FILES+=usr/sbin/IPXrouted
+OLD_FILES+=usr/share/man/man3/ipx.3.gz
+OLD_FILES+=usr/share/man/man3/ipx_addr.3.gz
+OLD_FILES+=usr/share/man/man3/ipx_ntoa.3.gz
+OLD_FILES+=usr/share/man/man8/IPXrouted.8.gz
+
# 20140223: Remove libyaml
OLD_FILES+=usr/lib/private/libyaml.a
OLD_FILES+=usr/lib/private/libyaml.so
diff --git a/contrib/mdocml/lib.in b/contrib/mdocml/lib.in
index 6e7bb78..81cb560 100644
--- a/contrib/mdocml/lib.in
+++ b/contrib/mdocml/lib.in
@@ -59,7 +59,6 @@ LINE("libhammer", "HAMMER Filesystem Userland Library (libhammer, \\-lhammer)")
LINE("libi386", "i386 Architecture Library (libi386, \\-li386)")
LINE("libintl", "Internationalized Message Handling Library (libintl, \\-lintl)")
LINE("libipsec", "IPsec Policy Control Library (libipsec, \\-lipsec)")
-LINE("libipx", "IPX Address Conversion Support Library (libipx, \\-lipx)")
LINE("libiscsi", "iSCSI protocol library (libiscsi, \\-liscsi)")
LINE("libisns", "Internet Storage Name Service Library (libisns, \\-lisns)")
LINE("libjail", "Jail Library (libjail, \\-ljail)")
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index 4b9714e..0d4b742 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -212,7 +212,6 @@ cloned_interfaces="" # List of cloned network interfaces to create.
#cloned_interfaces="gif0 gif1 gif2 gif3" # Pre-cloning GENERIC config.
#ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
#ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
-#ifconfig_ed0_ipx="ipx 0x00010010" # Sample IPX address family entry.
#ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry
#ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" # Sample IPv6 alias
#ifconfig_fxp0_name="net0" # Change interface name from fxp0 to net0.
@@ -382,9 +381,6 @@ mrouted_program="/usr/local/sbin/mrouted" # Name of IPv4 multicast
# install it from package or
# port.
mrouted_flags="" # Flags for multicast routing daemon.
-ipxgateway_enable="NO" # Set to YES to enable IPX routing.
-ipxrouted_enable="NO" # Set to YES to run the IPX routing daemon.
-ipxrouted_flags="" # Flags for IPX routing daemon.
arpproxy_all="NO" # replaces obsolete kernel option ARP_PROXYALL.
forward_sourceroute="NO" # do source routing (only if gateway_enable is set to "YES")
accept_sourceroute="NO" # accept source routed packets to us
diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist
index 19f4d33..aa53b97 100644
--- a/etc/mtree/BSD.include.dist
+++ b/etc/mtree/BSD.include.dist
@@ -275,8 +275,6 @@
..
netipsec
..
- netipx
- ..
netnatm
api
..
diff --git a/etc/network.subr b/etc/network.subr
index de9d997..474e479 100644
--- a/etc/network.subr
+++ b/etc/network.subr
@@ -51,7 +51,6 @@ ifn_start()
if ! noafif $ifn; then
afexists inet && ipv4_up ${ifn} && cfg=0
afexists inet6 && ipv6_up ${ifn} && cfg=0
- afexists ipx && ipx_up ${ifn} && cfg=0
fi
childif_create ${ifn} && cfg=0
@@ -71,7 +70,6 @@ ifn_stop()
[ -z "$ifn" ] && err 1 "ifn_stop called without an interface"
if ! noafif $ifn; then
- afexists ipx && ipx_down ${ifn} && cfg=0
afexists inet6 && ipv6_down ${ifn} && cfg=0
afexists inet && ipv4_down ${ifn} && cfg=0
fi
@@ -495,9 +493,6 @@ afexists()
inet|inet6)
check_kern_features ${_af}
;;
- ipx)
- ${SYSCTL_N} net.ipx > /dev/null 2>&1
- ;;
atm)
if [ -x /sbin/atmconfig ]; then
/sbin/atmconfig diag list > /dev/null 2>&1
@@ -1096,7 +1091,6 @@ ifalias_af_common()
case $ifconfig_args in
inet\ *) _iaf=inet ;;
inet6\ *) _iaf=inet6 ;;
- ipx\ *) _iaf=ipx ;;
link\ *) _iaf=link ;;
ether\ *) _iaf=ether ;;
esac
@@ -1146,7 +1140,7 @@ ifalias_af_common()
_tmpargs=
for _c in `get_if_var $_if ifconfig_IF_aliases` $_aliasn; do
case $_c in
- inet|inet6|ipx|link|ether)
+ inet|inet6|link|ether)
case $_tmpargs in
${_af}\ *)
eval ifalias_af_common_handler $_if $_af $_action $_tmpargs && _ret=0
@@ -1520,55 +1514,6 @@ ng_create_one()
done
}
-# ipx_up ifn
-# Configure any IPX addresses for interface $ifn. Returns 0 if
-# IPX arguments were found and configured; returns 1 otherwise.
-#
-ipx_up()
-{
- local ifn
- ifn="$1"
-
- # ifconfig_IF_ipx
- ifconfig_args=`_ifconfig_getargs $ifn ipx`
- if [ -n "${ifconfig_args}" ]; then
- ${IFCONFIG_CMD} ${ifn} ${ifconfig_args}
- return 0
- fi
-
- return 1
-}
-
-# ipx_down ifn
-# Remove IPX addresses for interface $ifn. Returns 0 if IPX
-# addresses were found and unconfigured. It returns 1, otherwise.
-#
-ipx_down()
-{
- local _if _ifs _ret ipxList oldifs _ipx
- _if=$1
- _ifs="^"
- _ret=1
- ipxList="`${IFCONFIG_CMD} ${_if} | grep 'ipx ' | tr "\n" "$_ifs"`"
- oldifs="$IFS"
-
- IFS="$_ifs"
- for _ipx in $ipxList ; do
- # get rid of extraneous line
- [ -z "$_ipx" ] && break
-
- _ipx=`expr "$_ipx" : '.*\(ipx [0-9a-h]\{1,8\}H*\.[0-9a-h]\{1,12\}\).*'`
-
- IFS="$oldifs"
- ${IFCONFIG_CMD} ${_if} ${_ipx} delete
- IFS="$_ifs"
- _ret=0
- done
- IFS="$oldifs"
-
- return $_ret
-}
-
# ifnet_rename [ifname]
# Rename interfaces if ifconfig_IF_name is defined.
#
diff --git a/etc/nsmb.conf b/etc/nsmb.conf
index e5f2258..531d094 100644
--- a/etc/nsmb.conf
+++ b/etc/nsmb.conf
@@ -29,7 +29,7 @@
#
# keyword/section A B C D Comment
#
-# addr - + - - IP or IPX address of SMB server
+# addr - + - - IP address of SMB server
# charsets + + + + local:remote charset pair
# nbns + + - - address of NetBIOS name server (WINS)
# nbscope + + - - NetBIOS scope
diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile
index cc52316..6c6801b 100644
--- a/etc/rc.d/Makefile
+++ b/etc/rc.d/Makefile
@@ -63,7 +63,6 @@ FILES= DAEMON \
ipmon \
ipnat \
ipsec \
- ${_ipxrouted} \
iscsictl \
iscsid \
jail \
@@ -165,10 +164,6 @@ FILES= DAEMON \
zfs \
zvol
-.if ${MK_IPX} != "no"
-_ipxrouted= ipxrouted
-.endif
-
.if ${MK_OFED} != "no"
_opensm= opensm
.endif
diff --git a/etc/rc.d/ipxrouted b/etc/rc.d/ipxrouted
deleted file mode 100755
index dcca91d..0000000
--- a/etc/rc.d/ipxrouted
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-# PROVIDE: ipxrouted
-# REQUIRE: SERVERS
-# BEFORE: DAEMON
-# KEYWORD: nojail
-
-. /etc/rc.subr
-
-name="ipxrouted"
-rcvar="ipxrouted_enable"
-command="/usr/sbin/IPXrouted"
-command_args="> /dev/null 2>&1"
-
-load_rc_config $name
-run_rc_command "$1"
diff --git a/etc/rc.d/routing b/etc/rc.d/routing
index 284aa7d..c37c706 100755
--- a/etc/rc.d/routing
+++ b/etc/rc.d/routing
@@ -33,7 +33,7 @@ routing_start()
esac
case $_af in
- inet|inet6|ipx|atm)
+ inet|inet6|atm)
if afexists $_af; then
setroutes $_cmd $_af $_if
else
@@ -41,7 +41,7 @@ routing_start()
fi
;;
""|[Aa][Ll][Ll]|[Aa][Nn][Yy])
- for _a in inet inet6 ipx atm; do
+ for _a in inet inet6 atm; do
afexists $_a && setroutes $_cmd $_a $_if
done
;;
@@ -62,7 +62,7 @@ routing_stop()
esac
case $_af in
- inet|inet6|ipx|atm)
+ inet|inet6|atm)
if afexists $_af; then
eval static_${_af} delete $_if
# When $_if is specified, do not flush routes.
@@ -74,7 +74,7 @@ routing_stop()
fi
;;
""|[Aa][Ll][Ll]|[Aa][Nn][Yy])
- for _a in inet inet6 ipx atm; do
+ for _a in inet inet6 atm; do
afexists $_a || continue
eval static_${_a} delete $_if
# When $_if is specified, do not flush routes.
@@ -127,11 +127,6 @@ routing_stop_atm()
return 0
}
-routing_stop_ipx()
-{
- return 0
-}
-
static_inet()
{
local _action _if _skip
@@ -290,11 +285,6 @@ static_atm()
fi
}
-static_ipx()
-{
- :
-}
-
ropts_init()
{
if [ -z "${_ropts_initdone}" ]; then
@@ -387,20 +377,5 @@ options_atm()
[ -n "${_ropts_initdone}" ] && echo '.'
}
-options_ipx()
-{
- _ropts_initdone=
-
- if checkyesno ipxgateway_enable; then
- ropts_init ipx
- echo -n ' gateway=YES'
- ${SYSCTL} net.ipx.ipx.ipxforwarding=1 > /dev/null
- else
- ${SYSCTL} net.ipx.ipx.ipxforwarding=0 > /dev/null
- fi
-
- [ -n "${_ropts_initdone}" ] && echo '.'
-}
-
load_rc_config $name
run_rc_command "$@"
diff --git a/gnu/usr.bin/groff/tmac/fr.ISO8859-1 b/gnu/usr.bin/groff/tmac/fr.ISO8859-1
index 88dda0d..2ec54f5 100644
--- a/gnu/usr.bin/groff/tmac/fr.ISO8859-1
+++ b/gnu/usr.bin/groff/tmac/fr.ISO8859-1
@@ -86,7 +86,6 @@
.\" XXX ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem (libgeom, \-lgeom)
.ds doc-str-Lb-libi386 Bibliothèque de l'architecture i386 (libi386, \-li386)
.ds doc-str-Lb-libipsec Bibliothèque de contrôle de politique IPsec (libipsec, \-lipsec)
-.ds doc-str-Lb-libipx Bibliothèque de support des conversions des adresses IPX (libipx, \-lipx)
.ds doc-str-Lb-libkvm Bibliothèque d'accès aux données du noyau (libkvm, \-lkvm)
.ds doc-str-Lb-libm Bibliothèque mathématique (libm, \-lm)
.ds doc-str-Lb-libmd Bibliothèque de support des signatures (MD4, MD5, etc.) (libmd, \-lmd)
diff --git a/gnu/usr.bin/groff/tmac/ru.KOI8-R b/gnu/usr.bin/groff/tmac/ru.KOI8-R
index 0d3eb0f..4ae5697 100644
--- a/gnu/usr.bin/groff/tmac/ru.KOI8-R
+++ b/gnu/usr.bin/groff/tmac/ru.KOI8-R
@@ -86,7 +86,6 @@
.ds doc-str-Lb-libgeom ðÏÌØÚÏ×ÁÔÅÌØÓËÁÑ API ÂÉÂÌÉÏÔÅËÁ ÐÏÄÓÉÓÔÅÍÙ ÑÄÒÁ GEOM (libgeom, \-lgeom)
.ds doc-str-Lb-libi386 âÉÂÌÉÏÔÅËÁ ÁÒÈÉÔÅËÔÕÒÙ i386 (libi386, \-li386)
.ds doc-str-Lb-libipsec âÉÂÌÉÏÔÅËÁ ÕÐÒÁ×ÌÅÎÉÑ IPsec Policy (libipsec, \-lipsec)
-.ds doc-str-Lb-libipx âÉÂÌÉÏÔÅËÁ ÐÏÄÄÅÒÖËÉ ËÏÎ×ÅÒÓÉÉ ÁÄÒÅÓÏ× IPX (libipx, \-lipx)
.ds doc-str-Lb-libkvm âÉÂÌÉÏÔÅËÁ ÄÏÓÔÕÐÁ Ë ÄÁÎÎÙÍ ÑÄÒÁ (libkvm, \-lkvm)
.ds doc-str-Lb-libm âÉÂÌÉÏÔÅËÁ ÍÁÔÅÍÁÔÉÞÅÓËÉÈ ÆÕÎËÃÉÊ (libm, \-lm)
.\" XXX ds doc-str-Lb-libmd Message Digest (MD4, MD5, É Ô.Ä.) Support Library (libmd, \-lmd)
diff --git a/include/Makefile b/include/Makefile
index 5ec7af7..1e1eb17 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -37,9 +37,7 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
syslog.h ucontext.h
LDIRS= bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
- netipsec ${_netipx} netnatm netsmb \
- nfs nfsclient nfsserver \
- sys vm
+ netipsec netnatm netsmb nfs nfsclient nfsserver sys vm
LSUBDIRS= cam/ata cam/scsi \
dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
@@ -76,11 +74,6 @@ INCS+= hesiod.h
LSUBSUBDIRS+= netgraph/bluetooth/include
.endif
-# XXX unconditionally needed by <netsmb/netbios.h>
-#.if ${MK_IPX} != "no"
-_netipx= netipx
-#.endif
-
# Handle the #define aliases for libiconv
.if ${MK_ICONV} == "yes"
INCS+= iconv.h
diff --git a/lib/Makefile b/lib/Makefile
index 98db7f2..41eb9b5 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -88,7 +88,6 @@ SUBDIR= ${SUBDIR_ORDERED} \
${_libgssapi} \
${_librpcsec_gss} \
libipsec \
- ${_libipx} \
libjail \
libkiconv \
liblzma \
@@ -183,10 +182,6 @@ _librpcsec_gss= librpcsec_gss
_libiconv_modules= libiconv_modules
.endif
-.if ${MK_IPX} != "no"
-_libipx= libipx
-.endif
-
.if ${MK_LDNS} != "no"
_libldns= libldns
.endif
diff --git a/lib/libipx/Makefile b/lib/libipx/Makefile
deleted file mode 100644
index b816ba3..0000000
--- a/lib/libipx/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $FreeBSD$
-
-LIB= ipx
-SHLIBDIR?= /lib
-SRCS= ipx_addr.c ipx_ntoa.c
-MAN= ipx.3
-MLINKS+=ipx.3 ipx_addr.3 ipx.3 ipx_ntoa.3
-
-WARNS?= 2
-
-.include <bsd.lib.mk>
diff --git a/lib/libipx/ipx.3 b/lib/libipx/ipx.3
deleted file mode 100644
index ab6de2d..0000000
--- a/lib/libipx/ipx.3
+++ /dev/null
@@ -1,125 +0,0 @@
-.\" Copyright (c) 1986, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt IPX 3
-.Os
-.Sh NAME
-.Nm ipx_addr ,
-.Nm ipx_ntoa
-.Nd IPX address conversion routines
-.Sh LIBRARY
-.Lb libipx
-.Sh SYNOPSIS
-.In sys/types.h
-.In netipx/ipx.h
-.Ft struct ipx_addr
-.Fn ipx_addr "const char *cp"
-.Ft char *
-.Fn ipx_ntoa "struct ipx_addr ipx"
-.Sh DESCRIPTION
-The routine
-.Fn ipx_addr
-interprets character strings representing
-.Tn IPX
-addresses, returning binary information suitable
-for use in system calls.
-The routine
-.Fn ipx_ntoa
-takes
-.Tn IPX
-addresses and returns
-.Tn ASCII
-strings representing the address in a
-notation in common use:
-.Bd -ragged -offset indent
-<network number>.<host number>.<port number>
-.Ed
-.Pp
-Trailing zero fields are suppressed, and each number is printed in hexadecimal,
-in a format suitable for input to
-.Fn ipx_addr .
-Any fields lacking super-decimal digits will have a
-trailing
-.Ql H
-appended.
-.Pp
-An effort has been made to ensure that
-.Fn ipx_addr
-be compatible with most formats in common use.
-It will first separate an address into 1 to 3 fields using a single delimiter
-chosen from
-period
-.Ql \&. ,
-colon
-.Ql \&:
-or pound-sign
-.Ql \&# .
-Each field is then examined for byte separators (colon or period).
-If there are byte separators, each subfield separated is taken to be
-a small hexadecimal number, and the entirety is taken as a network-byte-ordered
-quantity to be zero extended in the high-network-order bytes.
-Next, the field is inspected for hyphens, in which case
-the field is assumed to be a number in decimal notation
-with hyphens separating the millennia.
-Next, the field is assumed to be a number:
-It is interpreted
-as hexadecimal if there is a leading
-.Ql 0x
-(as in C),
-a trailing
-.Ql H
-(as in Mesa), or there are any super-decimal digits present.
-It is interpreted as octal if there is a leading
-.Ql 0
-and there are no super-octal digits.
-Otherwise, it is converted as a decimal number.
-.Sh RETURN VALUES
-None.
-(See
-.Sx BUGS . )
-.Sh SEE ALSO
-.\" .Xr ns 4 ,
-.Xr hosts 5 ,
-.Xr networks 5
-.Sh HISTORY
-The precursor
-.Fn ns_addr
-and
-.Fn ns_toa
-functions appeared in
-.Bx 4.3 .
-.Sh BUGS
-The string returned by
-.Fn ipx_ntoa
-resides in a static memory area.
-The function
-.Fn ipx_addr
-should diagnose improperly formed input, and there should be an unambiguous
-way to recognize this.
diff --git a/lib/libipx/ipx_addr.c b/lib/libipx/ipx_addr.c
deleted file mode 100644
index 6d48b59..0000000
--- a/lib/libipx/ipx_addr.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (c) 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * J.Q. Johnson.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ipx_addr.c";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/param.h>
-#include <arpa/inet.h>
-#include <netipx/ipx.h>
-#include <stdio.h>
-#include <string.h>
-
-static struct ipx_addr addr, zero_addr;
-
-static void Field(), cvtbase();
-
-struct ipx_addr
-ipx_addr(name)
- const char *name;
-{
- char separator;
- char *hostname, *socketname, *cp;
- char buf[50];
-
- (void)strncpy(buf, name, sizeof(buf) - 1);
- buf[sizeof(buf) - 1] = '\0';
-
- /*
- * First, figure out what he intends as a field separator.
- * Despite the way this routine is written, the preferred
- * form 2-272.AA001234H.01777, i.e. XDE standard.
- * Great efforts are made to ensure backwards compatibility.
- */
- if ( (hostname = strchr(buf, '#')) )
- separator = '#';
- else {
- hostname = strchr(buf, '.');
- if ((cp = strchr(buf, ':')) &&
- ((hostname && cp < hostname) || (hostname == 0))) {
- hostname = cp;
- separator = ':';
- } else
- separator = '.';
- }
- if (hostname)
- *hostname++ = 0;
-
- addr = zero_addr;
- Field(buf, addr.x_net.c_net, 4);
- if (hostname == 0)
- return (addr); /* No separator means net only */
-
- socketname = strchr(hostname, separator);
- if (socketname) {
- *socketname++ = 0;
- Field(socketname, (u_char *)&addr.x_port, 2);
- }
-
- Field(hostname, addr.x_host.c_host, 6);
-
- return (addr);
-}
-
-static void
-Field(buf, out, len)
- char *buf;
- u_char *out;
- int len;
-{
- char *bp = buf;
- int i, ibase, base16 = 0, base10 = 0, clen = 0;
- int hb[6], *hp;
- char *fmt;
-
- /*
- * first try 2-273#2-852-151-014#socket
- */
- if ((*buf != '-') &&
- (1 < (i = sscanf(buf, "%d-%d-%d-%d-%d",
- &hb[0], &hb[1], &hb[2], &hb[3], &hb[4])))) {
- cvtbase(1000L, 256, hb, i, out, len);
- return;
- }
- /*
- * try form 8E1#0.0.AA.0.5E.E6#socket
- */
- if (1 < (i = sscanf(buf,"%x.%x.%x.%x.%x.%x",
- &hb[0], &hb[1], &hb[2], &hb[3], &hb[4], &hb[5]))) {
- cvtbase(256L, 256, hb, i, out, len);
- return;
- }
- /*
- * try form 8E1#0:0:AA:0:5E:E6#socket
- */
- if (1 < (i = sscanf(buf,"%x:%x:%x:%x:%x:%x",
- &hb[0], &hb[1], &hb[2], &hb[3], &hb[4], &hb[5]))) {
- cvtbase(256L, 256, hb, i, out, len);
- return;
- }
- /*
- * This is REALLY stretching it but there was a
- * comma notation separating shorts -- definitely non-standard
- */
- if (1 < (i = sscanf(buf,"%x,%x,%x",
- &hb[0], &hb[1], &hb[2]))) {
- hb[0] = htons(hb[0]); hb[1] = htons(hb[1]);
- hb[2] = htons(hb[2]);
- cvtbase(65536L, 256, hb, i, out, len);
- return;
- }
-
- /* Need to decide if base 10, 16 or 8 */
- while (*bp) switch (*bp++) {
-
- case '0': case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '-':
- break;
-
- case '8': case '9':
- base10 = 1;
- break;
-
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- base16 = 1;
- break;
-
- case 'x': case 'X':
- *--bp = '0';
- base16 = 1;
- break;
-
- case 'h': case 'H':
- base16 = 1;
- /* FALLTHROUGH */
-
- default:
- *--bp = 0; /* Ends Loop */
- }
- if (base16) {
- fmt = "%3x";
- ibase = 4096;
- } else if (base10 == 0 && *buf == '0') {
- fmt = "%3o";
- ibase = 512;
- } else {
- fmt = "%3d";
- ibase = 1000;
- }
-
- for (bp = buf; *bp++; ) clen++;
- if (clen == 0) clen++;
- if (clen > 18) clen = 18;
- i = ((clen - 1) / 3) + 1;
- bp = clen + buf - 3;
- hp = hb + i - 1;
-
- while (hp > hb) {
- (void)sscanf(bp, fmt, hp);
- bp[0] = 0;
- hp--;
- bp -= 3;
- }
- (void)sscanf(buf, fmt, hp);
- cvtbase((long)ibase, 256, hb, i, out, len);
-}
-
-static void
-cvtbase(oldbase,newbase,input,inlen,result,reslen)
- long oldbase;
- int newbase;
- int input[];
- int inlen;
- unsigned char result[];
- int reslen;
-{
- int d, e;
- long sum;
-
- e = 1;
- while (e > 0 && reslen > 0) {
- d = 0; e = 0; sum = 0;
- /* long division: input=input/newbase */
- while (d < inlen) {
- sum = sum*oldbase + (long) input[d];
- e += (sum > 0);
- input[d++] = sum / newbase;
- sum %= newbase;
- }
- result[--reslen] = sum; /* accumulate remainder */
- }
- for (d=0; d < reslen; d++)
- result[d] = 0;
-}
diff --git a/lib/libipx/ipx_ntoa.c b/lib/libipx/ipx_ntoa.c
deleted file mode 100644
index a33b807..0000000
--- a/lib/libipx/ipx_ntoa.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ipx_ntoa.c";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/param.h>
-#include <arpa/inet.h>
-#include <netipx/ipx.h>
-#include <stdio.h>
-
-static char *spectHex(char *);
-
-char *
-ipx_ntoa(addr)
- struct ipx_addr addr;
-{
- static char obuf[40];
- union { union ipx_net net_e; u_long long_e; } net;
- u_short port = htons(addr.x_port);
- char *cp;
- char *cp2;
- u_char *up = addr.x_host.c_host;
- u_char *uplim = up + 6;
-
- net.net_e = addr.x_net;
- sprintf(obuf, "%lx", (u_long)ntohl(net.long_e));
- cp = spectHex(obuf);
- cp2 = cp + 1;
- while (*up==0 && up < uplim) up++;
- if (up == uplim) {
- if (port) {
- sprintf(cp, ".0");
- cp += 2;
- }
- } else {
- sprintf(cp, ".%x", *up++);
- while (up < uplim) {
- while (*cp) cp++;
- sprintf(cp, "%02x", *up++);
- }
- cp = spectHex(cp2);
- }
- if (port) {
- sprintf(cp, ".%x", port);
- spectHex(cp + 1);
- }
- return (obuf);
-}
-
-static char *
-spectHex(p0)
- char *p0;
-{
- int ok = 0;
- int nonzero = 0;
- char *p = p0;
- for (; *p; p++) switch (*p) {
-
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- ok = 1;
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- nonzero = 1;
- }
- if (nonzero && !ok) { *p++ = 'H'; *p = 0; }
- return (p);
-}
diff --git a/release/picobsd/bridge/crunch.conf b/release/picobsd/bridge/crunch.conf
index 227414b..c525ee1 100644
--- a/release/picobsd/bridge/crunch.conf
+++ b/release/picobsd/bridge/crunch.conf
@@ -31,7 +31,6 @@
buildopts -DWITHOUT_PAM -DRELEASE_CRUNCH -DPPP_NO_NETGRAPH
buildopts -DTRACEROUTE_NO_IPSEC -DNO_INET6
-buildopts -DWITHOUT_IPX
# Directories where to look for sources of various binaries.
# @__CWD__@ is a magic keyword in the picobsd's (Makefile.conf)
diff --git a/release/picobsd/qemu/crunch.conf b/release/picobsd/qemu/crunch.conf
index 5dbb519..3b04340 100644
--- a/release/picobsd/qemu/crunch.conf
+++ b/release/picobsd/qemu/crunch.conf
@@ -31,7 +31,6 @@
buildopts -DWITHOUT_PAM -DRELEASE_CRUNCH -DPPP_NO_NETGRAPH
buildopts -DTRACEROUTE_NO_IPSEC -DNO_INET6
-buildopts -DWITHOUT_IPX
# Directories where to look for sources of various binaries.
# @__CWD__@ is a magic keyword in the picobsd's (Makefile.conf)
diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile
index 80acf63..2fadb72 100644
--- a/rescue/rescue/Makefile
+++ b/rescue/rescue/Makefile
@@ -119,9 +119,6 @@ CRUNCH_PROGS_sbin+= zpool
# CRUNCH_PROGS+= devd
CRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec
-.if ${MK_IPX} != "no"
-CRUNCH_LIBS+= -lipx
-.endif
.if ${MK_ZFS} != "no"
CRUNCH_LIBS+= -lavl -ljail -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem
.endif
diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile
index a10d1fb..7393da4 100644
--- a/sbin/ifconfig/Makefile
+++ b/sbin/ifconfig/Makefile
@@ -53,11 +53,6 @@ CFLAGS+= -DINET6
.if ${MK_INET_SUPPORT} != "no"
CFLAGS+= -DINET
.endif
-.if ${MK_IPX_SUPPORT} != "no" && !defined(RELEASE_CRUNCH)
-SRCS+= af_ipx.c # IPX support
-DPADD+= ${LIBIPX}
-LDADD+= -lipx
-.endif
.if ${MK_JAIL} != "no" && !defined(RELEASE_CRUNCH) && !defined(RESCUE)
CFLAGS+= -DJAIL
DPADD+= ${LIBJAIL}
diff --git a/sbin/ifconfig/af_ipx.c b/sbin/ifconfig/af_ipx.c
deleted file mode 100644
index bc5d500..0000000
--- a/sbin/ifconfig/af_ipx.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <net/if.h>
-
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ifaddrs.h>
-
-#include <net/if_var.h>
-#define IPTUNNEL
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-
-#include "ifconfig.h"
-
-static struct ifaliasreq ipx_addreq;
-static struct ifreq ipx_ridreq;
-
-static void
-ipx_status(int s __unused, const struct ifaddrs *ifa)
-{
- struct sockaddr_ipx *sipx, null_sipx;
-
- sipx = (struct sockaddr_ipx *)ifa->ifa_addr;
- if (sipx == NULL)
- return;
-
- printf("\tipx %s ", ipx_ntoa(sipx->sipx_addr));
-
- if (ifa->ifa_flags & IFF_POINTOPOINT) {
- sipx = (struct sockaddr_ipx *)ifa->ifa_dstaddr;
- if (sipx == NULL) {
- memset(&null_sipx, 0, sizeof(null_sipx));
- sipx = &null_sipx;
- }
- printf("--> %s ", ipx_ntoa(sipx->sipx_addr));
- }
- putchar('\n');
-}
-
-#define SIPX(x) ((struct sockaddr_ipx *) &(x))
-struct sockaddr_ipx *sipxtab[] = {
- SIPX(ipx_ridreq.ifr_addr), SIPX(ipx_addreq.ifra_addr),
- SIPX(ipx_addreq.ifra_mask), SIPX(ipx_addreq.ifra_broadaddr)
-};
-
-static void
-ipx_getaddr(const char *addr, int which)
-{
- struct sockaddr_ipx *sipx = sipxtab[which];
-
- sipx->sipx_family = AF_IPX;
- sipx->sipx_len = sizeof(*sipx);
- sipx->sipx_addr = ipx_addr(addr);
- if (which == MASK)
- printf("Attempt to set IPX netmask will be ineffectual\n");
-}
-
-static void
-ipx_postproc(int s, const struct afswtch *afp)
-{
-
-}
-
-static struct afswtch af_ipx = {
- .af_name = "ipx",
- .af_af = AF_IPX,
- .af_status = ipx_status,
- .af_getaddr = ipx_getaddr,
- .af_postproc = ipx_postproc,
- .af_difaddr = SIOCDIFADDR,
- .af_aifaddr = SIOCAIFADDR,
- .af_ridreq = &ipx_ridreq,
- .af_addreq = &ipx_addreq,
-};
-
-static __constructor void
-ipx_ctor(void)
-{
- af_register(&af_ipx);
-}
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 83065f1..0bf92d7 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -159,12 +159,8 @@ supported are
.Dq inet ,
.Dq inet6 ,
.Dq atalk ,
-.Dq ipx ,
-.\" .Dq iso ,
and
.Dq link .
-.\" and
-.\" .Dq ns .
The default if available is
.Dq inet
or otherwise
@@ -309,12 +305,6 @@ using the
kernel configuration option, or the
.Va net.fibs
tunable.
-.It Cm ipdst
-This is used to specify an Internet host who is willing to receive
-IP packets encapsulating IPX packets bound for a remote network.
-An apparent point to point link is constructed, and
-the address specified will be taken as the IPX address and network
-of the destination.
.It Cm maclabel Ar label
If Mandatory Access Control support is enabled in the kernel,
set the MAC label to
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index eb16aec..d2ddeca 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -741,20 +741,6 @@ setifbroadaddr(const char *addr, int dummy __unused, int s,
}
static void
-setifipdst(const char *addr, int dummy __unused, int s,
- const struct afswtch *afp)
-{
- const struct afswtch *inet;
-
- inet = af_getbyname("inet");
- if (inet == NULL)
- return;
- inet->af_getaddr(addr, DSTADDR);
- clearaddr = 0;
- newaddr = 0;
-}
-
-static void
notealias(const char *addr, int param, int s, const struct afswtch *afp)
{
#define rqtosa(x) (&(((struct ifreq *)(afp->x))->ifr_addr))
@@ -1176,7 +1162,6 @@ static struct cmd basic_cmds[] = {
DEF_CMD_ARG("netmask", setifnetmask),
DEF_CMD_ARG("metric", setifmetric),
DEF_CMD_ARG("broadcast", setifbroadaddr),
- DEF_CMD_ARG("ipdst", setifipdst),
DEF_CMD_ARG2("tunnel", settunnel),
DEF_CMD("-tunnel", 0, deletetunnel),
DEF_CMD("deletetunnel", 0, deletetunnel),
diff --git a/sbin/route/route.8 b/sbin/route/route.8
index 2240038..ecfeac6 100644
--- a/sbin/route/route.8
+++ b/sbin/route/route.8
@@ -487,7 +487,6 @@ The next-hop gateway should be reachable through a different route.
.Xr netintro 4 ,
.Xr route 4 ,
.Xr arp 8 ,
-.Xr IPXrouted 8 ,
.Xr routed 8
.\".Xr XNSrouted 8
.Sh HISTORY
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 753a510..da78bcf 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -122,7 +122,6 @@ MAN= aac.4 \
dummynet.4 \
ed.4 \
edsc.4 \
- ef.4 \
ehci.4 \
em.4 \
en.4 \
diff --git a/share/man/man4/ef.4 b/share/man/man4/ef.4
deleted file mode 100644
index ce07487..0000000
--- a/share/man/man4/ef.4
+++ /dev/null
@@ -1,111 +0,0 @@
-.\"
-.\" Copyright (c) 1999, Boris Popov
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd June 20, 1999
-.Dt EF 4
-.Os
-.Sh NAME
-.Nm ef
-.Nd "pseudo-device driver providing support for multiple Ethernet frame types"
-.Sh SYNOPSIS
-.Cd "device ef"
-.Sh DESCRIPTION
-The
-.Nm
-pseudo-device driver clones each Ethernet type device with four
-additional interfaces.
-Each of them is capable to send or receive only
-one predefined frame type.
-.Pp
-Names for the new interfaces are created by adding a
-.Ar fN
-suffix to an existing device name.
-Where
-.Ar N
-is a device unit which can have one of the following values:
-.Bd -literal -offset indent
-0 interface with an Ethernet_II frame
-1 interface with a Novell Ethernet_802.3 frame
-2 interface with an Ethernet_802.2 frame
-3 interface with an Ethernet_802.2/SNAP frame support.
-.Ed
-.Pp
-For example, device
-.Ar ed0
-will be populated with four devices:
-.Ar ed0f0 ,
-.Ar ed0f1 ,
-.Ar ed0f2
-and
-.Ar ed0f3 .
-.Pp
-After that, each device can be configured as usual:
-.Dl # ifconfig ed0f1 ipx 0x105
-This will configure IPX protocol with network number
-.Ar 0x105
-and
-.Ar Ethernet_802.3
-frame type.
-.Pp
-Please note that it is impossible to configure the IPX protocol on the parent
-.Ar ed0
-device after the
-.Ar if_ef.ko
-driver has been loaded.
-.Pp
-If the parent interface is not configured for any other protocol
-(IP for example), subinterfaces will not function.
-To avoid that, the parent interface should be
-manually marked as
-.Dq up :
-.Dl # ifconfig ed0 up
-.Sh EXAMPLES
-The
-.Nm
-driver can be loaded via the
-.Xr loader.conf 5
-file:
-.Dl if_ef_load="YES"
-.Pp
-In this case, ordinary interface configuration commands can be used
-in the
-.Xr rc.conf 5
-file:
-.Dl network_interfaces="ed2 lo0 tun0 ed2f0 ed2f1"
-.Dl ifconfig_ed2f0_ipx="ipx 0x101"
-.Dl ifconfig_ed2f1_ipx="ipx 0x102"
-.Sh DIAGNOSTICS
-None.
-.Sh SEE ALSO
-.Xr ipx 3 ,
-.Xr ifconfig 8
-.Sh AUTHORS
-.An Boris Popov Aq bp@FreeBSD.org .
-.Sh CAVEATS
-Avoid to configure the parent Ethernet device for the IPX protocol, after the
-.Nm
-driver is loaded.
diff --git a/share/man/man4/netgraph.4 b/share/man/man4/netgraph.4
index 2fafb68..ebc77d1 100644
--- a/share/man/man4/netgraph.4
+++ b/share/man/man4/netgraph.4
@@ -1270,7 +1270,7 @@ sending frames out of the interface.
.It INTERFACE
This node is also a system networking interface.
It has hooks representing
-each protocol family (IP, AppleTalk, IPX, etc.) and appears in the output of
+each protocol family (IP, AppleTalk, etc.) and appears in the output of
.Xr ifconfig 8 .
The interfaces are named
.Dq Li ng0 ,
diff --git a/share/man/man4/ng_iface.4 b/share/man/man4/ng_iface.4
index 1756f9d..a5fd4b6 100644
--- a/share/man/man4/ng_iface.4
+++ b/share/man/man4/ng_iface.4
@@ -70,7 +70,7 @@ Packets transmitted via the interface flow out the corresponding
protocol-specific hook.
Similarly, packets received on a hook appear on the interface as
packets received into the corresponding protocol stack.
-The currently supported protocols are IP, IPv6, AppleTalk, IPX, ATM,
+The currently supported protocols are IP, IPv6, AppleTalk, ATM,
NATM, and NS.
.Pp
An
@@ -90,8 +90,6 @@ Transmission and reception of IP packets.
Transmission and reception of IPv6 packets.
.It Va atalk
Transmission and reception of AppleTalk packets.
-.It Va ipx
-Transmission and reception of IPX packets.
.It Va atm
Transmission and reception of ATM packets.
.It Va natm
diff --git a/share/man/man5/nsmb.conf.5 b/share/man/man5/nsmb.conf.5
index 30fbecd..7e48f60 100644
--- a/share/man/man5/nsmb.conf.5
+++ b/share/man/man5/nsmb.conf.5
@@ -82,7 +82,7 @@ Possible keywords may include:
.Bl -column ".Va retry_count" ".Sy Section"
.It Sy "Keyword Section Comment"
.It Sy " A B C D"
-.It Va addr Ta "- + - -" Ta "IP or IPX address of SMB server"
+.It Va addr Ta "- + - -" Ta "IP address of SMB server"
.It Va charsets Ta "- + + +" Ta "local:remote charset pair"
.It Va nbns Ta "+ + - -" Ta "address of NetBIOS name server (WINS)"
.It Va nbscope Ta "+ + - -" Ta "NetBIOS scope"
@@ -141,13 +141,6 @@ used on a password:
.Bd -literal -offset indent
smbutil crypt
.Ed
-.Sh COMPATIBILITY
-At the time of this writing, the
-.Tn IPX
-protocol remains unsupported.
-Future
-.Fx
-releases are expected to support this.
.Sh SEE ALSO
.Xr smbutil 1 ,
.Xr mount_smbfs 8
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index bb3d26a..2dd713b 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -2845,27 +2845,6 @@ If
is set to
.Dq Li YES
this is the list of interfaces to use.
-.It Va ipxgateway_enable
-.Pq Vt bool
-If set to
-.Dq Li YES ,
-enable the routing of IPX traffic.
-.It Va ipxrouted_enable
-.Pq Vt bool
-If set to
-.Dq Li YES ,
-run the
-.Xr IPXrouted 8
-daemon at system boot time.
-.It Va ipxrouted_flags
-.Pq Vt str
-If
-.Va ipxrouted_enable
-is set to
-.Dq Li YES ,
-these are the flags to pass to the
-.Xr IPXrouted 8
-daemon.
.It Va arpproxy_all
.Pq Vt bool
If set to
diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
index 2d2f651..22f1b3b 100644
--- a/share/man/man5/src.conf.5
+++ b/share/man/man5/src.conf.5
@@ -1,7 +1,7 @@
.\" DO NOT EDIT-- this file is automatically generated.
.\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z des
.\" $FreeBSD$
-.Dd February 22, 2014
+.Dd March 5, 2014
.Dt SRC.CONF 5
.Os
.Sh NAME
@@ -448,10 +448,6 @@ Set to not build GPIB bus support.
Set to not build
.Xr gpioctl 8
as part of the base system.
-.It Va WITH_GPL_DTC
-.\" from FreeBSD: head/tools/build/options/WITH_GPL_DTC 246262 2013-02-02 22:42:46Z dim
-Set to build the GPL'd version of the device tree compiler from elinux.org,
-instead of the BSD licensed one.
.It Va WITHOUT_GROFF
.\" from FreeBSD: head/tools/build/options/WITHOUT_GROFF 218941 2011-02-22 08:13:49Z uqs
Set to not build
@@ -524,18 +520,6 @@ Set to not build IP Filter package.
.It Va WITHOUT_IPFW
.\" from FreeBSD: head/tools/build/options/WITHOUT_IPFW 183242 2008-09-21 22:02:26Z sam
Set to not build IPFW tools.
-.It Va WITHOUT_IPX
-.\" from FreeBSD: head/tools/build/options/WITHOUT_IPX 156932 2006-03-21 07:50:50Z ru
-Set to not build programs and libraries related to IPX networking.
-When set, it also enforces the following options:
-.Pp
-.Bl -item -compact
-.It
-.Va WITHOUT_IPX_SUPPORT
-.El
-.It Va WITHOUT_IPX_SUPPORT
-.\" from FreeBSD: head/tools/build/options/WITHOUT_IPX_SUPPORT 156932 2006-03-21 07:50:50Z ru
-Set to build some programs without IPX support.
.It Va WITHOUT_JAIL
.\" from FreeBSD: head/tools/build/options/WITHOUT_JAIL 249966 2013-04-27 04:09:09Z eadler
Set to not build tools for the support of jails; e.g.,
diff --git a/share/man/man7/hier.7 b/share/man/man7/hier.7
index 920583d..8e32551 100644
--- a/share/man/man7/hier.7
+++ b/share/man/man7/hier.7
@@ -297,8 +297,6 @@ see
kernel key-management service;
see
.Xr ipsec 4
-.It Pa netipx/
-IPX/SPX protocol stacks
.It Pa netnatm/
NATM include files;
see
diff --git a/share/man/man9/netisr.9 b/share/man/man9/netisr.9
index e1e5822..685f0aa 100644
--- a/share/man/man9/netisr.9
+++ b/share/man/man9/netisr.9
@@ -204,8 +204,6 @@ Appletalk phase 1
Appletalk phase 2
.It Dv NETISR_ARP
ARP
-.It Dv NETISR_IPX
-IPX/SPX
.It Dv NETISR_IPV6
IPv6
.It Dv NETISR_NATM
diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk
index 17b5f5a..a23b129 100644
--- a/share/mk/bsd.libnames.mk
+++ b/share/mk/bsd.libnames.mk
@@ -67,9 +67,6 @@ LIBHEIMNTLM?= ${DESTDIR}${LIBDIR}/libheimntlm.a
LIBHEIMSQLITE?= ${DESTDIR}${LIBDIR}/libheimsqlite.a
LIBHX509?= ${DESTDIR}${LIBDIR}/libhx509.a
LIBIPSEC?= ${DESTDIR}${LIBDIR}/libipsec.a
-.if ${MK_IPX} != "no"
-LIBIPX?= ${DESTDIR}${LIBDIR}/libipx.a
-.endif
LIBJAIL?= ${DESTDIR}${LIBDIR}/libjail.a
LIBKADM5CLNT?= ${DESTDIR}${LIBDIR}/libkadm5clnt.a
LIBKADM5SRV?= ${DESTDIR}${LIBDIR}/libkadm5srv.a
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 71f2e1e..0a24a95 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -297,7 +297,6 @@ __DEFAULT_YES_OPTIONS = \
INSTALLLIB \
IPFILTER \
IPFW \
- IPX \
JAIL \
KDUMP \
KERBEROS \
@@ -572,7 +571,6 @@ MK_TESTS:= no
GNU \
INET \
INET6 \
- IPX \
KERBEROS \
KVM \
NETGRAPH \
diff --git a/sys/Makefile b/sys/Makefile
index 5b2c198..5b8e5d6 100644
--- a/sys/Makefile
+++ b/sys/Makefile
@@ -10,7 +10,7 @@ SUBDIR= boot
# Directories to include in cscope name file and TAGS.
CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
geom gnu isa kern libkern modules net net80211 netatalk \
- netgraph netinet netinet6 netipsec netipx netnatm netpfil \
+ netgraph netinet netinet6 netipsec netnatm netpfil \
netsmb nfs nfsclient nfsserver nlm ofed opencrypto \
pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR}
.if !defined(CSCOPE_ARCHDIR)
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 94dc278..0647414 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
#include "opt_cpu.h"
#include "opt_ddb.h"
#include "opt_inet.h"
-#include "opt_ipx.h"
#include "opt_isa.h"
#include "opt_kstack_pages.h"
#include "opt_maxmem.h"
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 92a183c..6aa8a9d 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -606,8 +606,6 @@ options IPSEC #IP security (requires device crypto)
#
options IPSEC_NAT_T #NAT-T support, UDP encap of ESP
-options IPX #IPX/SPX communications protocols
-
options NETATALK #Appletalk communications protocols
options NETATALKDEBUG #Appletalk debugging
@@ -886,14 +884,6 @@ options XBONEHACK
device faith
device stf
-# The `ef' device provides support for multiple ethernet frame types
-# specified via ETHER_* options. See ef(4) for details.
-device ef
-options ETHER_II # enable Ethernet_II frame
-options ETHER_8023 # enable Ethernet_802.3 (Novell) frame
-options ETHER_8022 # enable Ethernet_802.2 frame
-options ETHER_SNAP # enable Ethernet_802.2/SNAP frame
-
# The pf packet filter consists of three devices:
# The `pf' device provides /dev/pf and the firewall code itself.
# The `pflog' device provides the pflog0 interface which logs packets.
diff --git a/sys/conf/files b/sys/conf/files
index 5344498..6cdeb1a 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -3087,7 +3087,6 @@ net/if_dead.c standard
net/if_debug.c optional ddb
net/if_disc.c optional disc
net/if_edsc.c optional edsc
-net/if_ef.c optional ef
net/if_enc.c optional enc ipsec inet | enc ipsec inet6
net/if_epair.c optional epair
net/if_ethersubr.c optional ether
@@ -3365,16 +3364,6 @@ netipsec/xform_ipcomp.c optional ipsec inet | ipsec inet6
netipsec/xform_ipip.c optional ipsec inet | ipsec inet6
netipsec/xform_tcp.c optional ipsec inet tcp_signature | \
ipsec inet6 tcp_signature
-netipx/ipx.c optional ipx
-netipx/ipx_cksum.c optional ipx
-netipx/ipx_input.c optional ipx
-netipx/ipx_outputfl.c optional ipx
-netipx/ipx_pcb.c optional ipx
-netipx/ipx_proto.c optional ipx
-netipx/ipx_usrreq.c optional ipx
-netipx/spx_debug.c optional ipx
-netipx/spx_reass.c optional ipx
-netipx/spx_usrreq.c optional ipx
netnatm/natm.c optional natm
netnatm/natm_pcb.c optional natm
netnatm/natm_proto.c optional natm
diff --git a/sys/conf/options b/sys/conf/options
index 6fabc43..ee00e49 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -398,10 +398,6 @@ DEV_PFLOG opt_pf.h
DEV_PFSYNC opt_pf.h
DEV_VLAN opt_vlan.h
DUMMYNET opt_ipdn.h
-ETHER_8022 opt_ef.h
-ETHER_8023 opt_ef.h
-ETHER_II opt_ef.h
-ETHER_SNAP opt_ef.h
INET opt_inet.h
INET6 opt_inet6.h
IPDIVERT
@@ -419,7 +415,6 @@ IPSEC_DEBUG opt_ipsec.h
IPSEC_FILTERTUNNEL opt_ipsec.h
IPSEC_NAT_T opt_ipsec.h
IPSTEALTH
-IPX
KRPC
LIBALIAS
LIBMBPOOL
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index a4a6804..cd5db5a 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
#include "opt_cpu.h"
#include "opt_ddb.h"
#include "opt_inet.h"
-#include "opt_ipx.h"
#include "opt_isa.h"
#include "opt_kstack_pages.h"
#include "opt_maxmem.h"
diff --git a/sys/kern/Make.tags.inc b/sys/kern/Make.tags.inc
index cb8a3ff..1ff3507 100644
--- a/sys/kern/Make.tags.inc
+++ b/sys/kern/Make.tags.inc
@@ -40,7 +40,6 @@ COMM= ${SYS}/dev/advansys/*.[ch] \
${SYS}/netinet/*.[ch] \
${SYS}/netinet6/*.[ch] \
${SYS}/netipsec/*.[ch] \
- ${SYS}/netipx/*.[ch] \
${SYS}/netnatm/*.[ch] \
${SYS}/nfs/*.[ch] \
${SYS}/nfsclient/*.[ch] \
@@ -59,7 +58,6 @@ COMMDIR1= ${SYS}/conf \
${SYS}/netinet \
${SYS}/netinet6 \
${SYS}/netipsec \
- ${SYS}/netipx \
${SYS}/netnatm \
${SYS}/nfs \
${SYS}/pci \
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index 700b7d6..a855625 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -3744,12 +3744,6 @@ prison_priv_check(struct ucred *cred, int priv)
#ifdef notyet
/*
- * IPX/SPX privileges.
- */
- case PRIV_NETIPX_RESERVEDPORT:
- case PRIV_NETIPX_RAW:
-
- /*
* NCP privileges.
*/
case PRIV_NETNCP:
diff --git a/sys/mips/rmi/rootfs_list.txt b/sys/mips/rmi/rootfs_list.txt
index 927a1be..79c4b21 100644
--- a/sys/mips/rmi/rootfs_list.txt
+++ b/sys/mips/rmi/rootfs_list.txt
@@ -222,7 +222,6 @@
./etc/rc.d/ipmon
./etc/rc.d/ipnat
./etc/rc.d/ipsec
-./etc/rc.d/ipxrouted
./etc/rc.d/jail
./etc/rc.d/kadmind
./etc/rc.d/kerberos
@@ -437,7 +436,6 @@
./lib/libbsdxml.so.4
./lib/libgeom.so.5
./lib/libipsec.so.4
-./lib/libipx.so.5
./lib/libjail.so.1
./lib/libkiconv.so.4
./lib/libpcap.so.7
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 65852af..d6b1f6f 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -136,7 +136,6 @@ SUBDIR= \
if_bridge \
if_disc \
if_edsc \
- if_ef \
if_epair \
if_faith \
if_gif \
diff --git a/sys/modules/arcnet/Makefile b/sys/modules/arcnet/Makefile
index 69d89b9..0b55a59 100644
--- a/sys/modules/arcnet/Makefile
+++ b/sys/modules/arcnet/Makefile
@@ -4,7 +4,7 @@
KMOD= arcnet
SRCS= if_arcsubr.c
-SRCS+= opt_inet.h opt_inet6.h opt_ipx.h opt_ofed.h
+SRCS+= opt_inet.h opt_inet6.h opt_ofed.h
EXPORT_SYMS= arc_frag_init \
arc_frag_next \
@@ -22,9 +22,6 @@ opt_inet.h:
opt_inet6.h:
echo "#define INET6 1" > ${.TARGET}
-
-opt_ipx.h:
- echo "#define IPX 1" > ${.TARGET}
.endif
.include <bsd.kmod.mk>
diff --git a/sys/modules/if_ef/Makefile b/sys/modules/if_ef/Makefile
deleted file mode 100644
index dc40213..0000000
--- a/sys/modules/if_ef/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/../../net
-
-KMOD= if_ef
-SRCS= if_ef.c opt_ipx.h opt_inet.h opt_ef.h
-
-.if defined(EFDEBUG)
-CFLAGS+= -DEF_DEBUG
-.endif
-
-.if !defined(KERNBUILDDIR)
-# If you need only a limited number of frames, uncomment the needed ones.
-# This will reduce the number of visible devices. Note that the module
-# will support all frames by default, i.e., when all are commented here.
-#ETHER_II=
-#ETHER_8023=
-#ETHER_8022=
-#ETHER_SNAP=
-
-opt_inet.h:
- echo "#define INET 1" > ${.TARGET}
-
-opt_ipx.h:
- echo "#define IPX 1" > ${.TARGET}
-
-opt_ef.h:
- :> ${.TARGET}
-.for frame in ETHER_II ETHER_8023 ETHER_8022 ETHER_SNAP
-.if defined(${frame})
- echo "#define ${frame} 1" >> ${.TARGET}
-.endif
-.endfor
-.endif
-
-.include <bsd.kmod.mk>
diff --git a/sys/modules/if_tun/Makefile b/sys/modules/if_tun/Makefile
index 22a833e..b6960f1 100644
--- a/sys/modules/if_tun/Makefile
+++ b/sys/modules/if_tun/Makefile
@@ -3,7 +3,7 @@
.PATH: ${.CURDIR}/../../net
KMOD= if_tun
-SRCS= if_tun.c opt_atalk.h opt_inet.h opt_inet6.h opt_ipx.h
+SRCS= if_tun.c opt_atalk.h opt_inet.h opt_inet6.h
.if !defined(KERNBUILDDIR)
opt_atalk.h:
@@ -14,9 +14,6 @@ opt_inet.h:
opt_inet6.h:
echo "#define INET6 1" > ${.TARGET}
-
-opt_ipx.h:
- echo "#define IPX 1" > ${.TARGET}
.endif
.include <bsd.kmod.mk>
diff --git a/sys/modules/netgraph/iface/Makefile b/sys/modules/netgraph/iface/Makefile
index 2a6819b..d35ad5d 100644
--- a/sys/modules/netgraph/iface/Makefile
+++ b/sys/modules/netgraph/iface/Makefile
@@ -2,7 +2,7 @@
# $Whistle: Makefile,v 1.2 1999/01/19 19:39:21 archie Exp $
KMOD= ng_iface
-SRCS= ng_iface.c opt_atalk.h opt_inet.h opt_inet6.h opt_ipx.h
+SRCS= ng_iface.c opt_atalk.h opt_inet.h opt_inet6.h
.if !defined(KERNBUILDDIR)
opt_atalk.h:
@@ -13,9 +13,6 @@ opt_inet.h:
opt_inet6.h:
echo "#define INET6 1" > ${.TARGET}
-
-opt_ipx.h:
- echo "#define IPX 1" > ${.TARGET}
.endif
.include <bsd.kmod.mk>
diff --git a/sys/modules/smbfs/Makefile b/sys/modules/smbfs/Makefile
index 476e598..031933f 100644
--- a/sys/modules/smbfs/Makefile
+++ b/sys/modules/smbfs/Makefile
@@ -10,8 +10,7 @@
KMOD= smbfs
SRCS= vnode_if.h \
- opt_inet.h opt_ipx.h \
- opt_netsmb.h \
+ opt_inet.h opt_netsmb.h \
iconv_converter_if.h \
md4c.c \
smb_conn.c smb_dev.c smb_trantcp.c smb_smb.c smb_subr.c smb_rq.c \
@@ -27,9 +26,6 @@ SRCS+= des_enc.S
SRCS+= des_enc.c
.endif
-# Build with IPX support (1|0)
-SMB_IPX?= 0
-
# Build with INET support (1|0)
SMB_INET?= 1
@@ -44,11 +40,6 @@ CFLAGS+= -DVNPRINT
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
.endif
-
-.if ${SMB_IPX} > 0
-opt_ipx.h:
- echo "#define IPX 1" > ${.TARGET}
-.endif
.endif
.include <bsd.kmod.mk>
diff --git a/sys/modules/sppp/Makefile b/sys/modules/sppp/Makefile
index 455d2f3..9a3ed76 100644
--- a/sys/modules/sppp/Makefile
+++ b/sys/modules/sppp/Makefile
@@ -4,7 +4,7 @@
KMOD= sppp
SRCS= if_spppfr.c if_spppsubr.c slcompress.c
-SRCS+= opt_inet.h opt_inet6.h opt_ipx.h
+SRCS+= opt_inet.h opt_inet6.h
EXPORT_SYMS= sppp_attach \
sppp_detach \
@@ -21,9 +21,6 @@ opt_inet.h:
opt_inet6.h:
echo "#define INET6 1" > ${.TARGET}
-
-opt_ipx.h:
- echo "#define IPX 1" > ${.TARGET}
.endif
.include <bsd.kmod.mk>
diff --git a/sys/modules/wlan/Makefile b/sys/modules/wlan/Makefile
index 4945dd1..d25e5f3 100644
--- a/sys/modules/wlan/Makefile
+++ b/sys/modules/wlan/Makefile
@@ -13,7 +13,7 @@ SRCS= ieee80211.c ieee80211_action.c ieee80211_ageq.c \
ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c ieee80211_hostap.c \
ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c \
ieee80211_tdma.c ieee80211_superg.c
-SRCS+= bus_if.h device_if.h opt_ddb.h opt_inet.h opt_inet6.h opt_ipx.h \
+SRCS+= bus_if.h device_if.h opt_ddb.h opt_inet.h opt_inet6.h \
opt_tdma.h opt_wlan.h
.if !defined(KERNBUILDDIR)
@@ -23,8 +23,6 @@ opt_wlan.h:
echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET}
opt_inet.h:
echo "#define INET 1" > ${.TARGET}
-opt_ipx.h:
- echo "#define IPX 1" > ${.TARGET}
# override to get ddb support?
opt_ddb.h:
:> ${.TARGET}
diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c
index 6cec6d9..f593150 100644
--- a/sys/net/if_arcsubr.c
+++ b/sys/net/if_arcsubr.c
@@ -40,7 +40,6 @@
*/
#include "opt_inet.h"
#include "opt_inet6.h"
-#include "opt_ipx.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -77,11 +76,6 @@
#include <netinet6/nd6.h>
#endif
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
#define ARCNET_ALLOW_BROKEN_ARP
static struct mbuf *arc_defrag(struct ifnet *, struct mbuf *);
@@ -94,7 +88,6 @@ u_int8_t arcbroadcastaddr = 0;
#define senderr(e) { error = (e); goto bad;}
#define SIN(s) ((const struct sockaddr_in *)(s))
-#define SIPX(s) ((const struct sockaddr_ipx *)(s))
/*
* ARCnet output routine.
@@ -177,15 +170,6 @@ arc_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
atype = ARCTYPE_INET6;
break;
#endif
-#ifdef IPX
- case AF_IPX:
- adst = SIPX(dst)->sipx_addr.x_host.c_host[5];
- atype = ARCTYPE_IPX;
- if (adst == 0xff)
- adst = arcbroadcastaddr;
- break;
-#endif
-
case AF_UNSPEC:
{
const struct arc_header *ah;
@@ -602,12 +586,6 @@ arc_input(struct ifnet *ifp, struct mbuf *m)
isr = NETISR_IPV6;
break;
#endif
-#ifdef IPX
- case ARCTYPE_IPX:
- m_adj(m, ARC_HDRNEWLEN);
- isr = NETISR_IPX;
- break;
-#endif
default:
m_freem(m);
return;
@@ -689,26 +667,6 @@ arc_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
arp_ifinit(ifp, ifa);
break;
#endif
-#ifdef IPX
- /*
- * XXX This code is probably wrong
- */
- case AF_IPX:
- {
- struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
-
- if (ipx_nullhost(*ina))
- ina->x_host.c_host[5] = ARC_LLADDR(ifp);
- else
- arc_storelladdr(ifp, ina->x_host.c_host[5]);
-
- /*
- * Set new address
- */
- ifp->if_init(ifp->if_softc);
- break;
- }
-#endif
default:
ifp->if_init(ifp->if_softc);
break;
diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c
deleted file mode 100644
index 887c912..0000000
--- a/sys/net/if_ef.c
+++ /dev/null
@@ -1,603 +0,0 @@
-/*-
- * Copyright (c) 1999, 2000 Boris Popov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include "opt_inet.h"
-#include "opt_ipx.h"
-#include "opt_ef.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/syslog.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-
-#include <net/ethernet.h>
-#include <net/if_llc.h>
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_arp.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-#include <net/netisr.h>
-#include <net/bpf.h>
-#include <net/vnet.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_var.h>
-#include <netinet/if_ether.h>
-#endif
-
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
-/* If none of the supported layers is enabled explicitly enable them all */
-#if !defined(ETHER_II) && !defined(ETHER_8023) && !defined(ETHER_8022) && \
- !defined(ETHER_SNAP)
-#define ETHER_II 1
-#define ETHER_8023 1
-#define ETHER_8022 1
-#define ETHER_SNAP 1
-#endif
-
-/* internal frame types */
-#define ETHER_FT_EII 0 /* Ethernet_II - default */
-#define ETHER_FT_8023 1 /* 802.3 (Novell) */
-#define ETHER_FT_8022 2 /* 802.2 */
-#define ETHER_FT_SNAP 3 /* SNAP */
-#define EF_NFT 4 /* total number of frame types */
-
-#ifdef EF_DEBUG
-#define EFDEBUG(format, args...) printf("%s: "format, __func__ ,## args)
-#else
-#define EFDEBUG(format, args...)
-#endif
-
-#define EFERROR(format, args...) printf("%s: "format, __func__ ,## args)
-
-struct efnet {
- struct ifnet *ef_ifp;
- struct ifnet *ef_pifp;
- int ef_frametype;
-};
-
-struct ef_link {
- SLIST_ENTRY(ef_link) el_next;
- struct ifnet *el_ifp; /* raw device for this clones */
- struct efnet *el_units[EF_NFT]; /* our clones */
-};
-
-static SLIST_HEAD(ef_link_head, ef_link) efdev = {NULL};
-static int efcount;
-
-extern int (*ef_inputp)(struct ifnet*, struct ether_header *eh, struct mbuf *m);
-extern int (*ef_outputp)(struct ifnet *ifp, struct mbuf **mp,
- const struct sockaddr *dst, short *tp, int *hlen);
-
-/*
-static void ef_reset (struct ifnet *);
-*/
-static int ef_attach(struct efnet *sc);
-static int ef_detach(struct efnet *sc);
-static void ef_init(void *);
-static int ef_ioctl(struct ifnet *, u_long, caddr_t);
-static void ef_start(struct ifnet *);
-static int ef_input(struct ifnet*, struct ether_header *, struct mbuf *);
-static int ef_output(struct ifnet *ifp, struct mbuf **mp,
- const struct sockaddr *dst, short *tp, int *hlen);
-
-static int ef_load(void);
-static int ef_unload(void);
-
-/*
- * Install the interface, most of structure initialization done in ef_clone()
- */
-static int
-ef_attach(struct efnet *sc)
-{
- struct ifnet *ifp = sc->ef_ifp;
-
- ifp->if_start = ef_start;
- ifp->if_init = ef_init;
- ifp->if_snd.ifq_maxlen = ifqmaxlen;
- ifp->if_flags = (IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
- /*
- * Attach the interface
- */
- ether_ifattach(ifp, IF_LLADDR(sc->ef_pifp));
-
- ifp->if_resolvemulti = 0;
- ifp->if_type = IFT_XETHER;
- ifp->if_drv_flags |= IFF_DRV_RUNNING;
-
- EFDEBUG("%s: attached\n", ifp->if_xname);
- return 1;
-}
-
-/*
- * This is for _testing_only_, just removes interface from interfaces list
- */
-static int
-ef_detach(struct efnet *sc)
-{
- struct ifnet *ifp = sc->ef_ifp;
-
- ether_ifdetach(ifp);
- if_free(ifp);
-
- return 0;
-}
-
-static void
-ef_init(void *foo) {
- return;
-}
-
-static int
-ef_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
-{
- struct efnet *sc = ifp->if_softc;
- struct ifaddr *ifa = (struct ifaddr*)data;
- int error;
-
- EFDEBUG("IOCTL %ld for %s\n", cmd, ifp->if_xname);
- error = 0;
- switch (cmd) {
- case SIOCSIFFLAGS:
- error = 0;
- break;
- case SIOCSIFADDR:
- if (sc->ef_frametype == ETHER_FT_8023 &&
- ifa->ifa_addr->sa_family != AF_IPX) {
- error = EAFNOSUPPORT;
- break;
- }
- ifp->if_flags |= IFF_UP;
- /* FALL THROUGH */
- default:
- error = ether_ioctl(ifp, cmd, data);
- break;
- }
- return error;
-}
-
-/*
- * Currently packet prepared in the ether_output(), but this can be a better
- * place.
- */
-static void
-ef_start(struct ifnet *ifp)
-{
- struct efnet *sc = (struct efnet*)ifp->if_softc;
- struct ifnet *p;
- struct mbuf *m;
- int error;
-
- ifp->if_drv_flags |= IFF_DRV_OACTIVE;
- p = sc->ef_pifp;
-
- EFDEBUG("\n");
- for (;;) {
- IF_DEQUEUE(&ifp->if_snd, m);
- if (m == 0)
- break;
- BPF_MTAP(ifp, m);
- error = p->if_transmit(p, m);
- if (error) {
- ifp->if_oerrors++;
- continue;
- }
- ifp->if_opackets++;
- }
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
- return;
-}
-
-/*
- * Inline functions do not put additional overhead to procedure call or
- * parameter passing but simplify the code
- */
-static int __inline
-ef_inputEII(struct mbuf *m, struct ether_header *eh, u_short ether_type)
-{
- int isr;
-
- switch(ether_type) {
-#ifdef IPX
- case ETHERTYPE_IPX:
- isr = NETISR_IPX;
- break;
-#endif
-#ifdef INET
- case ETHERTYPE_IP:
- if ((m = ip_fastforward(m)) == NULL)
- return (0);
- isr = NETISR_IP;
- break;
-
- case ETHERTYPE_ARP:
- isr = NETISR_ARP;
- break;
-#endif
- default:
- return (EPROTONOSUPPORT);
- }
- netisr_dispatch(isr, m);
- return (0);
-}
-
-static int __inline
-ef_inputSNAP(struct mbuf *m, struct ether_header *eh, struct llc* l,
- u_short ether_type)
-{
- int isr;
-
- switch(ether_type) {
-#ifdef IPX
- case ETHERTYPE_IPX:
- m_adj(m, 8);
- isr = NETISR_IPX;
- break;
-#endif
- default:
- return (EPROTONOSUPPORT);
- }
- netisr_dispatch(isr, m);
- return (0);
-}
-
-static int __inline
-ef_input8022(struct mbuf *m, struct ether_header *eh, struct llc* l,
- u_short ether_type)
-{
- int isr;
-
- switch(ether_type) {
-#ifdef IPX
- case 0xe0:
- m_adj(m, 3);
- isr = NETISR_IPX;
- break;
-#endif
- default:
- return (EPROTONOSUPPORT);
- }
- netisr_dispatch(isr, m);
- return (0);
-}
-
-/*
- * Called from ether_input()
- */
-static int
-ef_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
-{
- u_short ether_type;
- int ft = -1;
- struct efnet *efp;
- struct ifnet *eifp;
- struct llc *l;
- struct ef_link *efl;
- int isr;
-
- ether_type = ntohs(eh->ether_type);
- l = NULL;
- if (ether_type < ETHERMTU) {
- l = mtod(m, struct llc*);
- if (l->llc_dsap == 0xff && l->llc_ssap == 0xff) {
- /*
- * Novell's "802.3" frame
- */
- ft = ETHER_FT_8023;
- } else if (l->llc_dsap == 0xaa && l->llc_ssap == 0xaa) {
- /*
- * 802.2/SNAP
- */
- ft = ETHER_FT_SNAP;
- ether_type = ntohs(l->llc_un.type_snap.ether_type);
- } else if (l->llc_dsap == l->llc_ssap) {
- /*
- * 802.3/802.2
- */
- ft = ETHER_FT_8022;
- ether_type = l->llc_ssap;
- }
- } else
- ft = ETHER_FT_EII;
-
- if (ft == -1) {
- EFDEBUG("Unrecognised ether_type %x\n", ether_type);
- return EPROTONOSUPPORT;
- }
-
- /*
- * Check if interface configured for the given frame
- */
- efp = NULL;
- SLIST_FOREACH(efl, &efdev, el_next) {
- if (efl->el_ifp == ifp) {
- efp = efl->el_units[ft];
- break;
- }
- }
- if (efp == NULL) {
- EFDEBUG("Can't find if for %d\n", ft);
- return EPROTONOSUPPORT;
- }
- eifp = efp->ef_ifp;
- if ((eifp->if_flags & IFF_UP) == 0)
- return EPROTONOSUPPORT;
- eifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh);
- m->m_pkthdr.rcvif = eifp;
-
- BPF_MTAP2(eifp, eh, ETHER_HDR_LEN, m);
- /*
- * Now we ready to adjust mbufs and pass them to protocol intr's
- */
- switch(ft) {
- case ETHER_FT_EII:
- return (ef_inputEII(m, eh, ether_type));
-#ifdef IPX
- case ETHER_FT_8023: /* only IPX can be here */
- isr = NETISR_IPX;
- break;
-#endif
- case ETHER_FT_SNAP:
- return (ef_inputSNAP(m, eh, l, ether_type));
- case ETHER_FT_8022:
- return (ef_input8022(m, eh, l, ether_type));
- default:
- EFDEBUG("No support for frame %d and proto %04x\n",
- ft, ether_type);
- return (EPROTONOSUPPORT);
- }
- netisr_dispatch(isr, m);
- return (0);
-}
-
-static int
-ef_output(struct ifnet *ifp, struct mbuf **mp, const struct sockaddr *dst,
- short *tp, int *hlen)
-{
- struct efnet *sc = (struct efnet*)ifp->if_softc;
- struct mbuf *m = *mp;
- u_char *cp;
- short type;
-
- if (ifp->if_type != IFT_XETHER)
- return ENETDOWN;
- switch (sc->ef_frametype) {
- case ETHER_FT_EII:
-#ifdef IPX
- type = htons(ETHERTYPE_IPX);
-#else
- return EPFNOSUPPORT;
-#endif
- break;
- case ETHER_FT_8023:
- type = htons(m->m_pkthdr.len);
- break;
- case ETHER_FT_8022:
- M_PREPEND(m, ETHER_HDR_LEN + 3, M_WAITOK);
- /*
- * Ensure that ethernet header and next three bytes
- * will fit into single mbuf
- */
- m = m_pullup(m, ETHER_HDR_LEN + 3);
- if (m == NULL) {
- *mp = NULL;
- return ENOBUFS;
- }
- m_adj(m, ETHER_HDR_LEN);
- type = htons(m->m_pkthdr.len);
- cp = mtod(m, u_char *);
- *cp++ = 0xE0;
- *cp++ = 0xE0;
- *cp++ = 0x03;
- *hlen += 3;
- break;
- case ETHER_FT_SNAP:
- M_PREPEND(m, 8, M_WAITOK);
- type = htons(m->m_pkthdr.len);
- cp = mtod(m, u_char *);
- bcopy("\xAA\xAA\x03\x00\x00\x00\x81\x37", cp, 8);
- *hlen += 8;
- break;
- default:
- return EPFNOSUPPORT;
- }
- *mp = m;
- *tp = type;
- return 0;
-}
-
-/*
- * Create clone from the given interface
- */
-static int
-ef_clone(struct ef_link *efl, int ft)
-{
- struct efnet *efp;
- struct ifnet *eifp;
- struct ifnet *ifp = efl->el_ifp;
-
- efp = (struct efnet*)malloc(sizeof(struct efnet), M_IFADDR,
- M_WAITOK | M_ZERO);
- if (efp == NULL)
- return ENOMEM;
- efp->ef_pifp = ifp;
- efp->ef_frametype = ft;
- eifp = efp->ef_ifp = if_alloc(IFT_ETHER);
- if (eifp == NULL) {
- free(efp, M_IFADDR);
- return (ENOSPC);
- }
- snprintf(eifp->if_xname, IFNAMSIZ,
- "%sf%d", ifp->if_xname, efp->ef_frametype);
- eifp->if_dname = "ef";
- eifp->if_dunit = IF_DUNIT_NONE;
- eifp->if_softc = efp;
- if (ifp->if_ioctl)
- eifp->if_ioctl = ef_ioctl;
- efl->el_units[ft] = efp;
- return 0;
-}
-
-static int
-ef_load(void)
-{
- VNET_ITERATOR_DECL(vnet_iter);
- struct ifnet *ifp;
- struct efnet *efp;
- struct ef_link *efl = NULL, *efl_temp;
- int error = 0, d;
-
- VNET_LIST_RLOCK();
- VNET_FOREACH(vnet_iter) {
- CURVNET_SET(vnet_iter);
-
- /*
- * XXXRW: The following loop walks the ifnet list while
- * modifying it, something not well-supported by ifnet
- * locking. To avoid lock upgrade/recursion issues, manually
- * acquire a write lock of ifnet_sxlock here, rather than a
- * read lock, so that when if_alloc() recurses the lock, we
- * don't panic. This structure, in which if_ef automatically
- * attaches to all ethernet interfaces, should be replaced
- * with a model like that found in if_vlan, in which
- * interfaces are explicitly configured, which would avoid
- * this (and other) problems.
- */
- sx_xlock(&ifnet_sxlock);
- TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
- if (ifp->if_type != IFT_ETHER) continue;
- EFDEBUG("Found interface %s\n", ifp->if_xname);
- efl = (struct ef_link*)malloc(sizeof(struct ef_link),
- M_IFADDR, M_WAITOK | M_ZERO);
- if (efl == NULL) {
- error = ENOMEM;
- break;
- }
-
- efl->el_ifp = ifp;
-#ifdef ETHER_II
- error = ef_clone(efl, ETHER_FT_EII);
- if (error) break;
-#endif
-#ifdef ETHER_8023
- error = ef_clone(efl, ETHER_FT_8023);
- if (error) break;
-#endif
-#ifdef ETHER_8022
- error = ef_clone(efl, ETHER_FT_8022);
- if (error) break;
-#endif
-#ifdef ETHER_SNAP
- error = ef_clone(efl, ETHER_FT_SNAP);
- if (error) break;
-#endif
- efcount++;
- SLIST_INSERT_HEAD(&efdev, efl, el_next);
- }
- sx_xunlock(&ifnet_sxlock);
- CURVNET_RESTORE();
- }
- VNET_LIST_RUNLOCK();
- if (error) {
- if (efl)
- SLIST_INSERT_HEAD(&efdev, efl, el_next);
- SLIST_FOREACH_SAFE(efl, &efdev, el_next, efl_temp) {
- for (d = 0; d < EF_NFT; d++)
- if (efl->el_units[d]) {
- if (efl->el_units[d]->ef_pifp != NULL)
- if_free(efl->el_units[d]->ef_pifp);
- free(efl->el_units[d], M_IFADDR);
- }
- free(efl, M_IFADDR);
- }
- return error;
- }
- SLIST_FOREACH(efl, &efdev, el_next) {
- for (d = 0; d < EF_NFT; d++) {
- efp = efl->el_units[d];
- if (efp)
- ef_attach(efp);
- }
- }
- ef_inputp = ef_input;
- ef_outputp = ef_output;
- EFDEBUG("Loaded\n");
- return 0;
-}
-
-static int
-ef_unload(void)
-{
- struct efnet *efp;
- struct ef_link *efl;
- int d;
-
- ef_inputp = NULL;
- ef_outputp = NULL;
- SLIST_FOREACH(efl, &efdev, el_next) {
- for (d = 0; d < EF_NFT; d++) {
- efp = efl->el_units[d];
- if (efp) {
- ef_detach(efp);
- }
- }
- }
- EFDEBUG("Unloaded\n");
- return 0;
-}
-
-static int
-if_ef_modevent(module_t mod, int type, void *data)
-{
- switch ((modeventtype_t)type) {
- case MOD_LOAD:
- return ef_load();
- case MOD_UNLOAD:
- return ef_unload();
- default:
- return EOPNOTSUPP;
- }
- return 0;
-}
-
-static moduledata_t if_ef_mod = {
- "if_ef", if_ef_modevent, NULL
-};
-
-DECLARE_MODULE(if_ef, if_ef_mod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE);
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index ec29b69..44d5f24 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -33,7 +33,6 @@
#include "opt_atalk.h"
#include "opt_inet.h"
#include "opt_inet6.h"
-#include "opt_ipx.h"
#include "opt_netgraph.h"
#include "opt_mbuf_profiling.h"
@@ -79,11 +78,6 @@
#include <netinet6/nd6.h>
#endif
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
int (*ef_inputp)(struct ifnet*, struct ether_header *eh, struct mbuf *m);
int (*ef_outputp)(struct ifnet *ifp, struct mbuf **mp,
const struct sockaddr *dst, short *tp, int *hlen);
@@ -249,18 +243,6 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
type = htons(ETHERTYPE_IPV6);
break;
#endif
-#ifdef IPX
- case AF_IPX:
- if (ef_outputp) {
- error = ef_outputp(ifp, &m, dst, &type, &hlen);
- if (error)
- goto bad;
- } else
- type = htons(ETHERTYPE_IPX);
- bcopy(&((const struct sockaddr_ipx *)dst)->sipx_addr.x_host,
- edst, sizeof (edst));
- break;
-#endif
#ifdef NETATALK
case AF_APPLETALK:
{
@@ -811,13 +793,6 @@ ether_demux(struct ifnet *ifp, struct mbuf *m)
isr = NETISR_ARP;
break;
#endif
-#ifdef IPX
- case ETHERTYPE_IPX:
- if (ef_inputp && ef_inputp(ifp, eh, m) == 0)
- return;
- isr = NETISR_IPX;
- break;
-#endif
#ifdef INET6
case ETHERTYPE_IPV6:
isr = NETISR_IPV6;
@@ -832,10 +807,6 @@ ether_demux(struct ifnet *ifp, struct mbuf *m)
break;
#endif /* NETATALK */
default:
-#ifdef IPX
- if (ef_inputp && ef_inputp(ifp, eh, m) == 0)
- return;
-#endif /* IPX */
#if defined(NETATALK)
if (ether_type > ETHERMTU)
goto discard;
@@ -1080,31 +1051,6 @@ ether_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
arp_ifinit(ifp, ifa);
break;
#endif
-#ifdef IPX
- /*
- * XXX - This code is probably wrong
- */
- case AF_IPX:
- {
- struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
-
- if (ipx_nullhost(*ina))
- ina->x_host =
- *(union ipx_host *)
- IF_LLADDR(ifp);
- else {
- bcopy((caddr_t) ina->x_host.c_host,
- (caddr_t) IF_LLADDR(ifp),
- ETHER_ADDR_LEN);
- }
-
- /*
- * Set new address
- */
- ifp->if_init(ifp->if_softc);
- break;
- }
-#endif
default:
ifp->if_init(ifp->if_softc);
break;
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index 2bb818b..bfaf71a 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -39,7 +39,6 @@
#include "opt_atalk.h"
#include "opt_inet.h"
#include "opt_inet6.h"
-#include "opt_ipx.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -72,11 +71,6 @@
#include <netinet6/nd6.h>
#endif
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
#ifdef DECNET
#include <netdnet/dn.h>
#endif
@@ -184,13 +178,6 @@ fddi_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
type = htons(ETHERTYPE_IPV6);
break;
#endif /* INET6 */
-#ifdef IPX
- case AF_IPX:
- type = htons(ETHERTYPE_IPX);
- bcopy(&((const struct sockaddr_ipx *)dst)->sipx_addr.x_host,
- edst, FDDI_ADDR_LEN);
- break;
-#endif /* IPX */
#ifdef NETATALK
case AF_APPLETALK: {
struct at_ifaddr *aa;
@@ -518,11 +505,6 @@ fddi_input(ifp, m)
isr = NETISR_IPV6;
break;
#endif
-#ifdef IPX
- case ETHERTYPE_IPX:
- isr = NETISR_IPX;
- break;
-#endif
#ifdef DECNET
case ETHERTYPE_DECNET:
isr = NETISR_DECNET;
@@ -640,31 +622,6 @@ fddi_ioctl (ifp, command, data)
arp_ifinit(ifp, ifa);
break;
#endif
-#ifdef IPX
- /*
- * XXX - This code is probably wrong
- */
- case AF_IPX: {
- struct ipx_addr *ina;
-
- ina = &(IA_SIPX(ifa)->sipx_addr);
-
- if (ipx_nullhost(*ina)) {
- ina->x_host = *(union ipx_host *)
- IF_LLADDR(ifp);
- } else {
- bcopy((caddr_t) ina->x_host.c_host,
- (caddr_t) IF_LLADDR(ifp),
- ETHER_ADDR_LEN);
- }
-
- /*
- * Set new address
- */
- ifp->if_init(ifp->if_softc);
- }
- break;
-#endif
default:
ifp->if_init(ifp->if_softc);
break;
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c
index 593c5ab..2c93b20 100644
--- a/sys/net/if_iso88025subr.c
+++ b/sys/net/if_iso88025subr.c
@@ -42,7 +42,6 @@
#include "opt_inet.h"
#include "opt_inet6.h"
-#include "opt_ipx.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -76,11 +75,6 @@
#include <netinet6/nd6.h>
#endif
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
#include <security/mac/mac_framework.h>
static const u_char iso88025_broadcastaddr[ISO88025_ADDR_LEN] =
@@ -171,30 +165,6 @@ iso88025_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
arp_ifinit(ifp, ifa);
break;
#endif /* INET */
-#ifdef IPX
- /*
- * XXX - This code is probably wrong
- */
- case AF_IPX: {
- struct ipx_addr *ina;
-
- ina = &(IA_SIPX(ifa)->sipx_addr);
-
- if (ipx_nullhost(*ina))
- ina->x_host = *(union ipx_host *)
- IF_LLADDR(ifp);
- else
- bcopy((caddr_t) ina->x_host.c_host,
- (caddr_t) IF_LLADDR(ifp),
- ISO88025_ADDR_LEN);
-
- /*
- * Set new address
- */
- ifp->if_init(ifp->if_softc);
- }
- break;
-#endif /* IPX */
default:
ifp->if_init(ifp->if_softc);
break;
@@ -328,25 +298,6 @@ iso88025_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
snap_type = ETHERTYPE_IPV6;
break;
#endif /* INET6 */
-#ifdef IPX
- case AF_IPX:
- {
- u_int8_t *cp;
-
- bcopy((caddr_t)&(satoipx_addr(dst).x_host), (caddr_t)edst,
- ISO88025_ADDR_LEN);
-
- M_PREPEND(m, 3, M_WAITOK);
- m = m_pullup(m, 3);
- if (m == 0)
- senderr(ENOBUFS);
- cp = mtod(m, u_int8_t *);
- *cp++ = ETHERTYPE_IPX_8022;
- *cp++ = ETHERTYPE_IPX_8022;
- *cp++ = LLC_UI;
- }
- break;
-#endif /* IPX */
case AF_UNSPEC:
{
const struct iso88025_sockaddr_data *sd;
@@ -546,19 +497,6 @@ iso88025_input(ifp, m)
l = mtod(m, struct llc *);
switch (l->llc_dsap) {
-#ifdef IPX
- case ETHERTYPE_IPX_8022: /* Thanks a bunch Novell */
- if ((l->llc_control != LLC_UI) ||
- (l->llc_ssap != ETHERTYPE_IPX_8022)) {
- ifp->if_noproto++;
- goto dropanyway;
- }
-
- th->iso88025_shost[0] &= ~(TR_RII);
- m_adj(m, 3);
- isr = NETISR_IPX;
- break;
-#endif /* IPX */
case LLC_SNAP_LSAP: {
u_int16_t type;
if ((l->llc_control != LLC_UI) ||
@@ -591,12 +529,6 @@ iso88025_input(ifp, m)
isr = NETISR_ARP;
break;
#endif /* INET */
-#ifdef IPX_SNAP /* XXX: Not supported! */
- case ETHERTYPE_IPX:
- th->iso88025_shost[0] &= ~(TR_RII);
- isr = NETISR_IPX;
- break;
-#endif /* IPX_SNAP */
#ifdef INET6
case ETHERTYPE_IPV6:
th->iso88025_shost[0] &= ~(TR_RII);
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 1cfe77b..e114699 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -37,7 +37,6 @@
#include "opt_atalk.h"
#include "opt_inet.h"
#include "opt_inet6.h"
-#include "opt_ipx.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -64,11 +63,6 @@
#include <netinet/in_var.h>
#endif
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
#ifdef INET6
#ifndef INET
#include <netinet/in.h>
@@ -273,7 +267,6 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
#endif
m->m_pkthdr.csum_flags &= ~LO_CSUM_FEATURES6;
break;
- case AF_IPX:
case AF_APPLETALK:
break;
default:
@@ -368,11 +361,6 @@ if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen)
isr = NETISR_IPV6;
break;
#endif
-#ifdef IPX
- case AF_IPX:
- isr = NETISR_IPX;
- break;
-#endif
#ifdef NETATALK
case AF_APPLETALK:
isr = NETISR_ATALK2;
diff --git a/sys/net/if_spppfr.c b/sys/net/if_spppfr.c
index a151849..fffcdba 100644
--- a/sys/net/if_spppfr.c
+++ b/sys/net/if_spppfr.c
@@ -28,7 +28,6 @@
#if defined(__FreeBSD__)
#include "opt_inet.h"
#include "opt_inet6.h"
-#include "opt_ipx.h"
#endif
#ifdef NetBSD1_3
@@ -85,11 +84,6 @@
# include <net/ethertypes.h>
#endif
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
#include <net/if_sppp.h>
/*
@@ -266,11 +260,6 @@ drop: ++ifp->if_ierrors;
isr = NETISR_IP;
break;
#endif
-#ifdef IPX
- case ETHERTYPE_IPX:
- isr = NETISR_IPX;
- break;
-#endif
#ifdef NETATALK
case ETHERTYPE_AT:
isr = NETISR_ATALK;
@@ -345,11 +334,6 @@ struct mbuf *sppp_fr_header (struct sppp *sp, struct mbuf *m,
h[3] = FR_IP;
return m;
#endif
-#ifdef IPX
- case AF_IPX:
- type = ETHERTYPE_IPX;
- break;
-#endif
#ifdef NS
case AF_NS:
type = 0x8137;
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index b24ea73..74bcfa06 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -25,7 +25,6 @@
#include "opt_inet.h"
#include "opt_inet6.h"
-#include "opt_ipx.h"
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -65,11 +64,6 @@
#include <netinet/if_ether.h>
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
#include <net/if_sppp.h>
#define IOCTL_CMD_T u_long
@@ -672,14 +666,6 @@ sppp_input(struct ifnet *ifp, struct mbuf *m)
do_account++;
break;
#endif
-#ifdef IPX
- case PPP_IPX:
- /* IPX IPXCP not implemented yet */
- if (sp->pp_phase == PHASE_NETWORK)
- isr = NETISR_IPX;
- do_account++;
- break;
-#endif
}
break;
case CISCO_MULTICAST:
@@ -715,12 +701,6 @@ sppp_input(struct ifnet *ifp, struct mbuf *m)
do_account++;
break;
#endif
-#ifdef IPX
- case ETHERTYPE_IPX:
- isr = NETISR_IPX;
- do_account++;
- break;
-#endif
}
break;
default: /* Invalid PPP packet. */
@@ -984,12 +964,6 @@ nobufs: if (debug)
}
break;
#endif
-#ifdef IPX
- case AF_IPX: /* Novell IPX Protocol */
- h->protocol = htons (sp->pp_mode == IFF_CISCO ?
- ETHERTYPE_IPX : PPP_IPX);
- break;
-#endif
default:
m_freem (m);
++ifp->if_oerrors;
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 45e10c1..03fcd59 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -19,7 +19,6 @@
#include "opt_atalk.h"
#include "opt_inet.h"
#include "opt_inet6.h"
-#include "opt_ipx.h"
#include <sys/param.h>
#include <sys/priv.h>
@@ -906,11 +905,6 @@ tunwrite(struct cdev *dev, struct uio *uio, int flag)
isr = NETISR_IPV6;
break;
#endif
-#ifdef IPX
- case AF_IPX:
- isr = NETISR_IPX;
- break;
-#endif
#ifdef NETATALK
case AF_APPLETALK:
isr = NETISR_ATALK2;
diff --git a/sys/net/if_types.h b/sys/net/if_types.h
index fe6ab5e..80a5606 100644
--- a/sys/net/if_types.h
+++ b/sys/net/if_types.h
@@ -250,5 +250,4 @@
#define IFT_ENC 0xf4
#define IFT_PFLOG 0xf6
#define IFT_PFSYNC 0xf7
-#define IFT_IPXIP 0xf9 /* IPX over IP tunneling; no longer used. */
#endif /* !_NET_IF_TYPES_H_ */
diff --git a/sys/net/netisr.h b/sys/net/netisr.h
index 83bf9ce..2cf3113 100644
--- a/sys/net/netisr.h
+++ b/sys/net/netisr.h
@@ -56,7 +56,7 @@
#define NETISR_ATALK2 5 /* Appletalk phase 2 */
#define NETISR_ATALK1 6 /* Appletalk phase 1 */
#define NETISR_ARP 7 /* same as AF_LINK */
-#define NETISR_IPX 8 /* same as AF_IPX */
+/* 8 was IPX */
#define NETISR_ETHER 9 /* ethernet input */
#define NETISR_IPV6 10
#define NETISR_NATM 11
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 4cb9b07..324520f 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -129,7 +129,6 @@ int (*carp_get_vhid_p)(struct ifaddr *);
typedef struct {
int ip_count; /* attached w/ AF_INET */
int ip6_count; /* attached w/ AF_INET6 */
- int ipx_count; /* attached w/ AF_IPX */
int any_count; /* total attached */
} route_cb_t;
static VNET_DEFINE(route_cb_t, route_cb);
@@ -294,9 +293,6 @@ rts_attach(struct socket *so, int proto, struct thread *td)
case AF_INET6:
V_route_cb.ip6_count++;
break;
- case AF_IPX:
- V_route_cb.ipx_count++;
- break;
}
V_route_cb.any_count++;
RTSOCK_UNLOCK();
@@ -337,9 +333,6 @@ rts_detach(struct socket *so)
case AF_INET6:
V_route_cb.ip6_count--;
break;
- case AF_IPX:
- V_route_cb.ipx_count--;
- break;
}
V_route_cb.any_count--;
RTSOCK_UNLOCK();
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 72d6dd1..f0fbf3a 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$");
*/
#include "opt_inet.h"
-#include "opt_ipx.h"
#include "opt_wlan.h"
#include <sys/endian.h>
@@ -54,11 +53,6 @@ __FBSDID("$FreeBSD$");
#include <netinet/if_ether.h>
#endif
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_ioctl.h>
#include <net80211/ieee80211_regdomain.h>
@@ -3420,24 +3414,6 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
arp_ifinit(ifp, ifa);
break;
#endif
-#ifdef IPX
- /*
- * XXX - This code is probably wrong,
- * but has been copied many times.
- */
- case AF_IPX: {
- struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
-
- if (ipx_nullhost(*ina))
- ina->x_host = *(union ipx_host *)
- IF_LLADDR(ifp);
- else
- bcopy((caddr_t) ina->x_host.c_host,
- (caddr_t) IF_LLADDR(ifp),
- ETHER_ADDR_LEN);
- /* fall thru... */
- }
-#endif
default:
if ((ifp->if_flags & IFF_UP) == 0) {
ifp->if_flags |= IFF_UP;
diff --git a/sys/netgraph/ng_cisco.c b/sys/netgraph/ng_cisco.c
index a9780dd..5a7b097 100644
--- a/sys/netgraph/ng_cisco.c
+++ b/sys/netgraph/ng_cisco.c
@@ -51,16 +51,12 @@
#include <sys/syslog.h>
#include <net/if.h>
-#include <net/if_var.h> /* XXXGL: ipx? */
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netatalk/at.h>
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_parse.h>
diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c
index e2d3454..5dc085f 100644
--- a/sys/netgraph/ng_iface.c
+++ b/sys/netgraph/ng_iface.c
@@ -43,7 +43,7 @@
/*
* This node is also a system networking interface. It has
- * a hook for each protocol (IP, AppleTalk, IPX, etc). Packets
+ * a hook for each protocol (IP, AppleTalk, etc). Packets
* are simply relayed between the interface and the hooks.
*
* Interfaces are named ng0, ng1, etc. New nodes take the
@@ -55,7 +55,6 @@
#include "opt_atalk.h"
#include "opt_inet.h"
#include "opt_inet6.h"
-#include "opt_ipx.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -105,7 +104,6 @@ const static struct iffam gFamilies[] = {
{ AF_INET, NG_IFACE_HOOK_INET },
{ AF_INET6, NG_IFACE_HOOK_INET6 },
{ AF_APPLETALK, NG_IFACE_HOOK_ATALK },
- { AF_IPX, NG_IFACE_HOOK_IPX },
{ AF_ATM, NG_IFACE_HOOK_ATM },
{ AF_NATM, NG_IFACE_HOOK_NATM },
};
@@ -761,11 +759,6 @@ ng_iface_rcvdata(hook_p hook, item_p item)
isr = NETISR_IPV6;
break;
#endif
-#ifdef IPX
- case AF_IPX:
- isr = NETISR_IPX;
- break;
-#endif
#ifdef NETATALK
case AF_APPLETALK:
isr = NETISR_ATALK2;
diff --git a/sys/netgraph/ng_iface.h b/sys/netgraph/ng_iface.h
index 58fb442..85123b0 100644
--- a/sys/netgraph/ng_iface.h
+++ b/sys/netgraph/ng_iface.h
@@ -55,7 +55,6 @@
#define NG_IFACE_HOOK_INET "inet"
#define NG_IFACE_HOOK_INET6 "inet6"
#define NG_IFACE_HOOK_ATALK "atalk" /* AppleTalk phase 2 */
-#define NG_IFACE_HOOK_IPX "ipx"
#define NG_IFACE_HOOK_ATM "atm"
#define NG_IFACE_HOOK_NATM "natm"
diff --git a/sys/netgraph/ng_ksocket.c b/sys/netgraph/ng_ksocket.c
index 5c0ae67..6f207a9 100644
--- a/sys/netgraph/ng_ksocket.c
+++ b/sys/netgraph/ng_ksocket.c
@@ -122,7 +122,6 @@ static const struct ng_ksocket_alias ng_ksocket_families[] = {
{ "inet", PF_INET },
{ "inet6", PF_INET6 },
{ "atalk", PF_APPLETALK },
- { "ipx", PF_IPX },
{ "atm", PF_ATM },
{ NULL, -1 },
};
@@ -303,7 +302,6 @@ ng_ksocket_sockaddr_parse(const struct ng_parse_type *type,
#if 0
case PF_APPLETALK: /* XXX implement these someday */
case PF_INET6:
- case PF_IPX:
#endif
default:
@@ -367,7 +365,6 @@ ng_ksocket_sockaddr_unparse(const struct ng_parse_type *type,
#if 0
case PF_APPLETALK: /* XXX implement these someday */
case PF_INET6:
- case PF_IPX:
#endif
default:
diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c
index 733aa4d..c83f5ee 100644
--- a/sys/netinet/in_proto.c
+++ b/sys/netinet/in_proto.c
@@ -32,7 +32,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_ipx.h"
#include "opt_mrouting.h"
#include "opt_ipsec.h"
#include "opt_inet.h"
diff --git a/sys/netipx/README b/sys/netipx/README
deleted file mode 100644
index f324d9d..0000000
--- a/sys/netipx/README
+++ /dev/null
@@ -1,41 +0,0 @@
-$FreeBSD$
-
-This protocol implements IPX/SPX over Ethernet_II frame type 0x8137.
-Please note: the SPX implementation may require further work and testing
-to insure proper operation.
-
-Mike Mitchell, Network Engineer
-AMTECH Systems Corporation, Technology and Manufacturing
-8600 Jefferson Street, Albuquerque, New Mexico 87113 (505) 856-8000
-supervisor@alb.asctmd.com
-
-John Hay
-Some Company
-Some Address
-jhay@mikom.csir.co.za
-
-Adapted for multi-processor, multi-threaded network stack by Robert N. M.
-Watson, Computer Laboratory, University of Cambridge.
-
---- Copyright Information ---
-/*-
-
-Copyright (c) 1984, 1985, 1986, 1987, 1993
-The Regents of the University of California. All rights reserved.
-
-Modifications Copyright (c) 1995, Mike Mitchell
-Modifications Copyright (c) 1995, John Hay
-Modifications Copyright (c) 2004-2009 Robert N. M. Watson
-
-*/
-
---- TODO ---
-
-(1) netipx default socket buffer sizes are very small by contemporary
- standards, and should be increased following testing and measurement.
-
-(2) SPX will free the PCB and socket buffer memory on close(), which means
- close() in effects terminates the transfer of any outstanding buffered
- but unsent data. As with TCP, it should instead grab its own
- reference to the socket so that it is not released, as hold onto it
- until the data transfer is complete.
diff --git a/sys/netipx/ipx.c b/sys/netipx/ipx.c
deleted file mode 100644
index 987a267..0000000
--- a/sys/netipx/ipx.c
+++ /dev/null
@@ -1,457 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California.
- * Copyright (c) 2009 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx.c
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/priv.h>
-#include <sys/rwlock.h>
-#include <sys/sockio.h>
-#include <sys/socket.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/route.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#include <netipx/ipx_var.h>
-
-/*
- * The IPX-layer address list is protected by ipx_ifaddr_rw.
- */
-struct rwlock ipx_ifaddr_rw;
-struct ipx_ifaddrhead ipx_ifaddrhead;
-
-static void ipx_ifscrub(struct ifnet *ifp, struct ipx_ifaddr *ia);
-static int ipx_ifinit(struct ifnet *ifp, struct ipx_ifaddr *ia,
- struct sockaddr_ipx *sipx, int scrub);
-
-/*
- * Generic internet control operations (ioctl's).
- */
-int
-ipx_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
- struct thread *td)
-{
- struct ifreq *ifr = (struct ifreq *)data;
- struct ipx_aliasreq *ifra = (struct ipx_aliasreq *)data;
- struct ipx_ifaddr *ia;
- struct ifaddr *ifa;
- int dstIsNew, hostIsNew;
- int error, priv;
-
- /*
- * Find address for this interface, if it exists.
- */
- if (ifp == NULL)
- return (EADDRNOTAVAIL);
-
- IPX_IFADDR_RLOCK();
- TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) {
- if (ia->ia_ifp == ifp)
- break;
- }
- if (ia != NULL)
- ifa_ref(&ia->ia_ifa);
- IPX_IFADDR_RUNLOCK();
-
- error = 0;
- switch (cmd) {
- case SIOCGIFADDR:
- if (ia == NULL) {
- error = EADDRNOTAVAIL;
- goto out;
- }
- *(struct sockaddr_ipx *)&ifr->ifr_addr = ia->ia_addr;
- goto out;
-
- case SIOCGIFBRDADDR:
- if (ia == NULL) {
- error = EADDRNOTAVAIL;
- goto out;
- }
- if ((ifp->if_flags & IFF_BROADCAST) == 0) {
- error = EINVAL;
- goto out;
- }
- *(struct sockaddr_ipx *)&ifr->ifr_dstaddr = ia->ia_broadaddr;
- goto out;
-
- case SIOCGIFDSTADDR:
- if (ia == NULL) {
- error = EADDRNOTAVAIL;
- goto out;
- }
- if ((ifp->if_flags & IFF_POINTOPOINT) == 0) {
- error = EINVAL;
- goto out;
- }
- *(struct sockaddr_ipx *)&ifr->ifr_dstaddr = ia->ia_dstaddr;
- goto out;
- }
-
- switch (cmd) {
- case SIOCAIFADDR:
- case SIOCDIFADDR:
- priv = (cmd == SIOCAIFADDR) ? PRIV_NET_ADDIFADDR :
- PRIV_NET_DELIFADDR;
- if (td && (error = priv_check(td, priv)) != 0)
- goto out;
-
- IPX_IFADDR_RLOCK();
- if (ifra->ifra_addr.sipx_family == AF_IPX) {
- struct ipx_ifaddr *oia;
-
- for (oia = ia; ia; ia = TAILQ_NEXT(ia, ia_link)) {
- if (ia->ia_ifp == ifp &&
- ipx_neteq(ia->ia_addr.sipx_addr,
- ifra->ifra_addr.sipx_addr))
- break;
- }
- if (oia != NULL && oia != ia)
- ifa_free(&oia->ia_ifa);
- if (ia != NULL && oia != ia)
- ifa_ref(&ia->ia_ifa);
- }
- IPX_IFADDR_RUNLOCK();
- if (cmd == SIOCDIFADDR && ia == NULL) {
- error = EADDRNOTAVAIL;
- goto out;
- }
- /* FALLTHROUGH */
-
- case SIOCSIFADDR:
- case SIOCSIFDSTADDR:
- if (td && (error = priv_check(td, PRIV_NET_SETLLADDR)) != 0)
- goto out;
- if (ia == NULL) {
- ifa = ifa_alloc(sizeof(struct ipx_ifaddr), M_WAITOK);
- ia = (struct ipx_ifaddr *)ifa;
- ia->ia_ifp = ifp;
- ifa->ifa_addr = (struct sockaddr *)&ia->ia_addr;
- ifa->ifa_netmask = (struct sockaddr *)&ipx_netmask;
- ifa->ifa_dstaddr = (struct sockaddr *)&ia->ia_dstaddr;
- if (ifp->if_flags & IFF_BROADCAST) {
- ia->ia_broadaddr.sipx_family = AF_IPX;
- ia->ia_broadaddr.sipx_len =
- sizeof(ia->ia_addr);
- ia->ia_broadaddr.sipx_addr.x_host =
- ipx_broadhost;
- }
- ifa_ref(&ia->ia_ifa); /* ipx_ifaddrhead */
- IPX_IFADDR_WLOCK();
- TAILQ_INSERT_TAIL(&ipx_ifaddrhead, ia, ia_link);
- IPX_IFADDR_WUNLOCK();
-
- ifa_ref(&ia->ia_ifa); /* if_addrhead */
- IF_ADDR_WLOCK(ifp);
- TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link);
- IF_ADDR_WUNLOCK(ifp);
- }
- break;
-
- default:
- if (td && (error = priv_check(td, PRIV_NET_HWIOCTL)) != 0)
- goto out;
- }
-
- switch (cmd) {
- case SIOCSIFDSTADDR:
- if ((ifp->if_flags & IFF_POINTOPOINT) == 0) {
- error = EINVAL;
- goto out;
- }
- if (ia->ia_flags & IFA_ROUTE) {
- rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST);
- ia->ia_flags &= ~IFA_ROUTE;
- }
- if (ifp->if_ioctl) {
- error = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR,
- (void *)ia);
- if (error)
- goto out;
- }
- *(struct sockaddr *)&ia->ia_dstaddr = ifr->ifr_dstaddr;
- goto out;
-
- case SIOCSIFADDR:
- error = ipx_ifinit(ifp, ia,
- (struct sockaddr_ipx *)&ifr->ifr_addr, 1);
- goto out;
-
- case SIOCDIFADDR:
- ipx_ifscrub(ifp, ia);
- ifa = (struct ifaddr *)ia;
-
- IF_ADDR_WLOCK(ifp);
- TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
- IF_ADDR_WUNLOCK(ifp);
- ifa_free(ifa); /* if_addrhead */
-
- IPX_IFADDR_WLOCK();
- TAILQ_REMOVE(&ipx_ifaddrhead, ia, ia_link);
- IPX_IFADDR_WUNLOCK();
- ifa_free(&ia->ia_ifa); /* ipx_ifaddrhead */
- goto out;
-
- case SIOCAIFADDR:
- dstIsNew = 0;
- hostIsNew = 1;
- if (ia->ia_addr.sipx_family == AF_IPX) {
- if (ifra->ifra_addr.sipx_len == 0) {
- ifra->ifra_addr = ia->ia_addr;
- hostIsNew = 0;
- } else if (ipx_neteq(ifra->ifra_addr.sipx_addr,
- ia->ia_addr.sipx_addr))
- hostIsNew = 0;
- }
- if ((ifp->if_flags & IFF_POINTOPOINT) &&
- (ifra->ifra_dstaddr.sipx_family == AF_IPX)) {
- if (hostIsNew == 0)
- ipx_ifscrub(ifp, ia);
- ia->ia_dstaddr = ifra->ifra_dstaddr;
- dstIsNew = 1;
- }
- if (ifra->ifra_addr.sipx_family == AF_IPX &&
- (hostIsNew || dstIsNew))
- error = ipx_ifinit(ifp, ia, &ifra->ifra_addr, 0);
- goto out;
-
- default:
- if (ifp->if_ioctl == NULL) {
- error = EOPNOTSUPP;
- goto out;
- }
- error = ((*ifp->if_ioctl)(ifp, cmd, data));
- }
-
-out:
- if (ia != NULL)
- ifa_free(&ia->ia_ifa);
- return (error);
-}
-
-/*
- * Delete any previous route for an old address.
- */
-static void
-ipx_ifscrub(struct ifnet *ifp, struct ipx_ifaddr *ia)
-{
-
- if (ia->ia_flags & IFA_ROUTE) {
- if (ifp->if_flags & IFF_POINTOPOINT) {
- rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST);
- } else
- rtinit(&(ia->ia_ifa), (int)RTM_DELETE, 0);
- ia->ia_flags &= ~IFA_ROUTE;
- }
-}
-
-/*
- * Initialize an interface's internet address and routing table entry.
- */
-static int
-ipx_ifinit(struct ifnet *ifp, struct ipx_ifaddr *ia,
- struct sockaddr_ipx *sipx, int scrub)
-{
- struct sockaddr_ipx oldaddr;
- int s = splimp(), error;
-
- /*
- * Set up new addresses.
- */
- oldaddr = ia->ia_addr;
- ia->ia_addr = *sipx;
-
- /*
- * The convention we shall adopt for naming is that a supplied
- * address of zero means that "we don't care". Use the MAC address
- * of the interface. If it is an interface without a MAC address,
- * like a serial line, the address must be supplied.
- *
- * Give the interface a chance to initialize if this is its first
- * address, and to validate the address if necessary.
- */
- if (ifp->if_ioctl != NULL &&
- (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (void *)ia))) {
- ia->ia_addr = oldaddr;
- splx(s);
- return (error);
- }
- splx(s);
- ia->ia_ifa.ifa_metric = ifp->if_metric;
-
- /*
- * Add route for the network.
- */
- if (scrub) {
- ia->ia_ifa.ifa_addr = (struct sockaddr *)&oldaddr;
- ipx_ifscrub(ifp, ia);
- ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr;
- }
- if (ifp->if_flags & IFF_POINTOPOINT)
- rtinit(&(ia->ia_ifa), (int)RTM_ADD, RTF_HOST|RTF_UP);
- else {
- ia->ia_broadaddr.sipx_addr.x_net = ia->ia_addr.sipx_addr.x_net;
- rtinit(&(ia->ia_ifa), (int)RTM_ADD, RTF_UP);
- }
- ia->ia_flags |= IFA_ROUTE;
- return (0);
-}
-
-/*
- * Return address info for specified internet network.
- */
-struct ipx_ifaddr *
-ipx_iaonnetof(struct ipx_addr *dst)
-{
- struct ipx_ifaddr *ia;
- struct ipx_addr *compare;
- struct ifnet *ifp;
- struct ipx_ifaddr *ia_maybe = NULL;
- union ipx_net net = dst->x_net;
-
- IPX_IFADDR_LOCK_ASSERT();
-
- TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) {
- if ((ifp = ia->ia_ifp) != NULL) {
- if (ifp->if_flags & IFF_POINTOPOINT) {
- compare = &satoipx_addr(ia->ia_dstaddr);
- if (ipx_hosteq(*dst, *compare))
- return (ia);
- if (ipx_neteqnn(net,
- ia->ia_addr.sipx_addr.x_net))
- ia_maybe = ia;
- } else {
- if (ipx_neteqnn(net,
- ia->ia_addr.sipx_addr.x_net))
- return (ia);
- }
- }
- }
- return (ia_maybe);
-}
-
-void
-ipx_printhost(struct ipx_addr *addr)
-{
- u_short port;
- struct ipx_addr work = *addr;
- char *p; u_char *q;
- char *net = "", *host = "";
- char cport[10], chost[15], cnet[15];
-
- port = ntohs(work.x_port);
-
- if (ipx_nullnet(work) && ipx_nullhost(work)) {
- if (port)
- printf("*.%x", port);
- else
- printf("*.*");
-
- return;
- }
-
- if (ipx_wildnet(work))
- net = "any";
- else if (ipx_nullnet(work))
- net = "*";
- else {
- q = work.x_net.c_net;
- snprintf(cnet, sizeof(cnet), "%x%x%x%x",
- q[0], q[1], q[2], q[3]);
- for (p = cnet; *p == '0' && p < cnet + 8; p++)
- continue;
- net = p;
- }
-
- if (ipx_wildhost(work))
- host = "any";
- else if (ipx_nullhost(work))
- host = "*";
- else {
- q = work.x_host.c_host;
- snprintf(chost, sizeof(chost), "%x%x%x%x%x%x",
- q[0], q[1], q[2], q[3], q[4], q[5]);
- for (p = chost; *p == '0' && p < chost + 12; p++)
- continue;
- host = p;
- }
-
- if (port) {
- if (strcmp(host, "*") == 0) {
- host = "";
- snprintf(cport, sizeof(cport), "%x", port);
- } else
- snprintf(cport, sizeof(cport), ".%x", port);
- } else
- *cport = 0;
-
- printf("%s.%s%s", net, host, cport);
-}
diff --git a/sys/netipx/ipx.h b/sys/netipx/ipx.h
deleted file mode 100644
index 77022b2..0000000
--- a/sys/netipx/ipx.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx.h
- *
- * $FreeBSD$
- */
-
-#ifndef _NETIPX_IPX_H_
-#define _NETIPX_IPX_H_
-
-/*
- * Constants and Structures
- */
-
-/*
- * Protocols
- */
-#define IPXPROTO_UNKWN 0 /* Unknown */
-#define IPXPROTO_RI 1 /* RIP Routing Information */
-#define IPXPROTO_PXP 4 /* IPX Packet Exchange Protocol */
-#define IPXPROTO_SPX 5 /* SPX Sequenced Packet */
-#define IPXPROTO_NCP 17 /* NCP NetWare Core */
-#define IPXPROTO_NETBIOS 20 /* Propagated Packet */
-#define IPXPROTO_RAW 255 /* Placemarker*/
-#define IPXPROTO_MAX 256 /* Placemarker*/
-
-/*
- * Port/Socket numbers: network standard functions
- */
-
-#define IPXPORT_RI 1 /* NS RIP Routing Information */
-#define IPXPORT_ECHO 2 /* NS Echo */
-#define IPXPORT_RE 3 /* NS Router Error */
-#define IPXPORT_NCP 0x0451 /* NW NCP Core Protocol */
-#define IPXPORT_SAP 0x0452 /* NW SAP Service Advertising */
-#define IPXPORT_RIP 0x0453 /* NW RIP Routing Information */
-#define IPXPORT_NETBIOS 0x0455 /* NW NetBIOS */
-#define IPXPORT_DIAGS 0x0456 /* NW Diagnostics */
-/*
- * Ports < IPXPORT_RESERVED are reserved for privileged
- */
-#define IPXPORT_RESERVED 0x4000
-/*
- * Ports > IPXPORT_WELLKNOWN are reserved for privileged
- * processes (e.g. root).
- */
-#define IPXPORT_WELLKNOWN 0x6000
-
-/* flags passed to ipx_outputfl as last parameter */
-
-#define IPX_FORWARDING 0x1 /* most of ipx header exists */
-#define IPX_ROUTETOIF 0x10 /* same as SO_DONTROUTE */
-#define IPX_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
-
-#define IPX_MAXHOPS 15
-
-/* flags passed to get/set socket option */
-#define SO_HEADERS_ON_INPUT 1
-#define SO_HEADERS_ON_OUTPUT 2
-#define SO_DEFAULT_HEADERS 3
-#define SO_LAST_HEADER 4
-#define SO_IPXIP_ROUTE 5 /* No longer implemented. */
-#define SO_SEQNO 6
-#define SO_ALL_PACKETS 7
-#define SO_MTU 8
-#define SO_IPXTUN_ROUTE 9
-#define SO_IPX_CHECKSUM 10
-
-/*
- * IPX addressing
- */
-union ipx_host {
- u_char c_host[6];
- u_short s_host[3];
-};
-
-union ipx_net {
- u_char c_net[4];
- u_short s_net[2];
-};
-
-union ipx_net_u {
- union ipx_net net_e;
- u_long long_e;
-};
-
-struct ipx_addr {
- union ipx_net x_net;
- union ipx_host x_host;
- u_short x_port;
-};
-
-/*
- * Socket address
- */
-struct sockaddr_ipx {
- u_char sipx_len;
- u_char sipx_family;
- struct ipx_addr sipx_addr;
- char sipx_zero[2];
-};
-#define sipx_port sipx_addr.x_port
-
-/*
- * Definitions for IPX Internetwork Packet Exchange Protocol
- */
-struct ipx {
- u_short ipx_sum; /* Checksum */
- u_short ipx_len; /* Length, in bytes, including header */
- u_char ipx_tc; /* Transport Control (i.e. hop count) */
- u_char ipx_pt; /* Packet Type (i.e. level 2 protocol) */
- struct ipx_addr ipx_dna; /* Destination Network Address */
- struct ipx_addr ipx_sna; /* Source Network Address */
-} __packed;
-
-#define ipx_neteqnn(a,b) \
- (((a).s_net[0] == (b).s_net[0]) && ((a).s_net[1] == (b).s_net[1]))
-#define ipx_neteq(a,b) ipx_neteqnn((a).x_net, (b).x_net)
-#define satoipx_addr(sa) (((struct sockaddr_ipx *)&(sa))->sipx_addr)
-#define ipx_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \
- (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])
-#define ipx_hosteq(s,t) (ipx_hosteqnh((s).x_host,(t).x_host))
-#define ipx_nullnet(x) (((x).x_net.s_net[0]==0) && ((x).x_net.s_net[1]==0))
-#define ipx_nullhost(x) (((x).x_host.s_host[0] == 0) && \
- ((x).x_host.s_host[1] == 0) && ((x).x_host.s_host[2] == 0))
-#define ipx_wildnet(x) (((x).x_net.s_net[0] == 0xffff) && \
- ((x).x_net.s_net[1] == 0xffff))
-#define ipx_wildhost(x) (((x).x_host.s_host[0] == 0xffff) && \
- ((x).x_host.s_host[1] == 0xffff) && ((x).x_host.s_host[2] == 0xffff))
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-struct ipx_addr ipx_addr(const char *);
-char *ipx_ntoa(struct ipx_addr);
-__END_DECLS
-
-#endif /* !_NETIPX_IPX_H_ */
diff --git a/sys/netipx/ipx_cksum.c b/sys/netipx/ipx_cksum.c
deleted file mode 100644
index 6aa87fb..0000000
--- a/sys/netipx/ipx_cksum.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx_cksum.c
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/mbuf.h>
-#include <sys/libkern.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_var.h>
-
-
-#define SUMADV sum += *w++
-
-u_short
-ipx_cksum(struct mbuf *m, int len)
-{
- u_int32_t sum = 0;
- u_char *w;
- u_char oldtc;
- int mlen, words;
- struct ipx *ipx;
- union {
- u_char b[2];
- u_short w;
- } buf;
-
- ipx = mtod(m, struct ipx*);
- oldtc = ipx->ipx_tc;
- ipx->ipx_tc = 0;
- w = (u_char *)&ipx->ipx_len;
- len -= 2;
- mlen = 2;
-
- for(;;) {
- mlen = imin(m->m_len - mlen, len);
- words = mlen / 2;
- len -= mlen & ~1;
- while (words >= 16) {
- SUMADV; SUMADV; SUMADV; SUMADV;
- SUMADV; SUMADV; SUMADV; SUMADV;
- SUMADV; SUMADV; SUMADV; SUMADV;
- SUMADV; SUMADV; SUMADV; SUMADV;
- words -= 16;
- }
- while (words--)
- SUMADV;
- if (len == 0)
- break;
- mlen &= 1;
- if (mlen) {
- buf.b[0] = *w;
- if (--len == 0) {
- buf.b[1] = 0;
- sum += buf.w;
- break;
- }
- }
- m = m->m_next;
- if (m == NULL)
- break;
- w = mtod(m, u_char *);
- if (mlen) {
- buf.b[1] = *w;
- sum += buf.w;
- w++;
- if (--len == 0)
- break;
- }
- }
-
- ipx->ipx_tc = oldtc;
-
- sum = (sum & 0xffff) + (sum >> 16);
- if (sum >= 0x10000)
- sum++;
- if (sum)
- sum = ~sum;
- return (sum);
-}
diff --git a/sys/netipx/ipx_if.h b/sys/netipx/ipx_if.h
deleted file mode 100644
index 7725b4a..0000000
--- a/sys/netipx/ipx_if.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
-
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx_if.h
- *
- * $FreeBSD$
- */
-
-#ifndef _NETIPX_IPX_IF_H_
-#define _NETIPX_IPX_IF_H_
-
-/*
- * Interface address. One of these structures
- * is allocated for each interface with an internet address.
- * The ifaddr structure contains the protocol-independent part
- * of the structure and is assumed to be first.
- */
-#ifdef _KERNEL
-struct ipx_ifaddr {
- struct ifaddr ia_ifa; /* protocol-independent info */
-#define ia_ifp ia_ifa.ifa_ifp
-#define ia_flags ia_ifa.ifa_flags
- TAILQ_ENTRY(ipx_ifaddr) ia_link; /* list of IPv6 addresses */
- struct sockaddr_ipx ia_addr; /* reserve space for my address */
- struct sockaddr_ipx ia_dstaddr; /* space for my broadcast address */
-#define ia_broadaddr ia_dstaddr
- struct sockaddr_ipx ia_netmask; /* space for my network mask */
-};
-#endif /* _KERNEL */
-
-struct ipx_aliasreq {
- char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
- struct sockaddr_ipx ifra_addr;
- struct sockaddr_ipx ifra_broadaddr;
-#define ifra_dstaddr ifra_broadaddr
-};
-
-/*
- * List of ipx_ifaddr's.
- */
-TAILQ_HEAD(ipx_ifaddrhead, ipx_ifaddr);
-
-/*
- * Given a pointer to an ipx_ifaddr (ifaddr),
- * return a pointer to the addr as a sockadd_ipx.
- */
-
-#define IA_SIPX(ia) (&(((struct ipx_ifaddr *)(ia))->ia_addr))
-
-/* This is not the right place for this but where is? */
-
-#define ETHERTYPE_IPX_8022 0x00e0 /* Ethernet_802.2 */
-#define ETHERTYPE_IPX_8023 0x0000 /* Ethernet_802.3 */
-#define ETHERTYPE_IPX_II 0x8137 /* Ethernet_II */
-#define ETHERTYPE_IPX_SNAP 0x8137 /* Ethernet_SNAP */
-
-#define ETHERTYPE_IPX 0x8137 /* Only Ethernet_II Available */
-
-#ifdef _KERNEL
-extern struct rwlock ipx_ifaddr_rw;
-extern struct ipx_ifaddrhead ipx_ifaddrhead;
-
-#define IPX_IFADDR_LOCK_INIT() rw_init(&ipx_ifaddr_rw, "ipx_ifaddr_rw")
-#define IPX_IFADDR_LOCK_ASSERT() rw_assert(&ipx_ifaddr_rw, RA_LOCKED)
-#define IPX_IFADDR_RLOCK() rw_rlock(&ipx_ifaddr_rw)
-#define IPX_IFADDR_RUNLOCK() rw_runlock(&ipx_ifaddr_rw)
-#define IPX_IFADDR_WLOCK() rw_wlock(&ipx_ifaddr_rw)
-#define IPX_IFADDR_WUNLOCK() rw_wunlock(&ipx_ifaddr_rw)
-#define IPX_IFADDR_RLOCK_ASSERT() rw_assert(&ipx_ifaddr_rw, RA_WLOCKED)
-
-struct ipx_ifaddr *ipx_iaonnetof(struct ipx_addr *dst);
-#endif
-
-#endif /* !_NETIPX_IPX_IF_H_ */
diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c
deleted file mode 100644
index 353e440..0000000
--- a/sys/netipx/ipx_input.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California.
- * Copyright (c) 2004-2009 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx_input.c
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/kernel.h>
-#include <sys/random.h>
-#include <sys/lock.h>
-#include <sys/rwlock.h>
-#include <sys/sysctl.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/route.h>
-#include <net/netisr.h>
-
-#include <netipx/ipx.h>
-#include <netipx/spx.h>
-#include <netipx/ipx_if.h>
-#include <netipx/ipx_pcb.h>
-#include <netipx/ipx_var.h>
-
-int ipxcksum = 0;
-SYSCTL_INT(_net_ipx_ipx, OID_AUTO, checksum, CTLFLAG_RW,
- &ipxcksum, 0, "Compute ipx checksum");
-
-static int ipxprintfs = 0; /* printing forwarding information */
-SYSCTL_INT(_net_ipx_ipx, OID_AUTO, ipxprintfs, CTLFLAG_RW,
- &ipxprintfs, 0, "Printing forwarding information");
-
-static int ipxforwarding = 0;
-SYSCTL_INT(_net_ipx_ipx, OID_AUTO, ipxforwarding, CTLFLAG_RW,
- &ipxforwarding, 0, "Enable ipx forwarding");
-
-static int ipxnetbios = 0;
-SYSCTL_INT(_net_ipx, OID_AUTO, ipxnetbios, CTLFLAG_RW,
- &ipxnetbios, 0, "Propagate netbios over ipx");
-
-static int ipx_do_route(struct ipx_addr *src, struct route *ro);
-static void ipx_undo_route(struct route *ro);
-static void ipx_forward(struct mbuf *m);
-static void ipxintr(struct mbuf *m);
-
-const union ipx_net ipx_zeronet;
-
-const union ipx_net ipx_broadnet = { .s_net[0] = 0xffff,
- .s_net[1] = 0xffff };
-const union ipx_host ipx_broadhost = { .s_host[0] = 0xffff,
- .s_host[1] = 0xffff,
- .s_host[2] = 0xffff };
-
-struct ipxstat ipxstat;
-struct sockaddr_ipx ipx_netmask, ipx_hostmask;
-
-/*
- * IPX protocol control block (pcb) lists.
- */
-struct mtx ipxpcb_list_mtx;
-struct ipxpcbhead ipxpcb_list;
-struct ipxpcbhead ipxrawpcb_list;
-
-static struct netisr_handler ipx_nh = {
- .nh_name = "ipx",
- .nh_handler = ipxintr,
- .nh_proto = NETISR_IPX,
- .nh_policy = NETISR_POLICY_SOURCE,
-};
-
-long ipx_pexseq; /* Locked with ipxpcb_list_mtx. */
-
-/*
- * IPX initialization.
- */
-
-void
-ipx_init(void)
-{
-
- read_random(&ipx_pexseq, sizeof ipx_pexseq);
-
- LIST_INIT(&ipxpcb_list);
- LIST_INIT(&ipxrawpcb_list);
- TAILQ_INIT(&ipx_ifaddrhead);
-
- IPX_LIST_LOCK_INIT();
- IPX_IFADDR_LOCK_INIT();
-
- ipx_netmask.sipx_len = 6;
- ipx_netmask.sipx_addr.x_net = ipx_broadnet;
-
- ipx_hostmask.sipx_len = 12;
- ipx_hostmask.sipx_addr.x_net = ipx_broadnet;
- ipx_hostmask.sipx_addr.x_host = ipx_broadhost;
-
- netisr_register(&ipx_nh);
-}
-
-/*
- * IPX input routine. Pass to next level.
- */
-static void
-ipxintr(struct mbuf *m)
-{
- struct ipx *ipx;
- struct ipxpcb *ipxp;
- struct ipx_ifaddr *ia;
- int len;
-
- /*
- * If no IPX addresses have been set yet but the interfaces
- * are receiving, can't do anything with incoming packets yet.
- */
- if (TAILQ_EMPTY(&ipx_ifaddrhead)) {
- m_freem(m);
- return;
- }
-
- ipxstat.ipxs_total++;
-
- if ((m->m_flags & M_EXT || m->m_len < sizeof(struct ipx)) &&
- (m = m_pullup(m, sizeof(struct ipx))) == NULL) {
- ipxstat.ipxs_toosmall++;
- return;
- }
-
- /*
- * Give any raw listeners a crack at the packet
- */
- IPX_LIST_LOCK();
- LIST_FOREACH(ipxp, &ipxrawpcb_list, ipxp_list) {
- struct mbuf *m1 = m_copy(m, 0, (int)M_COPYALL);
- if (m1 != NULL) {
- IPX_LOCK(ipxp);
- ipx_input(m1, ipxp);
- IPX_UNLOCK(ipxp);
- }
- }
- IPX_LIST_UNLOCK();
-
- ipx = mtod(m, struct ipx *);
- len = ntohs(ipx->ipx_len);
- /*
- * Check that the amount of data in the buffers
- * is as at least much as the IPX header would have us expect.
- * Trim mbufs if longer than we expect.
- * Drop packet if shorter than we expect.
- */
- if (m->m_pkthdr.len < len) {
- ipxstat.ipxs_tooshort++;
- m_freem(m);
- return;
- }
- if (m->m_pkthdr.len > len) {
- if (m->m_len == m->m_pkthdr.len) {
- m->m_len = len;
- m->m_pkthdr.len = len;
- } else
- m_adj(m, len - m->m_pkthdr.len);
- }
- if (ipxcksum && ipx->ipx_sum != 0xffff) {
- if (ipx->ipx_sum != ipx_cksum(m, len)) {
- ipxstat.ipxs_badsum++;
- m_freem(m);
- return;
- }
- }
-
- /*
- * Propagated (Netbios) packets (type 20) has to be handled
- * different. :-(
- */
- if (ipx->ipx_pt == IPXPROTO_NETBIOS) {
- if (ipxnetbios) {
- ipx_output_type20(m);
- return;
- } else {
- m_freem(m);
- return;
- }
- }
-
- /*
- * Is this a directed broadcast?
- */
- if (ipx_hosteqnh(ipx_broadhost,ipx->ipx_dna.x_host)) {
- if ((!ipx_neteq(ipx->ipx_dna, ipx->ipx_sna)) &&
- (!ipx_neteqnn(ipx->ipx_dna.x_net, ipx_broadnet)) &&
- (!ipx_neteqnn(ipx->ipx_sna.x_net, ipx_zeronet)) &&
- (!ipx_neteqnn(ipx->ipx_dna.x_net, ipx_zeronet)) ) {
- /*
- * If it is a broadcast to the net where it was
- * received from, treat it as ours.
- */
- IPX_IFADDR_RLOCK();
- TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) {
- if ((ia->ia_ifa.ifa_ifp == m->m_pkthdr.rcvif)
- && ipx_neteq(ia->ia_addr.sipx_addr,
- ipx->ipx_dna)) {
- IPX_IFADDR_RUNLOCK();
- goto ours;
- }
- }
- IPX_IFADDR_RUNLOCK();
-
- /*
- * Look to see if I need to eat this packet.
- * Algorithm is to forward all young packets
- * and prematurely age any packets which will
- * by physically broadcasted.
- * Any very old packets eaten without forwarding
- * would die anyway.
- *
- * Suggestion of Bill Nesheim, Cornell U.
- */
- if (ipx->ipx_tc < IPX_MAXHOPS) {
- ipx_forward(m);
- return;
- }
- }
- /*
- * Is this our packet? If not, forward.
- */
- } else {
- IPX_IFADDR_RLOCK();
- TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) {
- if (ipx_hosteq(ipx->ipx_dna, ia->ia_addr.sipx_addr) &&
- (ipx_neteq(ipx->ipx_dna, ia->ia_addr.sipx_addr) ||
- ipx_neteqnn(ipx->ipx_dna.x_net, ipx_zeronet)))
- break;
- }
- IPX_IFADDR_RUNLOCK();
- if (ia == NULL) {
- ipx_forward(m);
- return;
- }
- }
-ours:
- /*
- * Locate pcb for datagram.
- */
- IPX_LIST_LOCK();
- ipxp = ipx_pcblookup(&ipx->ipx_sna, ipx->ipx_dna.x_port, IPX_WILDCARD);
- /*
- * Switch out to protocol's input routine.
- */
- if (ipxp != NULL) {
- ipxstat.ipxs_delivered++;
- if ((ipxp->ipxp_flags & IPXP_ALL_PACKETS) == 0)
- switch (ipx->ipx_pt) {
- case IPXPROTO_SPX:
- IPX_LOCK(ipxp);
- /* Will release both locks. */
- spx_input(m, ipxp);
- return;
- }
- IPX_LOCK(ipxp);
- ipx_input(m, ipxp);
- IPX_UNLOCK(ipxp);
- } else
- m_freem(m);
- IPX_LIST_UNLOCK();
-}
-
-void
-ipx_ctlinput(cmd, arg_as_sa, dummy)
- int cmd;
- struct sockaddr *arg_as_sa; /* XXX should be swapped with dummy */
- void *dummy;
-{
-
- /* Currently, nothing. */
-}
-
-/*
- * Forward a packet. If some error occurs drop the packet. IPX don't
- * have a way to return errors to the sender.
- */
-
-static struct route ipx_droute;
-static struct route ipx_sroute;
-
-static void
-ipx_forward(struct mbuf *m)
-{
- struct ipx *ipx = mtod(m, struct ipx *);
- int error;
- int agedelta = 1;
- int flags = IPX_FORWARDING;
- int ok_there = 0;
- int ok_back = 0;
-
- if (ipxforwarding == 0) {
- /* can't tell difference between net and host */
- ipxstat.ipxs_cantforward++;
- m_freem(m);
- goto cleanup;
- }
- ipx->ipx_tc++;
- if (ipx->ipx_tc > IPX_MAXHOPS) {
- ipxstat.ipxs_cantforward++;
- m_freem(m);
- goto cleanup;
- }
-
- if ((ok_there = ipx_do_route(&ipx->ipx_dna,&ipx_droute)) == 0) {
- ipxstat.ipxs_noroute++;
- m_freem(m);
- goto cleanup;
- }
- /*
- * Here we think about forwarding broadcast packets,
- * so we try to insure that it doesn't go back out
- * on the interface it came in on. Also, if we
- * are going to physically broadcast this, let us
- * age the packet so we can eat it safely the second time around.
- */
- if (ipx->ipx_dna.x_host.c_host[0] & 0x1) {
- struct ipx_ifaddr *ia;
- struct ifnet *ifp;
-
- IPX_IFADDR_RLOCK();
- ia = ipx_iaonnetof(&ipx->ipx_dna);
- if (ia != NULL) {
- /* I'm gonna hafta eat this packet */
- agedelta += IPX_MAXHOPS - ipx->ipx_tc;
- ipx->ipx_tc = IPX_MAXHOPS;
- }
- IPX_IFADDR_RUNLOCK();
- if ((ok_back = ipx_do_route(&ipx->ipx_sna,&ipx_sroute)) == 0) {
- /* error = ENETUNREACH; He'll never get it! */
- ipxstat.ipxs_noroute++;
- m_freem(m);
- goto cleanup;
- }
- if (ipx_droute.ro_rt &&
- (ifp = ipx_droute.ro_rt->rt_ifp) &&
- ipx_sroute.ro_rt &&
- (ifp != ipx_sroute.ro_rt->rt_ifp)) {
- flags |= IPX_ALLOWBROADCAST;
- } else {
- ipxstat.ipxs_noroute++;
- m_freem(m);
- goto cleanup;
- }
- }
- /*
- * We don't need to recompute checksum because ipx_tc field
- * is ignored by checksum calculation routine, however
- * it may be desirable to reset checksum if ipxcksum == 0
- */
-#if 0
- if (!ipxcksum)
- ipx->ipx_sum = 0xffff;
-#endif
-
- error = ipx_outputfl(m, &ipx_droute, flags);
- if (error == 0) {
- ipxstat.ipxs_forward++;
-
- if (ipxprintfs) {
- printf("forward: ");
- ipx_printhost(&ipx->ipx_sna);
- printf(" to ");
- ipx_printhost(&ipx->ipx_dna);
- printf(" hops %d\n", ipx->ipx_tc);
- }
- }
-cleanup:
- if (ok_there)
- ipx_undo_route(&ipx_droute);
- if (ok_back)
- ipx_undo_route(&ipx_sroute);
-}
-
-static int
-ipx_do_route(struct ipx_addr *src, struct route *ro)
-{
- struct sockaddr_ipx *dst;
-
- bzero((caddr_t)ro, sizeof(*ro));
- dst = (struct sockaddr_ipx *)&ro->ro_dst;
-
- dst->sipx_len = sizeof(*dst);
- dst->sipx_family = AF_IPX;
- dst->sipx_addr = *src;
- dst->sipx_addr.x_port = 0;
- rtalloc_ign(ro, 0);
- if (ro->ro_rt == NULL || ro->ro_rt->rt_ifp == NULL) {
- return (0);
- }
- counter_u64_add(ro->ro_rt->rt_pksent, 1);
- return (1);
-}
-
-static void
-ipx_undo_route(struct route *ro)
-{
-
- if (ro->ro_rt != NULL) {
- RTFREE(ro->ro_rt);
- }
-}
diff --git a/sys/netipx/ipx_outputfl.c b/sys/netipx/ipx_outputfl.c
deleted file mode 100644
index e92542e..0000000
--- a/sys/netipx/ipx_outputfl.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx_outputfl.c
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/route.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#include <netipx/ipx_var.h>
-
-int
-ipx_outputfl(struct mbuf *m0, struct route *ro, int flags)
-{
- struct ipx *ipx = mtod(m0, struct ipx *);
- struct ifnet *ifp = NULL;
- int error = 0;
- struct sockaddr_ipx *dst;
- struct route ipxroute;
-
- /*
- * Route packet.
- */
- if (ro == NULL) {
- ro = &ipxroute;
- bzero((caddr_t)ro, sizeof(*ro));
- }
- dst = (struct sockaddr_ipx *)&ro->ro_dst;
- if (ro->ro_rt == NULL) {
- dst->sipx_family = AF_IPX;
- dst->sipx_len = sizeof(*dst);
- dst->sipx_addr = ipx->ipx_dna;
- dst->sipx_addr.x_port = 0;
- /*
- * If routing to interface only,
- * short circuit routing lookup.
- */
- if (flags & IPX_ROUTETOIF) {
- struct ipx_ifaddr *ia;
-
- IPX_IFADDR_RLOCK();
- ia = ipx_iaonnetof(&ipx->ipx_dna);
- if (ia == NULL) {
- IPX_IFADDR_RUNLOCK();
- ipxstat.ipxs_noroute++;
- error = ENETUNREACH;
- goto bad;
- }
- ifp = ia->ia_ifp;
- IPX_IFADDR_RUNLOCK();
- goto gotif;
- }
- rtalloc_ign(ro, 0);
- } else if ((ro->ro_rt->rt_flags & RTF_UP) == 0) {
- /*
- * The old route has gone away; try for a new one.
- */
- RTFREE(ro->ro_rt);
- ro->ro_rt = NULL;
- rtalloc_ign(ro, 0);
- }
- if (ro->ro_rt == NULL || (ifp = ro->ro_rt->rt_ifp) == NULL) {
- ipxstat.ipxs_noroute++;
- error = ENETUNREACH;
- goto bad;
- }
- counter_u64_add(ro->ro_rt->rt_pksent, 1);
- if (ro->ro_rt->rt_flags & (RTF_GATEWAY|RTF_HOST))
- dst = (struct sockaddr_ipx *)ro->ro_rt->rt_gateway;
-gotif:
- /*
- * Look for multicast addresses and
- * and verify user is allowed to send
- * such a packet.
- */
- if (dst->sipx_addr.x_host.c_host[0]&1) {
- if ((ifp->if_flags & (IFF_BROADCAST | IFF_LOOPBACK)) == 0) {
- error = EADDRNOTAVAIL;
- goto bad;
- }
- if ((flags & IPX_ALLOWBROADCAST) == 0) {
- error = EACCES;
- goto bad;
- }
- m0->m_flags |= M_BCAST;
- }
-
- if (htons(ipx->ipx_len) <= ifp->if_mtu) {
- ipxstat.ipxs_localout++;
- error = (*ifp->if_output)(ifp, m0,
- (struct sockaddr *)dst, ro);
- goto done;
- } else {
- ipxstat.ipxs_mtutoosmall++;
- error = EMSGSIZE;
- }
-bad:
- m_freem(m0);
-done:
- if (ro == &ipxroute && (flags & IPX_ROUTETOIF) == 0 &&
- ro->ro_rt != NULL) {
- RTFREE(ro->ro_rt);
- ro->ro_rt = NULL;
- }
- return (error);
-}
-
-/*
- * This will broadcast the type 20 (Netbios) packet to all the interfaces
- * that have ipx configured and isn't in the list yet.
- */
-int
-ipx_output_type20(struct mbuf *m)
-{
- struct ipx *ipx;
- union ipx_net *nbnet;
- struct ipx_ifaddr *ia, *tia;
- int error = 0;
- struct mbuf *m1;
- int i;
- struct ifnet *ifp;
- struct sockaddr_ipx dst;
-
- /*
- * We have to get to the 32 bytes after the ipx header also, so
- * that we can fill in the network address of the receiving
- * interface.
- */
- if ((m->m_flags & M_EXT || m->m_len < (sizeof(struct ipx) + 32)) &&
- (m = m_pullup(m, sizeof(struct ipx) + 32)) == NULL) {
- ipxstat.ipxs_toosmall++;
- return (0);
- }
- ipx = mtod(m, struct ipx *);
- nbnet = (union ipx_net *)(ipx + 1);
-
- if (ipx->ipx_tc >= 8)
- goto bad;
- /*
- * Now see if we have already seen this.
- */
- tia = NULL;
- IPX_IFADDR_RLOCK();
- TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) {
- if (ia->ia_ifa.ifa_ifp == m->m_pkthdr.rcvif) {
- if (tia == NULL)
- tia = ia;
- for (i=0; i < ipx->ipx_tc; i++, nbnet++) {
- if (ipx_neteqnn(ia->ia_addr.sipx_addr.x_net,
- *nbnet)) {
- IPX_IFADDR_RUNLOCK();
- goto bad;
- }
- }
- }
- }
-
- /*
- * Don't route the packet if the interface where it come from
- * does not have an IPX address.
- */
- if (tia == NULL) {
- IPX_IFADDR_RUNLOCK();
- goto bad;
- }
-
- /*
- * Add our receiving interface to the list.
- */
- nbnet = (union ipx_net *)(ipx + 1);
- nbnet += ipx->ipx_tc;
- *nbnet = tia->ia_addr.sipx_addr.x_net;
-
- /*
- * Increment the hop count.
- */
- ipx->ipx_tc++;
- ipxstat.ipxs_forward++;
-
- /*
- * Send to all directly connected ifaces not in list and
- * not to the one it came from.
- */
- m->m_flags &= ~M_BCAST;
- bzero(&dst, sizeof(dst));
- dst.sipx_family = AF_IPX;
- dst.sipx_len = 12;
- dst.sipx_addr.x_host = ipx_broadhost;
-
- TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) {
- if (ia->ia_ifa.ifa_ifp != m->m_pkthdr.rcvif) {
- nbnet = (union ipx_net *)(ipx + 1);
- for (i=0; i < ipx->ipx_tc; i++, nbnet++)
- if (ipx_neteqnn(ia->ia_addr.sipx_addr.x_net,
- *nbnet))
- goto skip_this;
-
- /*
- * Insert the net address of the dest net and
- * calculate the new checksum if needed.
- */
- ifp = ia->ia_ifa.ifa_ifp;
- dst.sipx_addr.x_net = ia->ia_addr.sipx_addr.x_net;
- ipx->ipx_dna.x_net = dst.sipx_addr.x_net;
- if(ipx->ipx_sum != 0xffff)
- ipx->ipx_sum = ipx_cksum(m, ntohs(ipx->ipx_len));
-
- m1 = m_copym(m, 0, M_COPYALL, M_NOWAIT);
- if(m1) {
- error = (*ifp->if_output)(ifp, m1,
- (struct sockaddr *)&dst, NULL);
- /* XXX ipxstat.ipxs_localout++; */
- }
-skip_this: ;
- }
- }
- IPX_IFADDR_RUNLOCK();
-
-bad:
- m_freem(m);
- return (error);
-}
diff --git a/sys/netipx/ipx_pcb.c b/sys/netipx/ipx_pcb.c
deleted file mode 100644
index 61510bb..0000000
--- a/sys/netipx/ipx_pcb.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California.
- * Copyright (c) 2004-2009 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx_pcb.c
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/priv.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/route.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#include <netipx/ipx_pcb.h>
-#include <netipx/ipx_var.h>
-
-static struct ipx_addr zeroipx_addr;
-static u_short ipxpcb_lport_cache;
-
-int
-ipx_pcballoc(struct socket *so, struct ipxpcbhead *head, struct thread *td)
-{
- struct ipxpcb *ipxp;
-
- KASSERT(so->so_pcb == NULL, ("ipx_pcballoc: so_pcb != NULL"));
- IPX_LIST_LOCK_ASSERT();
-
- ipxp = malloc(sizeof *ipxp, M_PCB, M_NOWAIT | M_ZERO);
- if (ipxp == NULL)
- return (ENOBUFS);
- IPX_LOCK_INIT(ipxp);
- ipxp->ipxp_socket = so;
- if (ipxcksum)
- ipxp->ipxp_flags |= IPXP_CHECKSUM;
- LIST_INSERT_HEAD(head, ipxp, ipxp_list);
- so->so_pcb = (caddr_t)ipxp;
- return (0);
-}
-
-int
-ipx_pcbbind(struct ipxpcb *ipxp, struct sockaddr *nam, struct thread *td)
-{
- struct sockaddr_ipx *sipx;
- u_short lport = 0;
-
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(ipxp);
-
- if (ipxp->ipxp_lport || !ipx_nullhost(ipxp->ipxp_laddr))
- return (EINVAL);
- if (nam == NULL)
- goto noname;
- sipx = (struct sockaddr_ipx *)nam;
- if (!ipx_nullhost(sipx->sipx_addr)) {
- int tport = sipx->sipx_port;
-
- sipx->sipx_port = 0; /* yech... */
- if (ifa_ifwithaddr_check((struct sockaddr *)sipx) == 0)
- return (EADDRNOTAVAIL);
- sipx->sipx_port = tport;
- }
- lport = sipx->sipx_port;
- if (lport) {
- u_short aport = ntohs(lport);
-
- if (aport < IPXPORT_RESERVED && td != NULL &&
- priv_check(td, PRIV_NETIPX_RESERVEDPORT))
- return (EACCES);
- if (ipx_pcblookup(&zeroipx_addr, lport, 0))
- return (EADDRINUSE);
- }
- ipxp->ipxp_laddr = sipx->sipx_addr;
-noname:
- if (lport == 0)
- do {
- ipxpcb_lport_cache++;
- if ((ipxpcb_lport_cache < IPXPORT_RESERVED) ||
- (ipxpcb_lport_cache >= IPXPORT_WELLKNOWN))
- ipxpcb_lport_cache = IPXPORT_RESERVED;
- lport = htons(ipxpcb_lport_cache);
- } while (ipx_pcblookup(&zeroipx_addr, lport, 0));
- ipxp->ipxp_lport = lport;
- return (0);
-}
-
-/*
- * Connect from a socket to a specified address.
- * Both address and port must be specified in argument sipx.
- * If don't have a local address for this socket yet,
- * then pick one.
- */
-int
-ipx_pcbconnect(struct ipxpcb *ipxp, struct sockaddr *nam, struct thread *td)
-{
- struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)nam;
- struct ipx_addr *dst;
- struct route *ro;
- struct ifnet *ifp;
-
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(ipxp);
-
- if (sipx->sipx_family != AF_IPX)
- return (EAFNOSUPPORT);
- if (sipx->sipx_port == 0 || ipx_nullhost(sipx->sipx_addr))
- return (EADDRNOTAVAIL);
- /*
- * If we haven't bound which network number to use as ours,
- * we will use the number of the outgoing interface.
- * This depends on having done a routing lookup, which
- * we will probably have to do anyway, so we might
- * as well do it now. On the other hand if we are
- * sending to multiple destinations we may have already
- * done the lookup, so see if we can use the route
- * from before. In any case, we only
- * chose a port number once, even if sending to multiple
- * destinations.
- */
- ro = &ipxp->ipxp_route;
- dst = &satoipx_addr(ro->ro_dst);
- if (ipxp->ipxp_socket->so_options & SO_DONTROUTE)
- goto flush;
- if (!ipx_neteq(ipxp->ipxp_lastdst, sipx->sipx_addr))
- goto flush;
- if (!ipx_hosteq(ipxp->ipxp_lastdst, sipx->sipx_addr)) {
- if (ro->ro_rt != NULL && !(ro->ro_rt->rt_flags & RTF_HOST)) {
- /* can patch route to avoid rtalloc */
- *dst = sipx->sipx_addr;
- } else {
- flush:
- if (ro->ro_rt != NULL)
- RTFREE(ro->ro_rt);
- ro->ro_rt = NULL;
- }
- }/* else cached route is ok; do nothing */
- ipxp->ipxp_lastdst = sipx->sipx_addr;
- if ((ipxp->ipxp_socket->so_options & SO_DONTROUTE) == 0 && /*XXX*/
- (ro->ro_rt == NULL || ro->ro_rt->rt_ifp == NULL)) {
- /* No route yet, so try to acquire one */
- ro->ro_dst.sa_family = AF_IPX;
- ro->ro_dst.sa_len = sizeof(ro->ro_dst);
- *dst = sipx->sipx_addr;
- dst->x_port = 0;
- rtalloc_ign(ro, 0);
- }
- if (ipx_neteqnn(ipxp->ipxp_laddr.x_net, ipx_zeronet)) {
- struct ipx_ifaddr *ia = NULL;
-
- /*
- * If route is known or can be allocated now,
- * our src addr is taken from the i/f, else punt.
- */
-
- /*
- * If we found a route, use the address
- * corresponding to the outgoing interface
- */
- if (ro->ro_rt != NULL && (ifp = ro->ro_rt->rt_ifp) != NULL) {
- IPX_IFADDR_RLOCK();
- TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) {
- if (ia->ia_ifp == ifp) {
- ifa_ref(&ia->ia_ifa);
- break;
- }
- }
- IPX_IFADDR_RUNLOCK();
- }
- if (ia == NULL) {
- u_short fport = sipx->sipx_addr.x_port;
- sipx->sipx_addr.x_port = 0;
- ia = (struct ipx_ifaddr *)
- ifa_ifwithdstaddr((struct sockaddr *)sipx);
- sipx->sipx_addr.x_port = fport;
- if (ia == NULL) {
- IPX_IFADDR_RLOCK();
- ia = ipx_iaonnetof(&sipx->sipx_addr);
- if (ia != NULL)
- ifa_ref(&ia->ia_ifa);
- IPX_IFADDR_RUNLOCK();
- }
- if (ia == NULL) {
- IPX_IFADDR_RLOCK();
- ia = TAILQ_FIRST(&ipx_ifaddrhead);
- if (ia != NULL)
- ifa_ref(&ia->ia_ifa);
- IPX_IFADDR_RUNLOCK();
- }
- if (ia == NULL)
- return (EADDRNOTAVAIL);
- }
- ipxp->ipxp_laddr.x_net = satoipx_addr(ia->ia_addr).x_net;
- ifa_free(&ia->ia_ifa);
- }
- if (ipx_nullhost(ipxp->ipxp_laddr)) {
- struct ipx_ifaddr *ia = NULL;
- /*
- * If route is known or can be allocated now,
- * our src addr is taken from the i/f, else punt.
- */
-
- /*
- * If we found a route, use the address
- * corresponding to the outgoing interface
- */
- if (ro->ro_rt != NULL && (ifp = ro->ro_rt->rt_ifp) != NULL) {
- IPX_IFADDR_RLOCK();
- TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) {
- if (ia->ia_ifp == ifp) {
- ifa_ref(&ia->ia_ifa);
- break;
- }
- }
- IPX_IFADDR_RUNLOCK();
- }
- if (ia == NULL) {
- u_short fport = sipx->sipx_addr.x_port;
- sipx->sipx_addr.x_port = 0;
- ia = (struct ipx_ifaddr *)
- ifa_ifwithdstaddr((struct sockaddr *)sipx);
- sipx->sipx_addr.x_port = fport;
- if (ia == NULL) {
- IPX_IFADDR_RLOCK();
- ia = ipx_iaonnetof(&sipx->sipx_addr);
- if (ia != NULL)
- ifa_ref(&ia->ia_ifa);
- IPX_IFADDR_RUNLOCK();
- }
- if (ia == NULL) {
- IPX_IFADDR_RLOCK();
- ia = TAILQ_FIRST(&ipx_ifaddrhead);
- if (ia != NULL)
- ifa_ref(&ia->ia_ifa);
- IPX_IFADDR_RUNLOCK();
- }
- if (ia == NULL)
- return (EADDRNOTAVAIL);
- }
- ipxp->ipxp_laddr.x_host = satoipx_addr(ia->ia_addr).x_host;
- ifa_free(&ia->ia_ifa);
- }
- if (ipx_pcblookup(&sipx->sipx_addr, ipxp->ipxp_lport, 0))
- return (EADDRINUSE);
- if (ipxp->ipxp_lport == 0)
- ipx_pcbbind(ipxp, (struct sockaddr *)NULL, td);
-
- /* XXX just leave it zero if we can't find a route */
-
- ipxp->ipxp_faddr = sipx->sipx_addr;
- /* Includes ipxp->ipxp_fport = sipx->sipx_port; */
- return (0);
-}
-
-void
-ipx_pcbdisconnect(struct ipxpcb *ipxp)
-{
-
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(ipxp);
-
- ipxp->ipxp_faddr = zeroipx_addr;
-}
-
-void
-ipx_pcbdetach(struct ipxpcb *ipxp)
-{
- struct socket *so = ipxp->ipxp_socket;
-
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(ipxp);
-
- so->so_pcb = NULL;
- ipxp->ipxp_socket = NULL;
-}
-
-void
-ipx_pcbfree(struct ipxpcb *ipxp)
-{
-
- KASSERT(ipxp->ipxp_socket == NULL,
- ("ipx_pcbfree: ipxp_socket != NULL"));
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(ipxp);
-
- if (ipxp->ipxp_route.ro_rt != NULL)
- RTFREE(ipxp->ipxp_route.ro_rt);
- LIST_REMOVE(ipxp, ipxp_list);
- IPX_LOCK_DESTROY(ipxp);
- free(ipxp, M_PCB);
-}
-
-void
-ipx_getsockaddr(struct ipxpcb *ipxp, struct sockaddr **nam)
-{
- struct sockaddr_ipx *sipx, ssipx;
-
- sipx = &ssipx;
- bzero((caddr_t)sipx, sizeof(*sipx));
- sipx->sipx_len = sizeof(*sipx);
- sipx->sipx_family = AF_IPX;
- IPX_LOCK(ipxp);
- sipx->sipx_addr = ipxp->ipxp_laddr;
- IPX_UNLOCK(ipxp);
- *nam = sodupsockaddr((struct sockaddr *)sipx, M_WAITOK);
-}
-
-void
-ipx_getpeeraddr(struct ipxpcb *ipxp, struct sockaddr **nam)
-{
- struct sockaddr_ipx *sipx, ssipx;
-
- sipx = &ssipx;
- bzero(sipx, sizeof(*sipx));
- sipx->sipx_len = sizeof(*sipx);
- sipx->sipx_family = AF_IPX;
- IPX_LOCK(ipxp);
- sipx->sipx_addr = ipxp->ipxp_faddr;
- IPX_UNLOCK(ipxp);
- *nam = sodupsockaddr((struct sockaddr *)sipx, M_WAITOK);
-}
-
-struct ipxpcb *
-ipx_pcblookup(struct ipx_addr *faddr, u_short lport, int wildp)
-{
- struct ipxpcb *ipxp, *match = NULL;
- int matchwild = 3, wildcard;
- u_short fport;
-
- IPX_LIST_LOCK_ASSERT();
-
- fport = faddr->x_port;
- LIST_FOREACH(ipxp, &ipxpcb_list, ipxp_list) {
- if (ipxp->ipxp_lport != lport)
- continue;
- wildcard = 0;
- if (ipx_nullhost(ipxp->ipxp_faddr)) {
- if (!ipx_nullhost(*faddr))
- wildcard++;
- } else {
- if (ipx_nullhost(*faddr))
- wildcard++;
- else {
- if (!ipx_hosteq(ipxp->ipxp_faddr, *faddr))
- continue;
- if (ipxp->ipxp_fport != fport) {
- if (ipxp->ipxp_fport != 0)
- continue;
- else
- wildcard++;
- }
- }
- }
- if (wildcard && wildp == 0)
- continue;
- if (wildcard < matchwild) {
- match = ipxp;
- matchwild = wildcard;
- if (wildcard == 0)
- break;
- }
- }
- return (match);
-}
diff --git a/sys/netipx/ipx_pcb.h b/sys/netipx/ipx_pcb.h
deleted file mode 100644
index 4ef6011..0000000
--- a/sys/netipx/ipx_pcb.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California.
- * Copyright (c) 2004-2006 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx_pcb.h
- *
- * $FreeBSD$
- */
-
-#ifndef _NETIPX_IPX_PCB_H_
-#define _NETIPX_IPX_PCB_H_
-
-/*
- * IPX protocol interface control block.
- */
-struct ipxpcb {
- LIST_ENTRY(ipxpcb) ipxp_list;
- struct socket *ipxp_socket; /* back pointer to socket */
- struct ipx_addr ipxp_faddr; /* destination address */
- struct ipx_addr ipxp_laddr; /* socket's address */
- caddr_t ipxp_pcb; /* protocol specific stuff */
- struct route ipxp_route; /* routing information */
- struct ipx_addr ipxp_lastdst; /* validate cached route for dg socks*/
- short ipxp_flags;
- u_char ipxp_dpt; /* default packet type for ipx_output */
- u_char ipxp_rpt; /* last received packet type by ipx_input() */
- struct mtx ipxp_mtx;
-};
-
-/*
- * Additional IPX pcb-related types and variables.
- */
-LIST_HEAD(ipxpcbhead, ipxpcb);
-extern struct ipxpcbhead ipxpcb_list;
-extern struct ipxpcbhead ipxrawpcb_list;
-
-#ifdef _KERNEL
-extern struct mtx ipxpcb_list_mtx;
-#endif
-
-/*
- * IPX/SPX PCB flags.
- */
-#define IPXP_IN_ABORT 0x1 /* Calling abort through socket. */
-#define IPXP_RAWIN 0x2 /* Show headers on input. */
-#define IPXP_RAWOUT 0x4 /* Show header on output. */
-#define IPXP_ALL_PACKETS 0x8 /* Turn off higher proto processing. */
-#define IPXP_CHECKSUM 0x10 /* Use checksum on this socket. */
-#define IPXP_DROPPED 0x20 /* Connection dropped. */
-#define IPXP_SPX 0x40 /* SPX PCB. */
-
-#define IPX_WILDCARD 1
-
-#define ipxp_lport ipxp_laddr.x_port
-#define ipxp_fport ipxp_faddr.x_port
-
-#define sotoipxpcb(so) ((struct ipxpcb *)((so)->so_pcb))
-
-/*
- * Nominal space allocated to an IPX socket.
- */
-#define IPXSNDQ 16384
-#define IPXRCVQ 40960
-
-#ifdef _KERNEL
-int ipx_pcballoc(struct socket *so, struct ipxpcbhead *head,
- struct thread *p);
-int ipx_pcbbind(struct ipxpcb *ipxp, struct sockaddr *nam,
- struct thread *p);
-int ipx_pcbconnect(struct ipxpcb *ipxp, struct sockaddr *nam,
- struct thread *p);
-void ipx_pcbdetach(struct ipxpcb *ipxp);
-void ipx_pcbdisconnect(struct ipxpcb *ipxp);
-void ipx_pcbfree(struct ipxpcb *ipxp);
-struct ipxpcb *ipx_pcblookup(struct ipx_addr *faddr, u_short lport, int wildp);
-void ipx_getpeeraddr(struct ipxpcb *ipxp, struct sockaddr **nam);
-void ipx_getsockaddr(struct ipxpcb *ipxp, struct sockaddr **nam);
-
-#define IPX_LIST_LOCK_INIT() mtx_init(&ipxpcb_list_mtx, "ipx_list_mtx", \
- NULL, MTX_DEF | MTX_RECURSE)
-#define IPX_LIST_LOCK() mtx_lock(&ipxpcb_list_mtx)
-#define IPX_LIST_UNLOCK() mtx_unlock(&ipxpcb_list_mtx)
-#define IPX_LIST_LOCK_ASSERT() mtx_assert(&ipxpcb_list_mtx, MA_OWNED)
-
-#define IPX_LOCK_INIT(ipx) mtx_init(&(ipx)->ipxp_mtx, "ipx_mtx", NULL, \
- MTX_DEF)
-#define IPX_LOCK_DESTROY(ipx) mtx_destroy(&(ipx)->ipxp_mtx)
-#define IPX_LOCK(ipx) mtx_lock(&(ipx)->ipxp_mtx)
-#define IPX_UNLOCK(ipx) mtx_unlock(&(ipx)->ipxp_mtx)
-#define IPX_LOCK_ASSERT(ipx) mtx_assert(&(ipx)->ipxp_mtx, MA_OWNED)
-#endif /* _KERNEL */
-
-#endif /* !_NETIPX_IPX_PCB_H_ */
diff --git a/sys/netipx/ipx_proto.c b/sys/netipx/ipx_proto.c
deleted file mode 100644
index 36215da..0000000
--- a/sys/netipx/ipx_proto.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx_proto.c
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_ipx.h"
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/protosw.h>
-#include <sys/domain.h>
-#include <sys/kernel.h>
-#include <sys/queue.h>
-#include <sys/sysctl.h>
-
-#include <net/radix.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_var.h>
-#include <netipx/spx.h>
-
-static struct pr_usrreqs nousrreqs;
-
-/*
- * IPX protocol family: IPX, ERR, PXP, SPX, ROUTE.
- */
-
-static struct domain ipxdomain;
-
-static struct protosw ipxsw[] = {
-{
- .pr_domain = &ipxdomain,
- .pr_init = ipx_init,
- .pr_usrreqs = &nousrreqs
-},
-{
- .pr_type = SOCK_DGRAM,
- .pr_domain = &ipxdomain,
- .pr_flags = PR_ATOMIC|PR_ADDR,
- .pr_ctlinput = ipx_ctlinput,
- .pr_ctloutput = ipx_ctloutput,
- .pr_usrreqs = &ipx_usrreqs
-},
-{
- .pr_type = SOCK_STREAM,
- .pr_domain = &ipxdomain,
- .pr_protocol = IPXPROTO_SPX,
- .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD,
- .pr_ctlinput = spx_ctlinput,
- .pr_ctloutput = spx_ctloutput,
- .pr_init = spx_init,
- .pr_fasttimo = spx_fasttimo,
- .pr_slowtimo = spx_slowtimo,
- .pr_usrreqs = &spx_usrreqs
-},
-{
- .pr_type = SOCK_SEQPACKET,
- .pr_domain = &ipxdomain,
- .pr_protocol = IPXPROTO_SPX,
- .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_ATOMIC,
- .pr_ctlinput = spx_ctlinput,
- .pr_ctloutput = spx_ctloutput,
- .pr_usrreqs = &spx_usrreq_sps
-},
-{
- .pr_type = SOCK_RAW,
- .pr_domain = &ipxdomain,
- .pr_protocol = IPXPROTO_RAW,
- .pr_flags = PR_ATOMIC|PR_ADDR,
- .pr_ctloutput = ipx_ctloutput,
- .pr_usrreqs = &ripx_usrreqs
-},
-};
-
-extern int ipx_inithead(void **, int);
-
-static struct domain ipxdomain = {
- .dom_family = AF_IPX,
- .dom_name = "network systems",
- .dom_protosw = ipxsw,
- .dom_protoswNPROTOSW = &ipxsw[sizeof(ipxsw)/sizeof(ipxsw[0])],
- .dom_rtattach = ipx_inithead,
- .dom_rtoffset = 16,
- .dom_maxrtkey = sizeof(struct sockaddr_ipx)
-};
-
-
-/* shim to adapt arguments */
-int
-ipx_inithead(void **head, int offset)
-{
- return rn_inithead(head, offset);
-}
-
-DOMAIN_SET(ipx);
-SYSCTL_NODE(_net, PF_IPX, ipx, CTLFLAG_RW, 0,
- "IPX/SPX");
-
-SYSCTL_NODE(_net_ipx, IPXPROTO_RAW, ipx, CTLFLAG_RW, 0, "IPX");
-static SYSCTL_NODE(_net_ipx, IPXPROTO_SPX, spx, CTLFLAG_RW, 0, "SPX");
diff --git a/sys/netipx/ipx_usrreq.c b/sys/netipx/ipx_usrreq.c
deleted file mode 100644
index f2f96eb..0000000
--- a/sys/netipx/ipx_usrreq.c
+++ /dev/null
@@ -1,687 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California.
- * Copyright (c) 2004-2006 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx_usrreq.c
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_ipx.h"
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/lock.h>
-#include <sys/mbuf.h>
-#include <sys/priv.h>
-#include <sys/protosw.h>
-#include <sys/signalvar.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/sx.h>
-#include <sys/sysctl.h>
-#include <sys/systm.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#include <netipx/ipx_pcb.h>
-#include <netipx/ipx_var.h>
-
-#include <security/mac/mac_framework.h>
-
-/*
- * IPX protocol implementation.
- */
-
-static int ipxsendspace = IPXSNDQ;
-SYSCTL_INT(_net_ipx_ipx, OID_AUTO, ipxsendspace, CTLFLAG_RW,
- &ipxsendspace, 0, "Send buffer space");
-static int ipxrecvspace = IPXRCVQ;
-SYSCTL_INT(_net_ipx_ipx, OID_AUTO, ipxrecvspace, CTLFLAG_RW,
- &ipxrecvspace, 0, "Receive buffer space");
-
-static void ipx_usr_abort(struct socket *so);
-static int ipx_attach(struct socket *so, int proto, struct thread *td);
-static int ipx_bind(struct socket *so, struct sockaddr *nam, struct thread *td);
-static int ipx_connect(struct socket *so, struct sockaddr *nam,
- struct thread *td);
-static void ipx_detach(struct socket *so);
-static int ipx_disconnect(struct socket *so);
-static int ipx_send(struct socket *so, int flags, struct mbuf *m,
- struct sockaddr *addr, struct mbuf *control,
- struct thread *td);
-static int ipx_shutdown(struct socket *so);
-static int ripx_attach(struct socket *so, int proto, struct thread *td);
-static int ipx_output(struct ipxpcb *ipxp, struct mbuf *m0);
-static void ipx_usr_close(struct socket *so);
-
-struct pr_usrreqs ipx_usrreqs = {
- .pru_abort = ipx_usr_abort,
- .pru_attach = ipx_attach,
- .pru_bind = ipx_bind,
- .pru_connect = ipx_connect,
- .pru_control = ipx_control,
- .pru_detach = ipx_detach,
- .pru_disconnect = ipx_disconnect,
- .pru_peeraddr = ipx_peeraddr,
- .pru_send = ipx_send,
- .pru_shutdown = ipx_shutdown,
- .pru_sockaddr = ipx_sockaddr,
- .pru_close = ipx_usr_close,
-};
-
-struct pr_usrreqs ripx_usrreqs = {
- .pru_abort = ipx_usr_abort,
- .pru_attach = ripx_attach,
- .pru_bind = ipx_bind,
- .pru_connect = ipx_connect,
- .pru_control = ipx_control,
- .pru_detach = ipx_detach,
- .pru_disconnect = ipx_disconnect,
- .pru_peeraddr = ipx_peeraddr,
- .pru_send = ipx_send,
- .pru_shutdown = ipx_shutdown,
- .pru_sockaddr = ipx_sockaddr,
- .pru_close = ipx_usr_close,
-};
-
-/*
- * This may also be called for raw listeners.
- */
-void
-ipx_input(struct mbuf *m, struct ipxpcb *ipxp)
-{
- struct ipx *ipx = mtod(m, struct ipx *);
- struct ifnet *ifp = m->m_pkthdr.rcvif;
- struct sockaddr_ipx ipx_ipx;
-
- KASSERT(ipxp != NULL, ("ipx_input: NULL ipxpcb"));
- IPX_LOCK_ASSERT(ipxp);
- /*
- * Construct sockaddr format source address.
- * Stuff source address and datagram in user buffer.
- */
- ipx_ipx.sipx_len = sizeof(ipx_ipx);
- ipx_ipx.sipx_family = AF_IPX;
- ipx_ipx.sipx_addr = ipx->ipx_sna;
- ipx_ipx.sipx_zero[0] = '\0';
- ipx_ipx.sipx_zero[1] = '\0';
- if (ipx_neteqnn(ipx->ipx_sna.x_net, ipx_zeronet) && ifp != NULL) {
- struct ifaddr *ifa;
-
- for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa != NULL;
- ifa = TAILQ_NEXT(ifa, ifa_link)) {
- if (ifa->ifa_addr->sa_family == AF_IPX) {
- ipx_ipx.sipx_addr.x_net =
- IA_SIPX(ifa)->sipx_addr.x_net;
- break;
- }
- }
- }
- ipxp->ipxp_rpt = ipx->ipx_pt;
- if ((ipxp->ipxp_flags & IPXP_RAWIN) == 0) {
- m->m_len -= sizeof(struct ipx);
- m->m_pkthdr.len -= sizeof(struct ipx);
- m->m_data += sizeof(struct ipx);
- }
-#ifdef MAC
- if (mac_socket_check_deliver(ipxp->ipxp_socket, m) != 0) {
- m_freem(m);
- return;
- }
-#endif
- if (sbappendaddr(&ipxp->ipxp_socket->so_rcv,
- (struct sockaddr *)&ipx_ipx, m, NULL) == 0)
- m_freem(m);
- else
- sorwakeup(ipxp->ipxp_socket);
-}
-
-/*
- * Drop connection, reporting
- * the specified error.
- */
-void
-ipx_drop(struct ipxpcb *ipxp, int errno)
-{
- struct socket *so = ipxp->ipxp_socket;
-
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(ipxp);
-
- /*
- * someday, in the IPX world
- * we will generate error protocol packets
- * announcing that the socket has gone away.
- *
- * XXX Probably never. IPX does not have error packets.
- */
- /*if (TCPS_HAVERCVDSYN(tp->t_state)) {
- tp->t_state = TCPS_CLOSED;
- tcp_output(tp);
- }*/
- so->so_error = errno;
- ipx_pcbdisconnect(ipxp);
- soisdisconnected(so);
-}
-
-static int
-ipx_output(struct ipxpcb *ipxp, struct mbuf *m0)
-{
- struct ipx *ipx;
- struct socket *so;
- int len = 0;
- struct route *ro;
- struct mbuf *m;
- struct mbuf *mprev = NULL;
-
- IPX_LOCK_ASSERT(ipxp);
-
- /*
- * Calculate data length.
- */
- for (m = m0; m != NULL; m = m->m_next) {
- mprev = m;
- len += m->m_len;
- }
- /*
- * Make sure packet is actually of even length.
- */
-
- if (len & 1) {
- m = mprev;
- if ((m->m_flags & M_EXT) == 0 &&
- (m->m_len + m->m_data < &m->m_dat[MLEN])) {
- mtod(m, char*)[m->m_len++] = 0;
- } else {
- struct mbuf *m1 = m_get(M_NOWAIT, MT_DATA);
-
- if (m1 == NULL) {
- m_freem(m0);
- return (ENOBUFS);
- }
- m1->m_len = 1;
- * mtod(m1, char *) = 0;
- m->m_next = m1;
- }
- m0->m_pkthdr.len++;
- }
-
- /*
- * Fill in mbuf with extended IPX header
- * and addresses and length put into network format.
- */
- m = m0;
- if (ipxp->ipxp_flags & IPXP_RAWOUT) {
- ipx = mtod(m, struct ipx *);
- } else {
- M_PREPEND(m, sizeof(struct ipx), M_NOWAIT);
- if (m == NULL)
- return (ENOBUFS);
- ipx = mtod(m, struct ipx *);
- ipx->ipx_tc = 0;
- ipx->ipx_pt = ipxp->ipxp_dpt;
- ipx->ipx_sna = ipxp->ipxp_laddr;
- ipx->ipx_dna = ipxp->ipxp_faddr;
- len += sizeof(struct ipx);
- }
-
- ipx->ipx_len = htons((u_short)len);
-
- if (ipxp->ipxp_flags & IPXP_CHECKSUM) {
- ipx->ipx_sum = ipx_cksum(m, len);
- } else
- ipx->ipx_sum = 0xffff;
-
- /*
- * Output datagram.
- */
- so = ipxp->ipxp_socket;
- if (so->so_options & SO_DONTROUTE)
- return (ipx_outputfl(m, (struct route *)NULL,
- (so->so_options & SO_BROADCAST) | IPX_ROUTETOIF));
- /*
- * Use cached route for previous datagram if
- * possible. If the previous net was the same
- * and the interface was a broadcast medium, or
- * if the previous destination was identical,
- * then we are ok.
- *
- * NB: We don't handle broadcasts because that
- * would require 3 subroutine calls.
- */
- ro = &ipxp->ipxp_route;
-#ifdef ancient_history
- /*
- * I think that this will all be handled in ipx_pcbconnect!
- */
- if (ro->ro_rt != NULL) {
- if(ipx_neteq(ipxp->ipxp_lastdst, ipx->ipx_dna)) {
- /*
- * This assumes we have no GH type routes
- */
- if (ro->ro_rt->rt_flags & RTF_HOST) {
- if (!ipx_hosteq(ipxp->ipxp_lastdst, ipx->ipx_dna))
- goto re_route;
-
- }
- if ((ro->ro_rt->rt_flags & RTF_GATEWAY) == 0) {
- struct ipx_addr *dst =
- &satoipx_addr(ro->ro_dst);
- dst->x_host = ipx->ipx_dna.x_host;
- }
- /*
- * Otherwise, we go through the same gateway
- * and dst is already set up.
- */
- } else {
- re_route:
- RTFREE(ro->ro_rt);
- ro->ro_rt = NULL;
- }
- }
- ipxp->ipxp_lastdst = ipx->ipx_dna;
-#endif /* ancient_history */
- return (ipx_outputfl(m, ro, so->so_options & SO_BROADCAST));
-}
-
-int
-ipx_ctloutput(struct socket *so, struct sockopt *sopt)
-{
- struct ipxpcb *ipxp = sotoipxpcb(so);
- int mask, error, optval;
- short soptval;
- struct ipx ioptval;
- long seq;
-
- KASSERT(ipxp != NULL, ("ipx_ctloutput: ipxp == NULL"));
- error = 0;
-
- switch (sopt->sopt_dir) {
- case SOPT_GET:
- switch (sopt->sopt_name) {
- case SO_ALL_PACKETS:
- mask = IPXP_ALL_PACKETS;
- goto get_flags;
-
- case SO_HEADERS_ON_INPUT:
- mask = IPXP_RAWIN;
- goto get_flags;
-
- case SO_IPX_CHECKSUM:
- mask = IPXP_CHECKSUM;
- goto get_flags;
-
- case SO_HEADERS_ON_OUTPUT:
- mask = IPXP_RAWOUT;
- get_flags:
- /* Unlocked read. */
- soptval = ipxp->ipxp_flags & mask;
- error = sooptcopyout(sopt, &soptval, sizeof soptval);
- break;
-
- case SO_DEFAULT_HEADERS:
- ioptval.ipx_len = 0;
- ioptval.ipx_sum = 0;
- ioptval.ipx_tc = 0;
- IPX_LOCK(ipxp);
- ioptval.ipx_pt = ipxp->ipxp_dpt;
- ioptval.ipx_dna = ipxp->ipxp_faddr;
- ioptval.ipx_sna = ipxp->ipxp_laddr;
- IPX_UNLOCK(ipxp);
- error = sooptcopyout(sopt, &soptval, sizeof soptval);
- break;
-
- case SO_SEQNO:
- IPX_LIST_LOCK();
- seq = ipx_pexseq;
- ipx_pexseq++;
- IPX_LIST_UNLOCK();
- error = sooptcopyout(sopt, &seq, sizeof seq);
- break;
-
- default:
- error = EINVAL;
- }
- break;
-
- case SOPT_SET:
- switch (sopt->sopt_name) {
- case SO_ALL_PACKETS:
- mask = IPXP_ALL_PACKETS;
- goto set_head;
-
- case SO_HEADERS_ON_INPUT:
- mask = IPXP_RAWIN;
- goto set_head;
-
- case SO_IPX_CHECKSUM:
- mask = IPXP_CHECKSUM;
- goto set_head;
-
- case SO_HEADERS_ON_OUTPUT:
- mask = IPXP_RAWOUT;
- set_head:
- error = sooptcopyin(sopt, &optval, sizeof optval,
- sizeof optval);
- if (error)
- break;
- IPX_LOCK(ipxp);
- if (optval)
- ipxp->ipxp_flags |= mask;
- else
- ipxp->ipxp_flags &= ~mask;
- IPX_UNLOCK(ipxp);
- break;
-
- case SO_DEFAULT_HEADERS:
- error = sooptcopyin(sopt, &ioptval, sizeof ioptval,
- sizeof ioptval);
- if (error)
- break;
- /* Unlocked write. */
- ipxp->ipxp_dpt = ioptval.ipx_pt;
- break;
- default:
- error = EINVAL;
- }
- break;
- }
- return (error);
-}
-
-static void
-ipx_usr_abort(struct socket *so)
-{
-
- /* XXXRW: Possibly ipx_disconnect() here? */
- soisdisconnected(so);
-}
-
-static int
-ipx_attach(struct socket *so, int proto, struct thread *td)
-{
-#ifdef INVARIANTS
- struct ipxpcb *ipxp = sotoipxpcb(so);
-#endif
- int error;
-
- KASSERT(ipxp == NULL, ("ipx_attach: ipxp != NULL"));
- error = soreserve(so, ipxsendspace, ipxrecvspace);
- if (error != 0)
- return (error);
- IPX_LIST_LOCK();
- error = ipx_pcballoc(so, &ipxpcb_list, td);
- IPX_LIST_UNLOCK();
- return (error);
-}
-
-static int
-ipx_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
-{
- struct ipxpcb *ipxp = sotoipxpcb(so);
- int error;
-
- KASSERT(ipxp != NULL, ("ipx_bind: ipxp == NULL"));
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- error = ipx_pcbbind(ipxp, nam, td);
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- return (error);
-}
-
-static void
-ipx_usr_close(struct socket *so)
-{
-
- /* XXXRW: Possibly ipx_disconnect() here? */
- soisdisconnected(so);
-}
-
-static int
-ipx_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
-{
- struct ipxpcb *ipxp = sotoipxpcb(so);
- int error;
-
- KASSERT(ipxp != NULL, ("ipx_connect: ipxp == NULL"));
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- if (!ipx_nullhost(ipxp->ipxp_faddr)) {
- error = EISCONN;
- goto out;
- }
- error = ipx_pcbconnect(ipxp, nam, td);
- if (error == 0)
- soisconnected(so);
-out:
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- return (error);
-}
-
-static void
-ipx_detach(struct socket *so)
-{
- struct ipxpcb *ipxp = sotoipxpcb(so);
-
- /* XXXRW: Should assert detached. */
- KASSERT(ipxp != NULL, ("ipx_detach: ipxp == NULL"));
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- ipx_pcbdetach(ipxp);
- ipx_pcbfree(ipxp);
- IPX_LIST_UNLOCK();
-}
-
-static int
-ipx_disconnect(struct socket *so)
-{
- struct ipxpcb *ipxp = sotoipxpcb(so);
- int error;
-
- KASSERT(ipxp != NULL, ("ipx_disconnect: ipxp == NULL"));
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- error = 0;
- if (ipx_nullhost(ipxp->ipxp_faddr)) {
- error = ENOTCONN;
- goto out;
- }
- ipx_pcbdisconnect(ipxp);
- soisdisconnected(so);
-out:
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- return (0);
-}
-
-int
-ipx_peeraddr(struct socket *so, struct sockaddr **nam)
-{
- struct ipxpcb *ipxp = sotoipxpcb(so);
-
- KASSERT(ipxp != NULL, ("ipx_peeraddr: ipxp == NULL"));
- ipx_getpeeraddr(ipxp, nam);
- return (0);
-}
-
-static int
-ipx_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
- struct mbuf *control, struct thread *td)
-{
- int error;
- struct ipxpcb *ipxp = sotoipxpcb(so);
- struct ipx_addr laddr;
-
- KASSERT(ipxp != NULL, ("ipxp_send: ipxp == NULL"));
- /*
- * Attempt to only acquire the necessary locks: if the socket is
- * already connected, we don't need to hold the IPX list lock to be
- * used by ipx_pcbconnect() and ipx_pcbdisconnect(), just the IPX
- * pcb lock.
- */
-#ifdef MAC
- mac_socket_create_mbuf(so, m);
-#endif
- if (nam != NULL) {
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- laddr = ipxp->ipxp_laddr;
- if (!ipx_nullhost(ipxp->ipxp_faddr)) {
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- error = EISCONN;
- goto send_release;
- }
- /*
- * Must block input while temporarily connected.
- */
- error = ipx_pcbconnect(ipxp, nam, td);
- if (error) {
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- goto send_release;
- }
- } else {
- IPX_LOCK(ipxp);
- if (ipx_nullhost(ipxp->ipxp_faddr)) {
- IPX_UNLOCK(ipxp);
- error = ENOTCONN;
- goto send_release;
- }
- }
- error = ipx_output(ipxp, m);
- m = NULL;
- if (nam != NULL) {
- ipx_pcbdisconnect(ipxp);
- ipxp->ipxp_laddr = laddr;
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- } else
- IPX_UNLOCK(ipxp);
-
-send_release:
- if (m != NULL)
- m_freem(m);
- return (error);
-}
-
-static int
-ipx_shutdown(so)
- struct socket *so;
-{
-
- KASSERT(so->so_pcb != NULL, ("ipx_shutdown: so_pcb == NULL"));
- socantsendmore(so);
- return (0);
-}
-
-int
-ipx_sockaddr(struct socket *so, struct sockaddr **nam)
-{
- struct ipxpcb *ipxp = sotoipxpcb(so);
-
- KASSERT(ipxp != NULL, ("ipx_sockaddr: ipxp == NULL"));
- ipx_getsockaddr(ipxp, nam);
- return (0);
-}
-
-static int
-ripx_attach(struct socket *so, int proto, struct thread *td)
-{
- int error = 0;
- struct ipxpcb *ipxp = sotoipxpcb(so);
-
- KASSERT(ipxp == NULL, ("ripx_attach: ipxp != NULL"));
-
- if (td != NULL) {
- error = priv_check(td, PRIV_NETIPX_RAW);
- if (error)
- return (error);
- }
-
- /*
- * We hold the IPX list lock for the duration as address parameters
- * of the IPX pcb are changed. Since no one else holds a reference
- * to the ipxpcb yet, we don't need the ipxpcb lock here.
- */
- IPX_LIST_LOCK();
- error = ipx_pcballoc(so, &ipxrawpcb_list, td);
- if (error)
- goto out;
- ipxp = sotoipxpcb(so);
- error = soreserve(so, ipxsendspace, ipxrecvspace);
- if (error)
- goto out;
- ipxp->ipxp_faddr.x_host = ipx_broadhost;
- ipxp->ipxp_flags = IPXP_RAWIN | IPXP_RAWOUT;
-out:
- IPX_LIST_UNLOCK();
- return (error);
-}
diff --git a/sys/netipx/ipx_var.h b/sys/netipx/ipx_var.h
deleted file mode 100644
index 304630d..0000000
--- a/sys/netipx/ipx_var.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ipx_var.h
- *
- * $FreeBSD$
- */
-
-#ifndef _NETIPX_IPX_VAR_H_
-#define _NETIPX_IPX_VAR_H_
-
-/*
- * IPX Kernel Structures and Variables
- */
-struct ipxstat {
- u_long ipxs_total; /* total packets received */
- u_long ipxs_badsum; /* checksum bad */
- u_long ipxs_tooshort; /* packet too short */
- u_long ipxs_toosmall; /* not enough data */
- u_long ipxs_forward; /* packets forwarded */
- u_long ipxs_cantforward; /* packets rcvd for unreachable dest */
- u_long ipxs_delivered; /* datagrams delivered to upper level*/
- u_long ipxs_localout; /* total ipx packets generated here */
- u_long ipxs_odropped; /* lost packets due to nobufs, etc. */
- u_long ipxs_noroute; /* packets discarded due to no route */
- u_long ipxs_mtutoosmall; /* the interface mtu is too small */
-};
-
-#ifdef _KERNEL
-
-#ifdef SYSCTL_DECL
-SYSCTL_DECL(_net_ipx);
-SYSCTL_DECL(_net_ipx_ipx);
-#endif
-
-extern int ipxcksum;
-extern long ipx_pexseq;
-extern struct ipxstat ipxstat;
-extern struct pr_usrreqs ipx_usrreqs;
-extern struct pr_usrreqs ripx_usrreqs;
-extern struct sockaddr_ipx ipx_netmask;
-extern struct sockaddr_ipx ipx_hostmask;
-
-extern const union ipx_net ipx_zeronet;
-extern const union ipx_net ipx_broadnet;
-extern const union ipx_host ipx_broadhost;
-
-struct ifnet;
-struct ipx_addr;
-struct ipxpcb;
-struct mbuf;
-struct thread;
-struct route;
-struct sockaddr;
-struct socket;
-struct sockopt;
-
-u_short ipx_cksum(struct mbuf *m, int len);
-int ipx_control(struct socket *so, u_long cmd, caddr_t data,
- struct ifnet *ifp, struct thread *td);
-void ipx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy);
-int ipx_ctloutput(struct socket *so, struct sockopt *sopt);
-void ipx_drop(struct ipxpcb *ipxp, int errno);
-void ipx_init(void);
-void ipx_input(struct mbuf *m, struct ipxpcb *ipxp);
-int ipx_outputfl(struct mbuf *m0, struct route *ro, int flags);
-int ipx_output_type20(struct mbuf *);
-int ipx_peeraddr(struct socket *so, struct sockaddr **nam);
-void ipx_printhost(struct ipx_addr *addr);
-int ipx_sockaddr(struct socket *so, struct sockaddr **nam);
-
-#endif /* _KERNEL */
-
-#endif /* !_NETIPX_IPX_VAR_H_ */
diff --git a/sys/netipx/spx.h b/sys/netipx/spx.h
deleted file mode 100644
index d356bff..0000000
--- a/sys/netipx/spx.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)spx.h
- *
- * $FreeBSD$
- */
-
-#ifndef _NETIPX_SPX_H_
-#define _NETIPX_SPX_H_
-
-/*
- * Definitions for IPX style Sequenced Packet Protocol
- */
-
-struct spxhdr {
- u_char spx_cc; /* connection control */
- u_char spx_dt; /* datastream type */
-#define SPX_SP 0x80 /* system packet */
-#define SPX_SA 0x40 /* send acknowledgement */
-#define SPX_OB 0x20 /* attention (out of band data) */
-#define SPX_EM 0x10 /* end of message */
- u_short spx_sid; /* source connection identifier */
- u_short spx_did; /* destination connection identifier */
- u_short spx_seq; /* sequence number */
- u_short spx_ack; /* acknowledge number */
- u_short spx_alo; /* allocation number */
-} __packed;
-
-/*
- * Definitions for NS(tm) Internet Datagram Protocol
- * containing a Sequenced Packet Protocol packet.
- */
-struct spx {
- struct ipx si_i;
- struct spxhdr si_s;
-} __packed;
-struct spx_q {
- struct mbuf *sq_msi;
- struct spx *sq_si;
- LIST_ENTRY(spx_q) sq_entry;
-};
-#define SI(x) ((struct spx *)x)
-#define si_sum si_i.ipx_sum
-#define si_len si_i.ipx_len
-#define si_tc si_i.ipx_tc
-#define si_pt si_i.ipx_pt
-#define si_dna si_i.ipx_dna
-#define si_sna si_i.ipx_sna
-#define si_sport si_i.ipx_sna.x_port
-#define si_cc si_s.spx_cc
-#define si_dt si_s.spx_dt
-#define si_sid si_s.spx_sid
-#define si_did si_s.spx_did
-#define si_seq si_s.spx_seq
-#define si_ack si_s.spx_ack
-#define si_alo si_s.spx_alo
-
-/*
- * SPX control block, one per connection
- */
-struct spxpcb {
- LIST_HEAD(, spx_q) s_q; /* queue for out-of-order receipt */
- struct ipxpcb *s_ipxpcb; /* backpointer to internet pcb */
- u_char s_state;
- u_char s_flags;
-#define SF_ACKNOW 0x01 /* Ack peer immediately */
-#define SF_DELACK 0x02 /* Ack, but try to delay it */
-#define SF_HI 0x04 /* Show headers on input */
-#define SF_HO 0x08 /* Show headers on output */
-#define SF_PI 0x10 /* Packet (datagram) interface */
-#define SF_WIN 0x20 /* Window info changed */
-#define SF_RXT 0x40 /* Rxt info changed */
-#define SF_RVD 0x80 /* Calling from read usrreq routine */
- u_short s_mtu; /* Max packet size for this stream */
-/* use sequence fields in headers to store sequence numbers for this
- connection */
- struct ipx s_ipx;
- struct spxhdr s_shdr; /* prototype header to transmit */
-#define s_cc s_shdr.spx_cc /* connection control (for EM bit) */
-#define s_dt s_shdr.spx_dt /* datastream type */
-#define s_sid s_shdr.spx_sid /* source connection identifier */
-#define s_did s_shdr.spx_did /* destination connection identifier */
-#define s_seq s_shdr.spx_seq /* sequence number */
-#define s_ack s_shdr.spx_ack /* acknowledge number */
-#define s_alo s_shdr.spx_alo /* allocation number */
-#define s_dport s_ipx.ipx_dna.x_port /* where we are sending */
- struct spxhdr s_rhdr; /* last received header (in effect!)*/
- u_short s_rack; /* their acknowledge number */
- u_short s_ralo; /* their allocation number */
- u_short s_smax; /* highest packet # we have sent */
- u_short s_snxt; /* which packet to send next */
-
-/* congestion control */
-#define CUNIT 1024 /* scaling for ... */
- int s_cwnd; /* Congestion-controlled window */
- /* in packets * CUNIT */
- short s_swnd; /* == tcp snd_wnd, in packets */
- short s_smxw; /* == tcp max_sndwnd */
- /* difference of two spx_seq's can be
- no bigger than a short */
- u_short s_swl1; /* == tcp snd_wl1 */
- u_short s_swl2; /* == tcp snd_wl2 */
- int s_cwmx; /* max allowable cwnd */
- int s_ssthresh; /* s_cwnd size threshold for
- * slow start exponential-to-
- * linear switch */
-/* transmit timing stuff
- * srtt and rttvar are stored as fixed point, for convenience in smoothing.
- * srtt has 3 bits to the right of the binary point, rttvar has 2.
- */
- short s_idle; /* time idle */
-#define SPXT_NTIMERS 4
- short s_timer[SPXT_NTIMERS]; /* timers */
- short s_rxtshift; /* log(2) of rexmt exp. backoff */
- short s_rxtcur; /* current retransmit value */
- u_short s_rtseq; /* packet being timed */
- short s_rtt; /* timer for round trips */
- short s_srtt; /* averaged timer */
- short s_rttvar; /* variance in round trip time */
- char s_force; /* which timer expired */
- char s_dupacks; /* counter to intuit xmt loss */
-
-/* out of band data */
- char s_oobflags;
-#define SF_SOOB 0x08 /* sending out of band data */
-#define SF_IOOB 0x10 /* receiving out of band data */
- char s_iobc; /* input characters */
-/* debug stuff */
- u_short s_want; /* Last candidate for sending */
- char s_outx; /* exit taken from spx_output */
- char s_inx; /* exit taken from spx_input */
- u_short s_flags2; /* more flags for testing */
-#define SF_NEWCALL 0x100 /* for new_recvmsg */
-#define SO_NEWCALL 10 /* for new_recvmsg */
-};
-
-#define ipxtospxpcb(np) ((struct spxpcb *)(np)->ipxp_pcb)
-#define sotospxpcb(so) (ipxtospxpcb(sotoipxpcb(so)))
-
-#ifdef _KERNEL
-
-extern struct pr_usrreqs spx_usrreqs;
-extern struct pr_usrreqs spx_usrreq_sps;
-
-void spx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy);
-int spx_ctloutput(struct socket *so, struct sockopt *sopt);
-void spx_fasttimo(void);
-void spx_init(void);
-void spx_input(struct mbuf *m, struct ipxpcb *ipxp);
-void spx_slowtimo(void);
-
-#endif /* _KERNEL */
-
-#endif /* !_NETIPX_SPX_H_ */
diff --git a/sys/netipx/spx_debug.c b/sys/netipx/spx_debug.c
deleted file mode 100644
index 0d3f65f..0000000
--- a/sys/netipx/spx_debug.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)spx_debug.c
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "opt_inet.h"
-#include "opt_tcpdebug.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/protosw.h>
-
-#define TCPSTATES /* for logging */
-
-#include <netinet/in_systm.h>
-#include <netinet/tcp_fsm.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_var.h>
-#include <netipx/spx.h>
-#define SPXTIMERS
-#include <netipx/spx_timer.h>
-#define SANAMES
-#include <netipx/spx_debug.h>
-
-#ifdef INET
-#ifdef TCPDEBUG
-static int spxconsdebug = 0;
-static struct spx_debug spx_debug[SPX_NDEBUG];
-static int spx_debx;
-#endif
-#endif
-
-/*
- * spx debug routines
- */
-void
-spx_trace(short act, u_char ostate, struct spxpcb *sp, struct spx *si,
- int req)
-{
-#ifdef INET
-#ifdef TCPDEBUG
- u_short seq, ack, len, alo;
- int flags;
- struct spx_debug *sd = &spx_debug[spx_debx++];
-
- if (spx_debx == SPX_NDEBUG)
- spx_debx = 0;
- sd->sd_time = iptime();
- sd->sd_act = act;
- sd->sd_ostate = ostate;
- sd->sd_cb = (caddr_t)sp;
- if (sp != NULL)
- sd->sd_sp = *sp;
- else
- bzero((caddr_t)&sd->sd_sp, sizeof(*sp));
- if (si != NULL)
- sd->sd_si = *si;
- else
- bzero((caddr_t)&sd->sd_si, sizeof(*si));
- sd->sd_req = req;
- if (spxconsdebug == 0)
- return;
- if (ostate >= TCP_NSTATES)
- ostate = 0;
- if (act >= SA_DROP)
- act = SA_DROP;
- if (sp != NULL)
- printf("%p %s:", (void *)sp, tcpstates[ostate]);
- else
- printf("???????? ");
- printf("%s ", spxnames[act]);
- switch (act) {
-
- case SA_RESPOND:
- case SA_INPUT:
- case SA_OUTPUT:
- case SA_DROP:
- if (si == NULL)
- break;
- seq = si->si_seq;
- ack = si->si_ack;
- alo = si->si_alo;
- len = si->si_len;
- if (act == SA_OUTPUT) {
- seq = ntohs(seq);
- ack = ntohs(ack);
- alo = ntohs(alo);
- len = ntohs(len);
- }
-#ifndef lint
-#define p1(f) { printf("%s = %x, ", "f", f); }
- p1(seq); p1(ack); p1(alo); p1(len);
-#endif
- flags = si->si_cc;
- if (flags) {
- char *cp = "<";
-#ifndef lint
-#define pf(f) { if (flags & SPX_ ## f) { printf("%s%s", cp, "f"); cp = ","; } }
- pf(SP); pf(SA); pf(OB); pf(EM);
-#else
- cp = cp;
-#endif
- printf(">");
- }
-#ifndef lint
-#define p2(f) { printf("%s = %x, ", "f", si->si_ ## f); }
- p2(sid);p2(did);p2(dt);p2(pt);
-#endif
- ipx_printhost(&si->si_sna);
- ipx_printhost(&si->si_dna);
-
- if (act == SA_RESPOND) {
- printf("ipx_len = %x, ",
- ((struct ipx *)si)->ipx_len);
- }
- break;
-
- case SA_USER:
- printf("%s", prurequests[req&0xff]);
- if ((req & 0xff) == PRU_SLOWTIMO)
- printf("<%s>", spxtimers[req>>8]);
- break;
- }
- if (sp)
- printf(" -> %s", tcpstates[sp->s_state]);
- /* print out internal state of sp !?! */
- printf("\n");
- if (sp == 0)
- return;
-#ifndef lint
-#define p3(f) { printf("%s = %x, ", "f", sp->s_ ## f); }
- printf("\t"); p3(rack);p3(ralo);p3(smax);p3(flags); printf("\n");
-#endif
-#endif
-#endif
-}
diff --git a/sys/netipx/spx_debug.h b/sys/netipx/spx_debug.h
deleted file mode 100644
index 24405bc..0000000
--- a/sys/netipx/spx_debug.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)spx_debug.h
- *
- * $FreeBSD$
- */
-
-#ifndef _NETIPX_SPX_DEBUG_H_
-#define _NETIPX_SPX_DEBUG_H_
-
-struct spx_debug {
- u_long sd_time;
- short sd_act;
- short sd_ostate;
- caddr_t sd_cb;
- short sd_req;
- struct spx sd_si;
- struct spxpcb sd_sp;
-};
-
-#define SA_INPUT 0
-#define SA_OUTPUT 1
-#define SA_USER 2
-#define SA_RESPOND 3
-#define SA_DROP 4
-
-#ifdef SANAMES
-const char *spxnames[] =
- { "input", "output", "user", "respond", "drop" };
-#endif
-
-#define SPX_NDEBUG 100
-#ifndef _KERNEL
-/* XXX common variables for broken applications. */
-struct spx_debug spx_debug[SPX_NDEBUG];
-int spx_debx;
-#endif
-
-#ifdef _KERNEL
-extern char *prurequests[];
-extern char *sanames[];
-
-void spx_trace(short act, u_char ostate, struct spxpcb *sp, struct spx *si,
- int req);
-#endif
-
-#endif /* !_NETIPX_SPX_DEBUG_H_ */
diff --git a/sys/netipx/spx_reass.c b/sys/netipx/spx_reass.c
deleted file mode 100644
index 2479ae1..0000000
--- a/sys/netipx/spx_reass.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California.
- * Copyright (c) 2004-2009 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)spx_usrreq.h
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/lock.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/protosw.h>
-#include <sys/signalvar.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/sx.h>
-#include <sys/systm.h>
-
-#include <net/route.h>
-#include <netinet/tcp_fsm.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_pcb.h>
-#include <netipx/ipx_var.h>
-#include <netipx/spx.h>
-#include <netipx/spx_debug.h>
-#include <netipx/spx_timer.h>
-#include <netipx/spx_var.h>
-
-static int spx_use_delack = 0;
-static int spxrexmtthresh = 3;
-
-static MALLOC_DEFINE(M_SPXREASSQ, "spxreassq", "SPX reassembly queue entry");
-
-/*
- * Flesh pending queued segments on SPX close.
- */
-void
-spx_reass_flush(struct spxpcb *cb)
-{
- struct spx_q *q;
-
- while ((q = LIST_FIRST(&cb->s_q)) != NULL) {
- LIST_REMOVE(q, sq_entry);
- m_freem(q->sq_msi);
- free(q, M_SPXREASSQ);
- }
-}
-
-/*
- * Initialize SPX segment reassembly queue on SPX socket open.
- */
-void
-spx_reass_init(struct spxpcb *cb)
-{
-
- LIST_INIT(&cb->s_q);
-}
-
-/*
- * This is structurally similar to the tcp reassembly routine but its
- * function is somewhat different: it merely queues packets up, and
- * suppresses duplicates.
- */
-int
-spx_reass(struct spxpcb *cb, struct mbuf *msi, struct spx *si)
-{
- struct spx_q *q, *q_new, *q_temp;
- struct mbuf *m;
- struct socket *so = cb->s_ipxpcb->ipxp_socket;
- char packetp = cb->s_flags & SF_HI;
- int incr;
- char wakeup = 0;
-
- IPX_LOCK_ASSERT(cb->s_ipxpcb);
-
- if (si == SI(0))
- goto present;
-
- /*
- * Update our news from them.
- */
- if (si->si_cc & SPX_SA)
- cb->s_flags |= (spx_use_delack ? SF_DELACK : SF_ACKNOW);
- if (SSEQ_GT(si->si_alo, cb->s_ralo))
- cb->s_flags |= SF_WIN;
- if (SSEQ_LEQ(si->si_ack, cb->s_rack)) {
- if ((si->si_cc & SPX_SP) && cb->s_rack != (cb->s_smax + 1)) {
- spxstat.spxs_rcvdupack++;
-
- /*
- * If this is a completely duplicate ack and other
- * conditions hold, we assume a packet has been
- * dropped and retransmit it exactly as in
- * tcp_input().
- */
- if (si->si_ack != cb->s_rack ||
- si->si_alo != cb->s_ralo)
- cb->s_dupacks = 0;
- else if (++cb->s_dupacks == spxrexmtthresh) {
- u_short onxt = cb->s_snxt;
- int cwnd = cb->s_cwnd;
-
- cb->s_snxt = si->si_ack;
- cb->s_cwnd = CUNIT;
- cb->s_force = 1 + SPXT_REXMT;
- spx_output(cb, NULL);
- cb->s_timer[SPXT_REXMT] = cb->s_rxtcur;
- cb->s_rtt = 0;
- if (cwnd >= 4 * CUNIT)
- cb->s_cwnd = cwnd / 2;
- if (SSEQ_GT(onxt, cb->s_snxt))
- cb->s_snxt = onxt;
- return (1);
- }
- } else
- cb->s_dupacks = 0;
- goto update_window;
- }
- cb->s_dupacks = 0;
-
- /*
- * If our correspondent acknowledges data we haven't sent TCP would
- * drop the packet after acking. We'll be a little more permissive.
- */
- if (SSEQ_GT(si->si_ack, (cb->s_smax + 1))) {
- spxstat.spxs_rcvacktoomuch++;
- si->si_ack = cb->s_smax + 1;
- }
- spxstat.spxs_rcvackpack++;
-
- /*
- * If transmit timer is running and timed sequence number was acked,
- * update smoothed round trip time. See discussion of algorithm in
- * tcp_input.c
- */
- if (cb->s_rtt && SSEQ_GT(si->si_ack, cb->s_rtseq)) {
- spxstat.spxs_rttupdated++;
- if (cb->s_srtt != 0) {
- short delta;
- delta = cb->s_rtt - (cb->s_srtt >> 3);
- if ((cb->s_srtt += delta) <= 0)
- cb->s_srtt = 1;
- if (delta < 0)
- delta = -delta;
- delta -= (cb->s_rttvar >> 2);
- if ((cb->s_rttvar += delta) <= 0)
- cb->s_rttvar = 1;
- } else {
- /*
- * No rtt measurement yet.
- */
- cb->s_srtt = cb->s_rtt << 3;
- cb->s_rttvar = cb->s_rtt << 1;
- }
- cb->s_rtt = 0;
- cb->s_rxtshift = 0;
- SPXT_RANGESET(cb->s_rxtcur,
- ((cb->s_srtt >> 2) + cb->s_rttvar) >> 1,
- SPXTV_MIN, SPXTV_REXMTMAX);
- }
-
- /*
- * If all outstanding data is acked, stop retransmit timer and
- * remember to restart (more output or persist). If there is more
- * data to be acked, restart retransmit timer, using current
- * (possibly backed-off) value;
- */
- if (si->si_ack == cb->s_smax + 1) {
- cb->s_timer[SPXT_REXMT] = 0;
- cb->s_flags |= SF_RXT;
- } else if (cb->s_timer[SPXT_PERSIST] == 0)
- cb->s_timer[SPXT_REXMT] = cb->s_rxtcur;
-
- /*
- * When new data is acked, open the congestion window. If the window
- * gives us less than ssthresh packets in flight, open exponentially
- * (maxseg at a time). Otherwise open linearly (maxseg^2 / cwnd at a
- * time).
- */
- incr = CUNIT;
- if (cb->s_cwnd > cb->s_ssthresh)
- incr = max(incr * incr / cb->s_cwnd, 1);
- cb->s_cwnd = min(cb->s_cwnd + incr, cb->s_cwmx);
-
- /*
- * Trim Acked data from output queue.
- */
- SOCKBUF_LOCK(&so->so_snd);
- while ((m = so->so_snd.sb_mb) != NULL) {
- if (SSEQ_LT((mtod(m, struct spx *))->si_seq, si->si_ack))
- sbdroprecord_locked(&so->so_snd);
- else
- break;
- }
- sowwakeup_locked(so);
- cb->s_rack = si->si_ack;
-update_window:
- if (SSEQ_LT(cb->s_snxt, cb->s_rack))
- cb->s_snxt = cb->s_rack;
- if (SSEQ_LT(cb->s_swl1, si->si_seq) || ((cb->s_swl1 == si->si_seq &&
- (SSEQ_LT(cb->s_swl2, si->si_ack))) ||
- (cb->s_swl2 == si->si_ack && SSEQ_LT(cb->s_ralo, si->si_alo)))) {
- /* keep track of pure window updates */
- if ((si->si_cc & SPX_SP) && cb->s_swl2 == si->si_ack
- && SSEQ_LT(cb->s_ralo, si->si_alo)) {
- spxstat.spxs_rcvwinupd++;
- spxstat.spxs_rcvdupack--;
- }
- cb->s_ralo = si->si_alo;
- cb->s_swl1 = si->si_seq;
- cb->s_swl2 = si->si_ack;
- cb->s_swnd = (1 + si->si_alo - si->si_ack);
- if (cb->s_swnd > cb->s_smxw)
- cb->s_smxw = cb->s_swnd;
- cb->s_flags |= SF_WIN;
- }
-
- /*
- * If this packet number is higher than that which we have allocated
- * refuse it, unless urgent.
- */
- if (SSEQ_GT(si->si_seq, cb->s_alo)) {
- if (si->si_cc & SPX_SP) {
- spxstat.spxs_rcvwinprobe++;
- return (1);
- } else
- spxstat.spxs_rcvpackafterwin++;
- if (si->si_cc & SPX_OB) {
- if (SSEQ_GT(si->si_seq, cb->s_alo + 60))
- return (1); /* else queue this packet; */
- } else {
-#ifdef BROKEN
- /*
- * XXXRW: This is broken on at least one count:
- * spx_close() will free the ipxp and related parts,
- * which are then touched by spx_input() after the
- * return from spx_reass().
- */
- /*struct socket *so = cb->s_ipxpcb->ipxp_socket;
- if (so->so_state && SS_NOFDREF) {
- spx_close(cb);
- } else
- would crash system*/
-#endif
- spx_istat.notyet++;
- return (1);
- }
- }
-
- /*
- * If this is a system packet, we don't need to queue it up, and
- * won't update acknowledge #.
- */
- if (si->si_cc & SPX_SP)
- return (1);
-
- /*
- * We have already seen this packet, so drop.
- */
- if (SSEQ_LT(si->si_seq, cb->s_ack)) {
- spx_istat.bdreas++;
- spxstat.spxs_rcvduppack++;
- if (si->si_seq == cb->s_ack - 1)
- spx_istat.lstdup++;
- return (1);
- }
-
- /*
- * Loop through all packets queued up to insert in appropriate
- * sequence.
- */
- q_new = malloc(sizeof(*q_new), M_SPXREASSQ, M_NOWAIT | M_ZERO);
- if (q_new == NULL)
- return (1);
- q_new->sq_si = si;
- q_new->sq_msi = msi;
- LIST_FOREACH(q, &cb->s_q, sq_entry) {
- if (si->si_seq == q->sq_si->si_seq) {
- free(q_new, M_SPXREASSQ);
- spxstat.spxs_rcvduppack++;
- return (1);
- }
- if (SSEQ_LT(si->si_seq, q->sq_si->si_seq)) {
- spxstat.spxs_rcvoopack++;
- break;
- }
- }
- if (q != NULL)
- LIST_INSERT_BEFORE(q, q_new, sq_entry);
- else
- LIST_INSERT_HEAD(&cb->s_q, q_new, sq_entry);
-
- /*
- * If this packet is urgent, inform process
- */
- if (si->si_cc & SPX_OB) {
- cb->s_iobc = ((char *)si)[1 + sizeof(*si)];
- sohasoutofband(so);
- cb->s_oobflags |= SF_IOOB;
- }
-present:
-#define SPINC sizeof(struct spxhdr)
- SOCKBUF_LOCK(&so->so_rcv);
-
- /*
- * Loop through all packets queued up to update acknowledge number,
- * and present all acknowledged data to user; if in packet interface
- * mode, show packet headers.
- */
- LIST_FOREACH_SAFE(q, &cb->s_q, sq_entry, q_temp) {
- struct spx *qsi;
- struct mbuf *mqsi;
-
- qsi = q->sq_si;
- mqsi = q->sq_msi;
- if (qsi->si_seq == cb->s_ack) {
- cb->s_ack++;
- if (qsi->si_cc & SPX_OB) {
- cb->s_oobflags &= ~SF_IOOB;
- if (so->so_rcv.sb_cc)
- so->so_oobmark = so->so_rcv.sb_cc;
- else
- so->so_rcv.sb_state |= SBS_RCVATMARK;
- }
- LIST_REMOVE(q, sq_entry);
- free(q, M_SPXREASSQ);
- wakeup = 1;
- spxstat.spxs_rcvpack++;
-#ifdef SF_NEWCALL
- if (cb->s_flags2 & SF_NEWCALL) {
- struct spxhdr *sp =
- mtod(mqsi, struct spxhdr *);
- u_char dt = sp->spx_dt;
-
- spx_newchecks[4]++;
- if (dt != cb->s_rhdr.spx_dt) {
- struct mbuf *mm =
- m_getclr(M_NOWAIT, MT_CONTROL);
- spx_newchecks[0]++;
- if (mm != NULL) {
- u_short *s =
- mtod(mm, u_short *);
- cb->s_rhdr.spx_dt = dt;
- mm->m_len = 5; /*XXX*/
- s[0] = 5;
- s[1] = 1;
- *(u_char *)(&s[2]) = dt;
- sbappend_locked(&so->so_rcv, mm);
- }
- }
- if (sp->spx_cc & SPX_OB) {
- MCHTYPE(mqsi, MT_OOBDATA);
- spx_newchecks[1]++;
- so->so_oobmark = 0;
- so->so_rcv.sb_state &= ~SBS_RCVATMARK;
- }
- if (packetp == 0) {
- mqsi->m_data += SPINC;
- mqsi->m_len -= SPINC;
- mqsi->m_pkthdr.len -= SPINC;
- }
- if ((sp->spx_cc & SPX_EM) || packetp) {
- sbappendrecord_locked(&so->so_rcv,
- mqsi);
- spx_newchecks[9]++;
- } else
- sbappend_locked(&so->so_rcv, mqsi);
- } else
-#endif
- if (packetp)
- sbappendrecord_locked(&so->so_rcv, mqsi);
- else {
- cb->s_rhdr = *mtod(mqsi, struct spxhdr *);
- mqsi->m_data += SPINC;
- mqsi->m_len -= SPINC;
- mqsi->m_pkthdr.len -= SPINC;
- sbappend_locked(&so->so_rcv, mqsi);
- }
- } else
- break;
- }
- if (wakeup)
- sorwakeup_locked(so);
- else
- SOCKBUF_UNLOCK(&so->so_rcv);
- return (0);
-}
diff --git a/sys/netipx/spx_timer.h b/sys/netipx/spx_timer.h
deleted file mode 100644
index eda949d..0000000
--- a/sys/netipx/spx_timer.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)spx_timer.h
- *
- * $FreeBSD$
- */
-
-#ifndef _NETIPX_SPX_TIMER_H_
-#define _NETIPX_SPX_TIMER_H_
-
-/*
- * Definitions of the SPX timers. These timers are counted
- * down PR_SLOWHZ times a second.
- */
-#define SPXT_REXMT 0 /* retransmit */
-#define SPXT_PERSIST 1 /* retransmit persistence */
-#define SPXT_KEEP 2 /* keep alive */
-#define SPXT_2MSL 3 /* 2*msl quiet time timer */
-
-/*
- * The SPXT_REXMT timer is used to force retransmissions.
- * The SPX has the SPXT_REXMT timer set whenever segments
- * have been sent for which ACKs are expected but not yet
- * received. If an ACK is received which advances tp->snd_una,
- * then the retransmit timer is cleared (if there are no more
- * outstanding segments) or reset to the base value (if there
- * are more ACKs expected). Whenever the retransmit timer goes off,
- * we retransmit one unacknowledged segment, and do a backoff
- * on the retransmit timer.
- *
- * The SPXT_PERSIST timer is used to keep window size information
- * flowing even if the window goes shut. If all previous transmissions
- * have been acknowledged (so that there are no retransmissions in progress),
- * and the window is too small to bother sending anything, then we start
- * the SPXT_PERSIST timer. When it expires, if the window is nonzero,
- * we go to transmit state. Otherwise, at intervals send a single byte
- * into the peer's window to force him to update our window information.
- * We do this at most as often as SPXT_PERSMIN time intervals,
- * but no more frequently than the current estimate of round-trip
- * packet time. The SPXT_PERSIST timer is cleared whenever we receive
- * a window update from the peer.
- *
- * The SPXT_KEEP timer is used to keep connections alive. If an
- * connection is idle (no segments received) for SPXTV_KEEP amount of time,
- * but not yet established, then we drop the connection. If the connection
- * is established, then we force the peer to send us a segment by sending:
- * <SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK>
- * This segment is (deliberately) outside the window, and should elicit
- * an ack segment in response from the peer. If, despite the SPXT_KEEP
- * initiated segments we cannot elicit a response from a peer in SPXT_MAXIDLE
- * amount of time, then we drop the connection.
- */
-
-#define SPX_TTL 30 /* default time to live for SPX segs */
-/*
- * Time constants.
- */
-#define SPXTV_MSL ( 15*PR_SLOWHZ) /* max seg lifetime */
-#define SPXTV_SRTTBASE 0 /* base roundtrip time;
- if 0, no idea yet */
-#define SPXTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */
-
-#define SPXTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistence */
-#define SPXTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */
-
-#define SPXTV_KEEP ( 75*PR_SLOWHZ) /* keep alive - 75 secs */
-#define SPXTV_MAXIDLE ( 8*SPXTV_KEEP) /* maximum allowable idle
- time before drop conn */
-
-#define SPXTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */
-#define SPXTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */
-
-#define SPX_LINGERTIME 120 /* linger at most 2 minutes */
-
-#define SPX_MAXRXTSHIFT 12 /* maximum retransmits */
-
-#ifdef SPXTIMERS
-char *spxtimers[] =
- { "REXMT", "PERSIST", "KEEP", "2MSL" };
-#endif
-
-/*
- * Force a time value to be in a certain range.
- */
-#define SPXT_RANGESET(tv, value, tvmin, tvmax) { \
- (tv) = (value); \
- if ((tv) < (tvmin)) \
- (tv) = (tvmin); \
- else if ((tv) > (tvmax)) \
- (tv) = (tvmax); \
-}
-
-#endif /* !_NETIPX_SPX_TIMER_H_ */
diff --git a/sys/netipx/spx_usrreq.c b/sys/netipx/spx_usrreq.c
deleted file mode 100644
index 9d00d10..0000000
--- a/sys/netipx/spx_usrreq.c
+++ /dev/null
@@ -1,1793 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California.
- * Copyright (c) 2004-2009 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)spx_usrreq.h
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/protosw.h>
-#include <sys/signalvar.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/sx.h>
-#include <sys/systm.h>
-
-#include <net/route.h>
-#include <netinet/tcp_fsm.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_pcb.h>
-#include <netipx/ipx_var.h>
-#include <netipx/spx.h>
-#include <netipx/spx_debug.h>
-#include <netipx/spx_timer.h>
-#include <netipx/spx_var.h>
-
-#include <security/mac/mac_framework.h>
-
-/*
- * SPX protocol implementation.
- */
-static struct mtx spx_mtx; /* Protects only spx_iss. */
-static u_short spx_iss;
-u_short spx_newchecks[50];
-static int spx_hardnosed;
-static int traceallspxs = 0;
-struct spx_istat spx_istat;
-
-#define SPX_LOCK_INIT() mtx_init(&spx_mtx, "spx_mtx", NULL, MTX_DEF)
-#define SPX_LOCK() mtx_lock(&spx_mtx)
-#define SPX_UNLOCK() mtx_unlock(&spx_mtx)
-
-static const int spx_backoff[SPX_MAXRXTSHIFT+1] =
- { 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 };
-
-static void spx_close(struct spxpcb *cb);
-static void spx_disconnect(struct spxpcb *cb);
-static void spx_drop(struct spxpcb *cb, int errno);
-static void spx_setpersist(struct spxpcb *cb);
-static void spx_template(struct spxpcb *cb);
-static void spx_timers(struct spxpcb *cb, int timer);
-static void spx_usrclosed(struct spxpcb *cb);
-
-static void spx_usr_abort(struct socket *so);
-static int spx_accept(struct socket *so, struct sockaddr **nam);
-static int spx_attach(struct socket *so, int proto, struct thread *td);
-static int spx_bind(struct socket *so, struct sockaddr *nam, struct thread *td);
-static void spx_usr_close(struct socket *so);
-static int spx_connect(struct socket *so, struct sockaddr *nam,
- struct thread *td);
-static void spx_detach(struct socket *so);
-static void spx_pcbdetach(struct ipxpcb *ipxp);
-static int spx_usr_disconnect(struct socket *so);
-static int spx_listen(struct socket *so, int backlog, struct thread *td);
-static int spx_rcvd(struct socket *so, int flags);
-static int spx_rcvoob(struct socket *so, struct mbuf *m, int flags);
-static int spx_send(struct socket *so, int flags, struct mbuf *m,
- struct sockaddr *addr, struct mbuf *control,
- struct thread *td);
-static int spx_shutdown(struct socket *so);
-static int spx_sp_attach(struct socket *so, int proto, struct thread *td);
-
-struct pr_usrreqs spx_usrreqs = {
- .pru_abort = spx_usr_abort,
- .pru_accept = spx_accept,
- .pru_attach = spx_attach,
- .pru_bind = spx_bind,
- .pru_connect = spx_connect,
- .pru_control = ipx_control,
- .pru_detach = spx_detach,
- .pru_disconnect = spx_usr_disconnect,
- .pru_listen = spx_listen,
- .pru_peeraddr = ipx_peeraddr,
- .pru_rcvd = spx_rcvd,
- .pru_rcvoob = spx_rcvoob,
- .pru_send = spx_send,
- .pru_shutdown = spx_shutdown,
- .pru_sockaddr = ipx_sockaddr,
- .pru_close = spx_usr_close,
-};
-
-struct pr_usrreqs spx_usrreq_sps = {
- .pru_abort = spx_usr_abort,
- .pru_accept = spx_accept,
- .pru_attach = spx_sp_attach,
- .pru_bind = spx_bind,
- .pru_connect = spx_connect,
- .pru_control = ipx_control,
- .pru_detach = spx_detach,
- .pru_disconnect = spx_usr_disconnect,
- .pru_listen = spx_listen,
- .pru_peeraddr = ipx_peeraddr,
- .pru_rcvd = spx_rcvd,
- .pru_rcvoob = spx_rcvoob,
- .pru_send = spx_send,
- .pru_shutdown = spx_shutdown,
- .pru_sockaddr = ipx_sockaddr,
- .pru_close = spx_usr_close,
-};
-
-void
-spx_init(void)
-{
-
- SPX_LOCK_INIT();
- spx_iss = 1; /* WRONG !! should fish it out of TODR */
-}
-
-void
-spx_input(struct mbuf *m, struct ipxpcb *ipxp)
-{
- struct spxpcb *cb;
- struct spx *si = mtod(m, struct spx *);
- struct socket *so;
- struct spx spx_savesi;
- int dropsocket = 0;
- short ostate = 0;
-
- spxstat.spxs_rcvtotal++;
- KASSERT(ipxp != NULL, ("spx_input: ipxpcb == NULL"));
-
- /*
- * spx_input() assumes that the caller will hold both the pcb list
- * lock and also the ipxp lock. spx_input() will release both before
- * returning, and may in fact trade in the ipxp lock for another pcb
- * lock following sonewconn().
- */
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(ipxp);
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_input: cb == NULL"));
-
- if (ipxp->ipxp_flags & IPXP_DROPPED)
- goto drop;
-
- if (m->m_len < sizeof(*si)) {
- if ((m = m_pullup(m, sizeof(*si))) == NULL) {
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- spxstat.spxs_rcvshort++;
- return;
- }
- si = mtod(m, struct spx *);
- }
- si->si_seq = ntohs(si->si_seq);
- si->si_ack = ntohs(si->si_ack);
- si->si_alo = ntohs(si->si_alo);
-
- so = ipxp->ipxp_socket;
- KASSERT(so != NULL, ("spx_input: so == NULL"));
-
-#ifdef MAC
- if (mac_socket_check_deliver(so, m) != 0)
- goto drop;
-#endif
-
- if (so->so_options & SO_DEBUG || traceallspxs) {
- ostate = cb->s_state;
- spx_savesi = *si;
- }
- if (so->so_options & SO_ACCEPTCONN) {
- struct spxpcb *ocb = cb;
-
- so = sonewconn(so, 0);
- if (so == NULL)
- goto drop;
-
- /*
- * This is ugly, but ....
- *
- * Mark socket as temporary until we're committed to keeping
- * it. The code at ``drop'' and ``dropwithreset'' check the
- * flag dropsocket to see if the temporary socket created
- * here should be discarded. We mark the socket as
- * discardable until we're committed to it below in
- * TCPS_LISTEN.
- *
- * XXXRW: In the new world order of real kernel parallelism,
- * temporarily allocating the socket when we're "not sure"
- * seems like a bad idea, as we might race to remove it if
- * the listen socket is closed...?
- *
- * We drop the lock of the listen socket ipxp, and acquire
- * the lock of the new socket ippx.
- */
- dropsocket++;
- IPX_UNLOCK(ipxp);
- ipxp = (struct ipxpcb *)so->so_pcb;
- IPX_LOCK(ipxp);
- ipxp->ipxp_laddr = si->si_dna;
- cb = ipxtospxpcb(ipxp);
- cb->s_mtu = ocb->s_mtu; /* preserve sockopts */
- cb->s_flags = ocb->s_flags; /* preserve sockopts */
- cb->s_flags2 = ocb->s_flags2; /* preserve sockopts */
- cb->s_state = TCPS_LISTEN;
- }
- IPX_LOCK_ASSERT(ipxp);
-
- /*
- * Packet received on connection. Reset idle time and keep-alive
- * timer.
- */
- cb->s_idle = 0;
- cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
-
- switch (cb->s_state) {
- case TCPS_LISTEN:{
- struct sockaddr_ipx *sipx, ssipx;
- struct ipx_addr laddr;
-
- /*
- * If somebody here was carying on a conversation and went
- * away, and his pen pal thinks he can still talk, we get the
- * misdirected packet.
- */
- if (spx_hardnosed && (si->si_did != 0 || si->si_seq != 0)) {
- spx_istat.gonawy++;
- goto dropwithreset;
- }
- sipx = &ssipx;
- bzero(sipx, sizeof *sipx);
- sipx->sipx_len = sizeof(*sipx);
- sipx->sipx_family = AF_IPX;
- sipx->sipx_addr = si->si_sna;
- laddr = ipxp->ipxp_laddr;
- if (ipx_nullhost(laddr))
- ipxp->ipxp_laddr = si->si_dna;
- if (ipx_pcbconnect(ipxp, (struct sockaddr *)sipx, &thread0)) {
- ipxp->ipxp_laddr = laddr;
- spx_istat.noconn++;
- goto drop;
- }
- spx_template(cb);
- dropsocket = 0; /* committed to socket */
- cb->s_did = si->si_sid;
- cb->s_rack = si->si_ack;
- cb->s_ralo = si->si_alo;
-#define THREEWAYSHAKE
-#ifdef THREEWAYSHAKE
- cb->s_state = TCPS_SYN_RECEIVED;
- cb->s_force = 1 + SPXT_KEEP;
- spxstat.spxs_accepts++;
- cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
- }
- break;
-
- case TCPS_SYN_RECEIVED: {
- /*
- * This state means that we have heard a response to our
- * acceptance of their connection. It is probably logically
- * unnecessary in this implementation.
- */
- if (si->si_did != cb->s_sid) {
- spx_istat.wrncon++;
- goto drop;
- }
-#endif
- ipxp->ipxp_fport = si->si_sport;
- cb->s_timer[SPXT_REXMT] = 0;
- cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
- soisconnected(so);
- cb->s_state = TCPS_ESTABLISHED;
- spxstat.spxs_accepts++;
- }
- break;
-
- case TCPS_SYN_SENT:
- /*
- * This state means that we have gotten a response to our
- * attempt to establish a connection. We fill in the data
- * from the other side, telling us which port to respond to,
- * instead of the well-known one we might have sent to in the
- * first place. We also require that this is a response to
- * our connection id.
- */
- if (si->si_did != cb->s_sid) {
- spx_istat.notme++;
- goto drop;
- }
- spxstat.spxs_connects++;
- cb->s_did = si->si_sid;
- cb->s_rack = si->si_ack;
- cb->s_ralo = si->si_alo;
- cb->s_dport = ipxp->ipxp_fport = si->si_sport;
- cb->s_timer[SPXT_REXMT] = 0;
- cb->s_flags |= SF_ACKNOW;
- soisconnected(so);
- cb->s_state = TCPS_ESTABLISHED;
-
- /*
- * Use roundtrip time of connection request for initial rtt.
- */
- if (cb->s_rtt) {
- cb->s_srtt = cb->s_rtt << 3;
- cb->s_rttvar = cb->s_rtt << 1;
- SPXT_RANGESET(cb->s_rxtcur,
- ((cb->s_srtt >> 2) + cb->s_rttvar) >> 1,
- SPXTV_MIN, SPXTV_REXMTMAX);
- cb->s_rtt = 0;
- }
- }
-
- if (so->so_options & SO_DEBUG || traceallspxs)
- spx_trace(SA_INPUT, (u_char)ostate, cb, &spx_savesi, 0);
-
- m->m_len -= sizeof(struct ipx);
- m->m_pkthdr.len -= sizeof(struct ipx);
- m->m_data += sizeof(struct ipx);
-
- if (spx_reass(cb, m, si))
- m_freem(m);
- if (cb->s_force || (cb->s_flags & (SF_ACKNOW|SF_WIN|SF_RXT)))
- spx_output(cb, NULL);
- cb->s_flags &= ~(SF_WIN|SF_RXT);
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- return;
-
-dropwithreset:
- IPX_LOCK_ASSERT(ipxp);
- if (cb == NULL || (cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG ||
- traceallspxs))
- spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0);
- IPX_UNLOCK(ipxp);
- if (dropsocket) {
- struct socket *head;
- ACCEPT_LOCK();
- KASSERT((so->so_qstate & SQ_INCOMP) != 0,
- ("spx_input: nascent socket not SQ_INCOMP on soabort()"));
- head = so->so_head;
- TAILQ_REMOVE(&head->so_incomp, so, so_list);
- head->so_incqlen--;
- so->so_qstate &= ~SQ_INCOMP;
- so->so_head = NULL;
- ACCEPT_UNLOCK();
- soabort(so);
- }
- IPX_LIST_UNLOCK();
- m_freem(m);
- return;
-
-drop:
- IPX_LOCK_ASSERT(ipxp);
- if (cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG || traceallspxs)
- spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0);
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- m_freem(m);
-}
-
-void
-spx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy)
-{
-
- /* Currently, nothing. */
-}
-
-int
-spx_output(struct spxpcb *cb, struct mbuf *m0)
-{
- struct socket *so = cb->s_ipxpcb->ipxp_socket;
- struct mbuf *m = NULL;
- struct spx *si = NULL;
- struct sockbuf *sb = &so->so_snd;
- int len = 0, win, rcv_win;
- short span, off, recordp = 0;
- u_short alo;
- int error = 0, sendalot;
-#ifdef notdef
- int idle;
-#endif
- struct mbuf *mprev;
-
- IPX_LOCK_ASSERT(cb->s_ipxpcb);
-
- if (m0 != NULL) {
- int mtu = cb->s_mtu;
- int datalen;
-
- /*
- * Make sure that packet isn't too big.
- */
- for (m = m0; m != NULL; m = m->m_next) {
- mprev = m;
- len += m->m_len;
- if (m->m_flags & M_EOR)
- recordp = 1;
- }
- datalen = (cb->s_flags & SF_HO) ?
- len - sizeof(struct spxhdr) : len;
- if (datalen > mtu) {
- if (cb->s_flags & SF_PI) {
- m_freem(m0);
- return (EMSGSIZE);
- } else {
- int oldEM = cb->s_cc & SPX_EM;
-
- cb->s_cc &= ~SPX_EM;
- while (len > mtu) {
- m = m_copym(m0, 0, mtu, M_NOWAIT);
- if (m == NULL) {
- cb->s_cc |= oldEM;
- m_freem(m0);
- return (ENOBUFS);
- }
- if (cb->s_flags & SF_NEWCALL) {
- struct mbuf *mm = m;
- spx_newchecks[7]++;
- while (mm != NULL) {
- mm->m_flags &= ~M_EOR;
- mm = mm->m_next;
- }
- }
- error = spx_output(cb, m);
- if (error) {
- cb->s_cc |= oldEM;
- m_freem(m0);
- return (error);
- }
- m_adj(m0, mtu);
- len -= mtu;
- }
- cb->s_cc |= oldEM;
- }
- }
-
- /*
- * Force length even, by adding a "garbage byte" if
- * necessary.
- */
- if (len & 1) {
- m = mprev;
- if (M_TRAILINGSPACE(m) >= 1)
- m->m_len++;
- else {
- struct mbuf *m1 = m_get(M_NOWAIT, MT_DATA);
-
- if (m1 == NULL) {
- m_freem(m0);
- return (ENOBUFS);
- }
- m1->m_len = 1;
- *(mtod(m1, u_char *)) = 0;
- m->m_next = m1;
- }
- }
- m = m_gethdr(M_NOWAIT, MT_DATA);
- if (m == NULL) {
- m_freem(m0);
- return (ENOBUFS);
- }
-
- /*
- * Fill in mbuf with extended SP header and addresses and
- * length put into network format.
- */
- MH_ALIGN(m, sizeof(struct spx));
- m->m_len = sizeof(struct spx);
- m->m_next = m0;
- si = mtod(m, struct spx *);
- si->si_i = cb->s_ipx;
- si->si_s = cb->s_shdr;
- if ((cb->s_flags & SF_PI) && (cb->s_flags & SF_HO)) {
- struct spxhdr *sh;
- if (m0->m_len < sizeof(*sh)) {
- if((m0 = m_pullup(m0, sizeof(*sh))) == NULL) {
- m_free(m);
- m_freem(m0);
- return (EINVAL);
- }
- m->m_next = m0;
- }
- sh = mtod(m0, struct spxhdr *);
- si->si_dt = sh->spx_dt;
- si->si_cc |= sh->spx_cc & SPX_EM;
- m0->m_len -= sizeof(*sh);
- m0->m_data += sizeof(*sh);
- len -= sizeof(*sh);
- }
- len += sizeof(*si);
- if ((cb->s_flags2 & SF_NEWCALL) && recordp) {
- si->si_cc |= SPX_EM;
- spx_newchecks[8]++;
- }
- if (cb->s_oobflags & SF_SOOB) {
- /*
- * Per jqj@cornell: Make sure OB packets convey
- * exactly 1 byte. If the packet is 1 byte or
- * larger, we have already guaranted there to be at
- * least one garbage byte for the checksum, and extra
- * bytes shouldn't hurt!
- */
- if (len > sizeof(*si)) {
- si->si_cc |= SPX_OB;
- len = (1 + sizeof(*si));
- }
- }
- si->si_len = htons((u_short)len);
- m->m_pkthdr.len = ((len - 1) | 1) + 1;
-
- /*
- * Queue stuff up for output.
- */
- sbappendrecord(sb, m);
- cb->s_seq++;
- }
-#ifdef notdef
- idle = (cb->s_smax == (cb->s_rack - 1));
-#endif
-again:
- sendalot = 0;
- off = cb->s_snxt - cb->s_rack;
- win = min(cb->s_swnd, (cb->s_cwnd / CUNIT));
-
- /*
- * If in persist timeout with window of 0, send a probe. Otherwise,
- * if window is small but non-zero and timer expired, send what we
- * can and go into transmit state.
- */
- if (cb->s_force == 1 + SPXT_PERSIST) {
- if (win != 0) {
- cb->s_timer[SPXT_PERSIST] = 0;
- cb->s_rxtshift = 0;
- }
- }
- span = cb->s_seq - cb->s_rack;
- len = min(span, win) - off;
-
- if (len < 0) {
- /*
- * Window shrank after we went into it. If window shrank to
- * 0, cancel pending restransmission and pull s_snxt back to
- * (closed) window. We will enter persist state below. If
- * the widndow didn't close completely, just wait for an ACK.
- */
- len = 0;
- if (win == 0) {
- cb->s_timer[SPXT_REXMT] = 0;
- cb->s_snxt = cb->s_rack;
- }
- }
- if (len > 1)
- sendalot = 1;
- rcv_win = sbspace(&so->so_rcv);
-
- /*
- * Send if we owe peer an ACK.
- */
- if (cb->s_oobflags & SF_SOOB) {
- /*
- * Must transmit this out of band packet.
- */
- cb->s_oobflags &= ~ SF_SOOB;
- sendalot = 1;
- spxstat.spxs_sndurg++;
- goto found;
- }
- if (cb->s_flags & SF_ACKNOW)
- goto send;
- if (cb->s_state < TCPS_ESTABLISHED)
- goto send;
-
- /*
- * Silly window can't happen in spx. Code from TCP deleted.
- */
- if (len)
- goto send;
-
- /*
- * Compare available window to amount of window known to peer (as
- * advertised window less next expected input.) If the difference is
- * at least two packets or at least 35% of the mximum possible
- * window, then want to send a window update to peer.
- */
- if (rcv_win > 0) {
- u_short delta = 1 + cb->s_alo - cb->s_ack;
- int adv = rcv_win - (delta * cb->s_mtu);
-
- if ((so->so_rcv.sb_cc == 0 && adv >= (2 * cb->s_mtu)) ||
- (100 * adv / so->so_rcv.sb_hiwat >= 35)) {
- spxstat.spxs_sndwinup++;
- cb->s_flags |= SF_ACKNOW;
- goto send;
- }
-
- }
-
- /*
- * Many comments from tcp_output.c are appropriate here including ...
- * If send window is too small, there is data to transmit, and no
- * retransmit or persist is pending, then go to persist state. If
- * nothing happens soon, send when timer expires: if window is
- * non-zero, transmit what we can, otherwise send a probe.
- */
- if (so->so_snd.sb_cc && cb->s_timer[SPXT_REXMT] == 0 &&
- cb->s_timer[SPXT_PERSIST] == 0) {
- cb->s_rxtshift = 0;
- spx_setpersist(cb);
- }
-
- /*
- * No reason to send a packet, just return.
- */
- cb->s_outx = 1;
- return (0);
-
-send:
- /*
- * Find requested packet.
- */
- si = NULL;
- m = NULL;
- if (len > 0) {
- cb->s_want = cb->s_snxt;
- for (m = sb->sb_mb; m != NULL; m = m->m_nextpkt) {
- si = mtod(m, struct spx *);
- if (SSEQ_LEQ(cb->s_snxt, si->si_seq))
- break;
- }
- found:
- if (si != NULL) {
- if (si->si_seq != cb->s_snxt) {
- spxstat.spxs_sndvoid++;
- si = NULL;
- m = NULL;
- } else
- cb->s_snxt++;
- }
- }
-
- /*
- * Update window.
- */
- if (rcv_win < 0)
- rcv_win = 0;
- alo = cb->s_ack - 1 + (rcv_win / ((short)cb->s_mtu));
- if (SSEQ_LT(alo, cb->s_alo))
- alo = cb->s_alo;
-
- if (m != NULL) {
- /*
- * Must make a copy of this packet for ipx_output to monkey
- * with.
- */
- m = m_copy(m, 0, M_COPYALL);
- if (m == NULL)
- return (ENOBUFS);
- si = mtod(m, struct spx *);
- if (SSEQ_LT(si->si_seq, cb->s_smax))
- spxstat.spxs_sndrexmitpack++;
- else
- spxstat.spxs_sndpack++;
- } else if (cb->s_force || cb->s_flags & SF_ACKNOW) {
- /*
- * Must send an acknowledgement or a probe.
- */
- if (cb->s_force)
- spxstat.spxs_sndprobe++;
- if (cb->s_flags & SF_ACKNOW)
- spxstat.spxs_sndacks++;
- m = m_gethdr(M_NOWAIT, MT_DATA);
- if (m == NULL)
- return (ENOBUFS);
-
- /*
- * Fill in mbuf with extended SP header and addresses and
- * length put into network format.
- */
- MH_ALIGN(m, sizeof(struct spx));
- m->m_len = sizeof(*si);
- m->m_pkthdr.len = sizeof(*si);
- si = mtod(m, struct spx *);
- si->si_i = cb->s_ipx;
- si->si_s = cb->s_shdr;
- si->si_seq = cb->s_smax + 1;
- si->si_len = htons(sizeof(*si));
- si->si_cc |= SPX_SP;
- } else {
- cb->s_outx = 3;
- if (so->so_options & SO_DEBUG || traceallspxs)
- spx_trace(SA_OUTPUT, cb->s_state, cb, si, 0);
- return (0);
- }
-
- /*
- * Stuff checksum and output datagram.
- */
- if ((si->si_cc & SPX_SP) == 0) {
- if (cb->s_force != (1 + SPXT_PERSIST) ||
- cb->s_timer[SPXT_PERSIST] == 0) {
- /*
- * If this is a new packet and we are not currently
- * timing anything, time this one.
- */
- if (SSEQ_LT(cb->s_smax, si->si_seq)) {
- cb->s_smax = si->si_seq;
- if (cb->s_rtt == 0) {
- spxstat.spxs_segstimed++;
- cb->s_rtseq = si->si_seq;
- cb->s_rtt = 1;
- }
- }
-
- /*
- * Set rexmt timer if not currently set, initial
- * value for retransmit timer is smoothed round-trip
- * time + 2 * round-trip time variance. Initialize
- * shift counter which is used for backoff of
- * retransmit time.
- */
- if (cb->s_timer[SPXT_REXMT] == 0 &&
- cb->s_snxt != cb->s_rack) {
- cb->s_timer[SPXT_REXMT] = cb->s_rxtcur;
- if (cb->s_timer[SPXT_PERSIST]) {
- cb->s_timer[SPXT_PERSIST] = 0;
- cb->s_rxtshift = 0;
- }
- }
- } else if (SSEQ_LT(cb->s_smax, si->si_seq))
- cb->s_smax = si->si_seq;
- } else if (cb->s_state < TCPS_ESTABLISHED) {
- if (cb->s_rtt == 0)
- cb->s_rtt = 1; /* Time initial handshake */
- if (cb->s_timer[SPXT_REXMT] == 0)
- cb->s_timer[SPXT_REXMT] = cb->s_rxtcur;
- }
-
- /*
- * Do not request acks when we ack their data packets or when we do a
- * gratuitous window update.
- */
- if (((si->si_cc & SPX_SP) == 0) || cb->s_force)
- si->si_cc |= SPX_SA;
- si->si_seq = htons(si->si_seq);
- si->si_alo = htons(alo);
- si->si_ack = htons(cb->s_ack);
-
- if (ipxcksum)
- si->si_sum = ipx_cksum(m, ntohs(si->si_len));
- else
- si->si_sum = 0xffff;
-
- cb->s_outx = 4;
- if (so->so_options & SO_DEBUG || traceallspxs)
- spx_trace(SA_OUTPUT, cb->s_state, cb, si, 0);
-
-#ifdef MAC
- mac_socket_create_mbuf(so, m);
-#endif
-
- if (so->so_options & SO_DONTROUTE)
- error = ipx_outputfl(m, NULL, IPX_ROUTETOIF);
- else
- error = ipx_outputfl(m, &cb->s_ipxpcb->ipxp_route, 0);
- if (error)
- return (error);
- spxstat.spxs_sndtotal++;
-
- /*
- * Data sent (as far as we can tell). If this advertises a larger
- * window than any other segment, then remember the size of the
- * advertized window. Any pending ACK has now been sent.
- */
- cb->s_force = 0;
- cb->s_flags &= ~(SF_ACKNOW|SF_DELACK);
- if (SSEQ_GT(alo, cb->s_alo))
- cb->s_alo = alo;
- if (sendalot)
- goto again;
- cb->s_outx = 5;
- return (0);
-}
-
-static int spx_do_persist_panics = 0;
-
-static void
-spx_setpersist(struct spxpcb *cb)
-{
- int t = ((cb->s_srtt >> 2) + cb->s_rttvar) >> 1;
-
- IPX_LOCK_ASSERT(cb->s_ipxpcb);
-
- if (cb->s_timer[SPXT_REXMT] && spx_do_persist_panics)
- panic("spx_output REXMT");
-
- /*
- * Start/restart persistance timer.
- */
- SPXT_RANGESET(cb->s_timer[SPXT_PERSIST],
- t*spx_backoff[cb->s_rxtshift],
- SPXTV_PERSMIN, SPXTV_PERSMAX);
- if (cb->s_rxtshift < SPX_MAXRXTSHIFT)
- cb->s_rxtshift++;
-}
-
-int
-spx_ctloutput(struct socket *so, struct sockopt *sopt)
-{
- struct spxhdr spxhdr;
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
- int mask, error;
- short soptval;
- u_short usoptval;
- int optval;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_ctloutput: ipxp == NULL"));
-
- /*
- * This will have to be changed when we do more general stacking of
- * protocols.
- */
- if (sopt->sopt_level != IPXPROTO_SPX)
- return (ipx_ctloutput(so, sopt));
-
- IPX_LOCK(ipxp);
- if (ipxp->ipxp_flags & IPXP_DROPPED) {
- IPX_UNLOCK(ipxp);
- return (ECONNRESET);
- }
-
- IPX_LOCK(ipxp);
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_ctloutput: cb == NULL"));
-
- error = 0;
- switch (sopt->sopt_dir) {
- case SOPT_GET:
- switch (sopt->sopt_name) {
- case SO_HEADERS_ON_INPUT:
- mask = SF_HI;
- goto get_flags;
-
- case SO_HEADERS_ON_OUTPUT:
- mask = SF_HO;
- get_flags:
- soptval = cb->s_flags & mask;
- IPX_UNLOCK(ipxp);
- error = sooptcopyout(sopt, &soptval,
- sizeof(soptval));
- break;
-
- case SO_MTU:
- usoptval = cb->s_mtu;
- IPX_UNLOCK(ipxp);
- error = sooptcopyout(sopt, &usoptval,
- sizeof(usoptval));
- break;
-
- case SO_LAST_HEADER:
- spxhdr = cb->s_rhdr;
- IPX_UNLOCK(ipxp);
- error = sooptcopyout(sopt, &spxhdr, sizeof(spxhdr));
- break;
-
- case SO_DEFAULT_HEADERS:
- spxhdr = cb->s_shdr;
- IPX_UNLOCK(ipxp);
- error = sooptcopyout(sopt, &spxhdr, sizeof(spxhdr));
- break;
-
- default:
- IPX_UNLOCK(ipxp);
- error = ENOPROTOOPT;
- }
- break;
-
- case SOPT_SET:
- /*
- * XXX Why are these shorts on get and ints on set? That
- * doesn't make any sense...
- *
- * XXXRW: Note, when we re-acquire the ipxp lock, we should
- * re-check that it's not dropped.
- */
- IPX_UNLOCK(ipxp);
- switch (sopt->sopt_name) {
- case SO_HEADERS_ON_INPUT:
- mask = SF_HI;
- goto set_head;
-
- case SO_HEADERS_ON_OUTPUT:
- mask = SF_HO;
- set_head:
- error = sooptcopyin(sopt, &optval, sizeof optval,
- sizeof optval);
- if (error)
- break;
-
- IPX_LOCK(ipxp);
- if (cb->s_flags & SF_PI) {
- if (optval)
- cb->s_flags |= mask;
- else
- cb->s_flags &= ~mask;
- } else error = EINVAL;
- IPX_UNLOCK(ipxp);
- break;
-
- case SO_MTU:
- error = sooptcopyin(sopt, &usoptval, sizeof usoptval,
- sizeof usoptval);
- if (error)
- break;
- /* Unlocked write. */
- cb->s_mtu = usoptval;
- break;
-
-#ifdef SF_NEWCALL
- case SO_NEWCALL:
- error = sooptcopyin(sopt, &optval, sizeof optval,
- sizeof optval);
- if (error)
- break;
- IPX_LOCK(ipxp);
- if (optval) {
- cb->s_flags2 |= SF_NEWCALL;
- spx_newchecks[5]++;
- } else {
- cb->s_flags2 &= ~SF_NEWCALL;
- spx_newchecks[6]++;
- }
- IPX_UNLOCK(ipxp);
- break;
-#endif
-
- case SO_DEFAULT_HEADERS:
- {
- struct spxhdr sp;
-
- error = sooptcopyin(sopt, &sp, sizeof sp,
- sizeof sp);
- if (error)
- break;
- IPX_LOCK(ipxp);
- cb->s_dt = sp.spx_dt;
- cb->s_cc = sp.spx_cc & SPX_EM;
- IPX_UNLOCK(ipxp);
- }
- break;
-
- default:
- error = ENOPROTOOPT;
- }
- break;
-
- default:
- panic("spx_ctloutput: bad socket option direction");
- }
- return (error);
-}
-
-static void
-spx_usr_abort(struct socket *so)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_usr_abort: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_usr_abort: cb == NULL"));
-
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- spx_drop(cb, ECONNABORTED);
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
-}
-
-/*
- * Accept a connection. Essentially all the work is done at higher levels;
- * just return the address of the peer, storing through addr.
- */
-static int
-spx_accept(struct socket *so, struct sockaddr **nam)
-{
- struct ipxpcb *ipxp;
- struct sockaddr_ipx *sipx, ssipx;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_accept: ipxp == NULL"));
-
- sipx = &ssipx;
- bzero(sipx, sizeof *sipx);
- sipx->sipx_len = sizeof *sipx;
- sipx->sipx_family = AF_IPX;
- IPX_LOCK(ipxp);
- sipx->sipx_addr = ipxp->ipxp_faddr;
- IPX_UNLOCK(ipxp);
- *nam = sodupsockaddr((struct sockaddr *)sipx, M_WAITOK);
- return (0);
-}
-
-static int
-spx_attach(struct socket *so, int proto, struct thread *td)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
- struct mbuf *mm;
- struct sockbuf *sb;
- int error;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp == NULL, ("spx_attach: ipxp != NULL"));
-
- if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
- error = soreserve(so, (u_long) 3072, (u_long) 3072);
- if (error)
- return (error);
- }
-
- cb = malloc(sizeof *cb, M_PCB, M_NOWAIT | M_ZERO);
- if (cb == NULL)
- return (ENOBUFS);
- mm = m_getclr(M_NOWAIT, MT_DATA);
- if (mm == NULL) {
- free(cb, M_PCB);
- return (ENOBUFS);
- }
-
- IPX_LIST_LOCK();
- error = ipx_pcballoc(so, &ipxpcb_list, td);
- if (error) {
- IPX_LIST_UNLOCK();
- m_free(mm);
- free(cb, M_PCB);
- return (error);
- }
- ipxp = sotoipxpcb(so);
- ipxp->ipxp_flags |= IPXP_SPX;
-
- cb->s_state = TCPS_LISTEN;
- cb->s_smax = -1;
- cb->s_swl1 = -1;
- spx_reass_init(cb);
- cb->s_ipxpcb = ipxp;
- cb->s_mtu = 576 - sizeof(struct spx);
- sb = &so->so_snd;
- cb->s_cwnd = sbspace(sb) * CUNIT / cb->s_mtu;
- cb->s_ssthresh = cb->s_cwnd;
- cb->s_cwmx = sbspace(sb) * CUNIT / (2 * sizeof(struct spx));
-
- /*
- * Above is recomputed when connecting to account for changed
- * buffering or mtu's.
- */
- cb->s_rtt = SPXTV_SRTTBASE;
- cb->s_rttvar = SPXTV_SRTTDFLT << 2;
- SPXT_RANGESET(cb->s_rxtcur,
- ((SPXTV_SRTTBASE >> 2) + (SPXTV_SRTTDFLT << 2)) >> 1,
- SPXTV_MIN, SPXTV_REXMTMAX);
- ipxp->ipxp_pcb = (caddr_t)cb;
- IPX_LIST_UNLOCK();
- return (0);
-}
-
-static void
-spx_pcbdetach(struct ipxpcb *ipxp)
-{
- struct spxpcb *cb;
-
- IPX_LOCK_ASSERT(ipxp);
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_pcbdetach: cb == NULL"));
-
- spx_reass_flush(cb);
- free(cb, M_PCB);
- ipxp->ipxp_pcb = NULL;
-}
-
-static int
-spx_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
-{
- struct ipxpcb *ipxp;
- int error;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_bind: ipxp == NULL"));
-
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- if (ipxp->ipxp_flags & IPXP_DROPPED) {
- error = EINVAL;
- goto out;
- }
- error = ipx_pcbbind(ipxp, nam, td);
-out:
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- return (error);
-}
-
-static void
-spx_usr_close(struct socket *so)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_usr_close: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_usr_close: cb == NULL"));
-
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- if (cb->s_state > TCPS_LISTEN)
- spx_disconnect(cb);
- else
- spx_close(cb);
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
-}
-
-/*
- * Initiate connection to peer. Enter SYN_SENT state, and mark socket as
- * connecting. Start keep-alive timer, setup prototype header, send initial
- * system packet requesting connection.
- */
-static int
-spx_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
- int error;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_connect: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_connect: cb == NULL"));
-
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- if (ipxp->ipxp_flags & IPXP_DROPPED) {
- error = EINVAL;
- goto spx_connect_end;
- }
- if (ipxp->ipxp_lport == 0) {
- error = ipx_pcbbind(ipxp, NULL, td);
- if (error)
- goto spx_connect_end;
- }
- error = ipx_pcbconnect(ipxp, nam, td);
- if (error)
- goto spx_connect_end;
- soisconnecting(so);
- spxstat.spxs_connattempt++;
- cb->s_state = TCPS_SYN_SENT;
- cb->s_did = 0;
- spx_template(cb);
- cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
- cb->s_force = 1 + SPXTV_KEEP;
-
- /*
- * Other party is required to respond to the port I send from, but he
- * is not required to answer from where I am sending to, so allow
- * wildcarding. Original port I am sending to is still saved in
- * cb->s_dport.
- */
- ipxp->ipxp_fport = 0;
- error = spx_output(cb, NULL);
-spx_connect_end:
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- return (error);
-}
-
-static void
-spx_detach(struct socket *so)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
-
- /*
- * XXXRW: Should assert appropriately detached.
- */
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_detach: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_detach: cb == NULL"));
-
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- spx_pcbdetach(ipxp);
- ipx_pcbdetach(ipxp);
- ipx_pcbfree(ipxp);
- IPX_LIST_UNLOCK();
-}
-
-/*
- * We may decide later to implement connection closing handshaking at the spx
- * level optionally. Here is the hook to do it:
- */
-static int
-spx_usr_disconnect(struct socket *so)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
- int error;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_usr_disconnect: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_usr_disconnect: cb == NULL"));
-
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- if (ipxp->ipxp_flags & IPXP_DROPPED) {
- error = EINVAL;
- goto out;
- }
- spx_disconnect(cb);
- error = 0;
-out:
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- return (error);
-}
-
-static int
-spx_listen(struct socket *so, int backlog, struct thread *td)
-{
- int error;
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
-
- error = 0;
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_listen: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_listen: cb == NULL"));
-
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- if (ipxp->ipxp_flags & IPXP_DROPPED) {
- error = EINVAL;
- goto out;
- }
- SOCK_LOCK(so);
- error = solisten_proto_check(so);
- if (error == 0 && ipxp->ipxp_lport == 0)
- error = ipx_pcbbind(ipxp, NULL, td);
- if (error == 0) {
- cb->s_state = TCPS_LISTEN;
- solisten_proto(so, backlog);
- }
- SOCK_UNLOCK(so);
-out:
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- return (error);
-}
-
-/*
- * After a receive, possibly send acknowledgment updating allocation.
- */
-static int
-spx_rcvd(struct socket *so, int flags)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
- int error;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_rcvd: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_rcvd: cb == NULL"));
-
- IPX_LOCK(ipxp);
- if (ipxp->ipxp_flags & IPXP_DROPPED) {
- error = EINVAL;
- goto out;
- }
- cb->s_flags |= SF_RVD;
- spx_output(cb, NULL);
- cb->s_flags &= ~SF_RVD;
- error = 0;
-out:
- IPX_UNLOCK(ipxp);
- return (error);
-}
-
-static int
-spx_rcvoob(struct socket *so, struct mbuf *m, int flags)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
- int error;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_rcvoob: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_rcvoob: cb == NULL"));
-
- IPX_LOCK(ipxp);
- if (ipxp->ipxp_flags & IPXP_DROPPED) {
- error = EINVAL;
- goto out;
- }
- SOCKBUF_LOCK(&so->so_rcv);
- if ((cb->s_oobflags & SF_IOOB) || so->so_oobmark ||
- (so->so_rcv.sb_state & SBS_RCVATMARK)) {
- SOCKBUF_UNLOCK(&so->so_rcv);
- m->m_len = 1;
- *mtod(m, caddr_t) = cb->s_iobc;
- error = 0;
- goto out;
- }
- SOCKBUF_UNLOCK(&so->so_rcv);
- error = EINVAL;
-out:
- IPX_UNLOCK(ipxp);
- return (error);
-}
-
-static int
-spx_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr,
- struct mbuf *controlp, struct thread *td)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
- int error;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_send: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_send: cb == NULL"));
-
- error = 0;
- IPX_LOCK(ipxp);
- if (ipxp->ipxp_flags & IPXP_DROPPED) {
- error = ECONNRESET;
- goto spx_send_end;
- }
- if (flags & PRUS_OOB) {
- if (sbspace(&so->so_snd) < -512) {
- error = ENOBUFS;
- goto spx_send_end;
- }
- cb->s_oobflags |= SF_SOOB;
- }
- if (controlp != NULL) {
- u_short *p = mtod(controlp, u_short *);
- spx_newchecks[2]++;
- if ((p[0] == 5) && (p[1] == 1)) { /* XXXX, for testing */
- cb->s_shdr.spx_dt = *(u_char *)(&p[2]);
- spx_newchecks[3]++;
- }
- m_freem(controlp);
- }
- controlp = NULL;
- error = spx_output(cb, m);
- m = NULL;
-spx_send_end:
- IPX_UNLOCK(ipxp);
- if (controlp != NULL)
- m_freem(controlp);
- if (m != NULL)
- m_freem(m);
- return (error);
-}
-
-static int
-spx_shutdown(struct socket *so)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
- int error;
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_shutdown: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_shutdown: cb == NULL"));
-
- socantsendmore(so);
- IPX_LIST_LOCK();
- IPX_LOCK(ipxp);
- if (ipxp->ipxp_flags & IPXP_DROPPED) {
- error = EINVAL;
- goto out;
- }
- spx_usrclosed(cb);
- error = 0;
-out:
- IPX_UNLOCK(ipxp);
- IPX_LIST_UNLOCK();
- return (error);
-}
-
-static int
-spx_sp_attach(struct socket *so, int proto, struct thread *td)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
- int error;
-
- KASSERT(so->so_pcb == NULL, ("spx_sp_attach: so_pcb != NULL"));
-
- error = spx_attach(so, proto, td);
- if (error)
- return (error);
-
- ipxp = sotoipxpcb(so);
- KASSERT(ipxp != NULL, ("spx_sp_attach: ipxp == NULL"));
-
- cb = ipxtospxpcb(ipxp);
- KASSERT(cb != NULL, ("spx_sp_attach: cb == NULL"));
-
- IPX_LOCK(ipxp);
- cb->s_flags |= (SF_HI | SF_HO | SF_PI);
- IPX_UNLOCK(ipxp);
- return (0);
-}
-
-/*
- * Create template to be used to send spx packets on a connection. Called
- * after host entry created, fills in a skeletal spx header (choosing
- * connection id), minimizing the amount of work necessary when the
- * connection is used.
- */
-static void
-spx_template(struct spxpcb *cb)
-{
- struct ipxpcb *ipxp = cb->s_ipxpcb;
- struct sockbuf *sb = &(ipxp->ipxp_socket->so_snd);
-
- IPX_LOCK_ASSERT(ipxp);
-
- cb->s_ipx.ipx_pt = IPXPROTO_SPX;
- cb->s_ipx.ipx_sna = ipxp->ipxp_laddr;
- cb->s_ipx.ipx_dna = ipxp->ipxp_faddr;
- SPX_LOCK();
- cb->s_sid = htons(spx_iss);
- spx_iss += SPX_ISSINCR/2;
- SPX_UNLOCK();
- cb->s_alo = 1;
- cb->s_cwnd = (sbspace(sb) * CUNIT) / cb->s_mtu;
-
- /*
- * Try to expand fast to full complement of large packets.
- */
- cb->s_ssthresh = cb->s_cwnd;
- cb->s_cwmx = (sbspace(sb) * CUNIT) / (2 * sizeof(struct spx));
-
- /*
- * But allow for lots of little packets as well.
- */
- cb->s_cwmx = max(cb->s_cwmx, cb->s_cwnd);
-}
-
-/*
- * Close a SPIP control block. Wake up any sleepers. We used to free any
- * queued packets, but now we defer that until the pcb is discarded.
- */
-void
-spx_close(struct spxpcb *cb)
-{
- struct ipxpcb *ipxp = cb->s_ipxpcb;
- struct socket *so = ipxp->ipxp_socket;
-
- KASSERT(ipxp != NULL, ("spx_close: ipxp == NULL"));
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(ipxp);
-
- ipxp->ipxp_flags |= IPXP_DROPPED;
- soisdisconnected(so);
- spxstat.spxs_closed++;
-}
-
-/*
- * Someday we may do level 3 handshaking to close a connection or send a
- * xerox style error. For now, just close. cb will always be invalid after
- * this call.
- */
-static void
-spx_usrclosed(struct spxpcb *cb)
-{
-
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(cb->s_ipxpcb);
-
- spx_close(cb);
-}
-
-/*
- * cb will always be invalid after this call.
- */
-static void
-spx_disconnect(struct spxpcb *cb)
-{
-
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(cb->s_ipxpcb);
-
- spx_close(cb);
-}
-
-/*
- * Drop connection, reporting the specified error. cb will always be invalid
- * after this call.
- */
-static void
-spx_drop(struct spxpcb *cb, int errno)
-{
- struct socket *so = cb->s_ipxpcb->ipxp_socket;
-
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(cb->s_ipxpcb);
-
- /*
- * Someday, in the xerox world we will generate error protocol
- * packets announcing that the socket has gone away.
- */
- if (TCPS_HAVERCVDSYN(cb->s_state)) {
- spxstat.spxs_drops++;
- cb->s_state = TCPS_CLOSED;
- /*tcp_output(cb);*/
- } else
- spxstat.spxs_conndrops++;
- so->so_error = errno;
- spx_close(cb);
-}
-
-/*
- * Fast timeout routine for processing delayed acks.
- */
-void
-spx_fasttimo(void)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
-
- IPX_LIST_LOCK();
- LIST_FOREACH(ipxp, &ipxpcb_list, ipxp_list) {
- IPX_LOCK(ipxp);
- if (!(ipxp->ipxp_flags & IPXP_SPX) ||
- (ipxp->ipxp_flags & IPXP_DROPPED)) {
- IPX_UNLOCK(ipxp);
- continue;
- }
- cb = ipxtospxpcb(ipxp);
- if (cb->s_flags & SF_DELACK) {
- cb->s_flags &= ~SF_DELACK;
- cb->s_flags |= SF_ACKNOW;
- spxstat.spxs_delack++;
- spx_output(cb, NULL);
- }
- IPX_UNLOCK(ipxp);
- }
- IPX_LIST_UNLOCK();
-}
-
-/*
- * spx protocol timeout routine called every 500 ms. Updates the timers in
- * all active pcb's and causes finite state machine actions if timers expire.
- */
-void
-spx_slowtimo(void)
-{
- struct ipxpcb *ipxp;
- struct spxpcb *cb;
- int i;
-
- /*
- * Search through tcb's and update active timers. Once, timers could
- * free ipxp's, but now we do that only when detaching a socket.
- */
- IPX_LIST_LOCK();
- LIST_FOREACH(ipxp, &ipxpcb_list, ipxp_list) {
- IPX_LOCK(ipxp);
- if (!(ipxp->ipxp_flags & IPXP_SPX) ||
- (ipxp->ipxp_flags & IPXP_DROPPED)) {
- IPX_UNLOCK(ipxp);
- continue;
- }
-
- cb = (struct spxpcb *)ipxp->ipxp_pcb;
- KASSERT(cb != NULL, ("spx_slowtimo: cb == NULL"));
- for (i = 0; i < SPXT_NTIMERS; i++) {
- if (cb->s_timer[i] && --cb->s_timer[i] == 0) {
- spx_timers(cb, i);
- if (ipxp->ipxp_flags & IPXP_DROPPED)
- break;
- }
- }
- if (!(ipxp->ipxp_flags & IPXP_DROPPED)) {
- cb->s_idle++;
- if (cb->s_rtt)
- cb->s_rtt++;
- }
- IPX_UNLOCK(ipxp);
- }
- IPX_LIST_UNLOCK();
- SPX_LOCK();
- spx_iss += SPX_ISSINCR/PR_SLOWHZ; /* increment iss */
- SPX_UNLOCK();
-}
-
-/*
- * SPX timer processing.
- */
-static void
-spx_timers(struct spxpcb *cb, int timer)
-{
- long rexmt;
- int win;
-
- IPX_LIST_LOCK_ASSERT();
- IPX_LOCK_ASSERT(cb->s_ipxpcb);
-
- cb->s_force = 1 + timer;
- switch (timer) {
- case SPXT_2MSL:
- /*
- * 2 MSL timeout in shutdown went off. TCP deletes
- * connection control block.
- */
- printf("spx: SPXT_2MSL went off for no reason\n");
- cb->s_timer[timer] = 0;
- break;
-
- case SPXT_REXMT:
- /*
- * Retransmission timer went off. Message has not been acked
- * within retransmit interval. Back off to a longer
- * retransmit interval and retransmit one packet.
- */
- if (++cb->s_rxtshift > SPX_MAXRXTSHIFT) {
- cb->s_rxtshift = SPX_MAXRXTSHIFT;
- spxstat.spxs_timeoutdrop++;
- spx_drop(cb, ETIMEDOUT);
- break;
- }
- spxstat.spxs_rexmttimeo++;
- rexmt = ((cb->s_srtt >> 2) + cb->s_rttvar) >> 1;
- rexmt *= spx_backoff[cb->s_rxtshift];
- SPXT_RANGESET(cb->s_rxtcur, rexmt, SPXTV_MIN, SPXTV_REXMTMAX);
- cb->s_timer[SPXT_REXMT] = cb->s_rxtcur;
-
- /*
- * If we have backed off fairly far, our srtt estimate is
- * probably bogus. Clobber it so we'll take the next rtt
- * measurement as our srtt; move the current srtt into rttvar
- * to keep the current retransmit times until then.
- */
- if (cb->s_rxtshift > SPX_MAXRXTSHIFT / 4 ) {
- cb->s_rttvar += (cb->s_srtt >> 2);
- cb->s_srtt = 0;
- }
- cb->s_snxt = cb->s_rack;
-
- /*
- * If timing a packet, stop the timer.
- */
- cb->s_rtt = 0;
-
- /*
- * See very long discussion in tcp_timer.c about congestion
- * window and sstrhesh.
- */
- win = min(cb->s_swnd, (cb->s_cwnd/CUNIT)) / 2;
- if (win < 2)
- win = 2;
- cb->s_cwnd = CUNIT;
- cb->s_ssthresh = win * CUNIT;
- spx_output(cb, NULL);
- break;
-
- case SPXT_PERSIST:
- /*
- * Persistance timer into zero window. Force a probe to be
- * sent.
- */
- spxstat.spxs_persisttimeo++;
- spx_setpersist(cb);
- spx_output(cb, NULL);
- break;
-
- case SPXT_KEEP:
- /*
- * Keep-alive timer went off; send something or drop
- * connection if idle for too long.
- */
- spxstat.spxs_keeptimeo++;
- if (cb->s_state < TCPS_ESTABLISHED)
- goto dropit;
- if (cb->s_ipxpcb->ipxp_socket->so_options & SO_KEEPALIVE) {
- if (cb->s_idle >= SPXTV_MAXIDLE)
- goto dropit;
- spxstat.spxs_keepprobe++;
- spx_output(cb, NULL);
- } else
- cb->s_idle = 0;
- cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
- break;
-
- dropit:
- spxstat.spxs_keepdrops++;
- spx_drop(cb, ETIMEDOUT);
- break;
-
- default:
- panic("spx_timers: unknown timer %d", timer);
- }
-}
diff --git a/sys/netipx/spx_var.h b/sys/netipx/spx_var.h
deleted file mode 100644
index 96939f9..0000000
--- a/sys/netipx/spx_var.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*-
- * Copyright (c) 1984, 1985, 1986, 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995, Mike Mitchell
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)spx_var.h
- *
- * $FreeBSD$
- */
-
-#ifndef _NETIPX_SPX_VAR_H_
-#define _NETIPX_SPX_VAR_H_
-
-struct spxstat {
- long spxs_connattempt; /* connections initiated */
- long spxs_accepts; /* connections accepted */
- long spxs_connects; /* connections established */
- long spxs_drops; /* connections dropped */
- long spxs_conndrops; /* embryonic connections dropped */
- long spxs_closed; /* conn. closed (includes drops) */
- long spxs_segstimed; /* segs where we tried to get rtt */
- long spxs_rttupdated; /* times we succeeded */
- long spxs_delack; /* delayed acks sent */
- long spxs_timeoutdrop; /* conn. dropped in rxmt timeout */
- long spxs_rexmttimeo; /* retransmit timeouts */
- long spxs_persisttimeo; /* persist timeouts */
- long spxs_keeptimeo; /* keepalive timeouts */
- long spxs_keepprobe; /* keepalive probes sent */
- long spxs_keepdrops; /* connections dropped in keepalive */
-
- long spxs_sndtotal; /* total packets sent */
- long spxs_sndpack; /* data packets sent */
- long spxs_sndbyte; /* data bytes sent */
- long spxs_sndrexmitpack; /* data packets retransmitted */
- long spxs_sndrexmitbyte; /* data bytes retransmitted */
- long spxs_sndacks; /* ack-only packets sent */
- long spxs_sndprobe; /* window probes sent */
- long spxs_sndurg; /* packets sent with URG only */
- long spxs_sndwinup; /* window update-only packets sent */
- long spxs_sndctrl; /* control (SYN|FIN|RST) packets sent */
- long spxs_sndvoid; /* couldn't find requested packet*/
-
- long spxs_rcvtotal; /* total packets received */
- long spxs_rcvpack; /* packets received in sequence */
- long spxs_rcvbyte; /* bytes received in sequence */
- long spxs_rcvbadsum; /* packets received with ccksum errs */
- long spxs_rcvbadoff; /* packets received with bad offset */
- long spxs_rcvshort; /* packets received too short */
- long spxs_rcvduppack; /* duplicate-only packets received */
- long spxs_rcvdupbyte; /* duplicate-only bytes received */
- long spxs_rcvpartduppack; /* packets with some duplicate data */
- long spxs_rcvpartdupbyte; /* dup. bytes in part-dup. packets */
- long spxs_rcvoopack; /* out-of-order packets received */
- long spxs_rcvoobyte; /* out-of-order bytes received */
- long spxs_rcvpackafterwin; /* packets with data after window */
- long spxs_rcvbyteafterwin; /* bytes rcvd after window */
- long spxs_rcvafterclose; /* packets rcvd after "close" */
- long spxs_rcvwinprobe; /* rcvd window probe packets */
- long spxs_rcvdupack; /* rcvd duplicate acks */
- long spxs_rcvacktoomuch; /* rcvd acks for unsent data */
- long spxs_rcvackpack; /* rcvd ack packets */
- long spxs_rcvackbyte; /* bytes acked by rcvd acks */
- long spxs_rcvwinupd; /* rcvd window update packets */
-};
-struct spx_istat {
- short hdrops;
- short badsum;
- short badlen;
- short slotim;
- short fastim;
- short nonucn;
- short noconn;
- short notme;
- short wrncon;
- short bdreas;
- short gonawy;
- short notyet;
- short lstdup;
- struct spxstat newstats;
-};
-
-#define SPX_ISSINCR 128
-/*
- * spx sequence numbers are 16 bit integers operated
- * on with modular arithmetic. These macros can be
- * used to compare such integers.
- */
-#define SSEQ_LT(a,b) (((short)((a)-(b))) < 0)
-#define SSEQ_LEQ(a,b) (((short)((a)-(b))) <= 0)
-#define SSEQ_GT(a,b) (((short)((a)-(b))) > 0)
-#define SSEQ_GEQ(a,b) (((short)((a)-(b))) >= 0)
-
-#ifdef _KERNEL
-/* Following was struct spxstat spxstat; */
-#ifndef spxstat
-#define spxstat spx_istat.newstats
-#endif
-extern struct spx_istat spx_istat;
-extern u_short spx_newchecks[50];
-
-int spx_output(struct spxpcb *cb, struct mbuf *m0);
-int spx_reass(struct spxpcb *cb, struct mbuf *msi, struct spx *si);
-void spx_reass_flush(struct spxpcb *cb);
-void spx_reass_init(struct spxpcb *cb);
-#endif
-
-#endif /* !_NETIPX_SPX_VAR_H_ */
diff --git a/sys/netsmb/netbios.h b/sys/netsmb/netbios.h
index dff79b9..36d08ac 100644
--- a/sys/netsmb/netbios.h
+++ b/sys/netsmb/netbios.h
@@ -35,10 +35,6 @@
#include <netinet/in.h>
#endif
-#ifndef _NETIPX_IPX_H_
-#include <netipx/ipx.h>
-#endif
-
#define NMB_TCP_PORT 137
#define NBPROTO_TCPSSN 1 /* NETBIOS session over TCP */
@@ -114,7 +110,7 @@
*/
union nb_tran {
struct sockaddr_in x_in;
- struct sockaddr_ipx x_ipx;
+ /* struct sockaddr_ipx was here. */
};
struct nb_name {
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index ab978de..617c059 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
#include "opt_cpu.h"
#include "opt_ddb.h"
#include "opt_inet.h"
-#include "opt_ipx.h"
#include "opt_isa.h"
#include "opt_kstack_pages.h"
#include "opt_maxmem.h"
diff --git a/sys/security/mac_biba/mac_biba.c b/sys/security/mac_biba/mac_biba.c
index 4216fea..f8c10b2 100644
--- a/sys/security/mac_biba/mac_biba.c
+++ b/sys/security/mac_biba/mac_biba.c
@@ -2069,8 +2069,6 @@ biba_priv_check(struct ucred *cred, int priv)
case PRIV_NETINET_RESERVEDPORT:
case PRIV_NETINET_RAW:
case PRIV_NETINET_REUSEPORT:
- case PRIV_NETIPX_RESERVEDPORT:
- case PRIV_NETIPX_RAW:
break;
/*
diff --git a/sys/security/mac_lomac/mac_lomac.c b/sys/security/mac_lomac/mac_lomac.c
index 40c9c2f..fb378e6 100644
--- a/sys/security/mac_lomac/mac_lomac.c
+++ b/sys/security/mac_lomac/mac_lomac.c
@@ -1836,8 +1836,6 @@ lomac_priv_check(struct ucred *cred, int priv)
case PRIV_NETINET_RESERVEDPORT:
case PRIV_NETINET_RAW:
case PRIV_NETINET_REUSEPORT:
- case PRIV_NETIPX_RESERVEDPORT:
- case PRIV_NETIPX_RAW:
break;
/*
diff --git a/sys/sys/param.h b/sys/sys/param.h
index f2bcc79..2c991da 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -58,7 +58,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1100011 /* Master, propagated to newvers */
+#define __FreeBSD_version 1100012 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
diff --git a/sys/sys/priv.h b/sys/sys/priv.h
index 18d17af..778f057 100644
--- a/sys/sys/priv.h
+++ b/sys/sys/priv.h
@@ -392,12 +392,6 @@
#define PRIV_NETINET_BINDANY 506 /* Allow bind to any address. */
/*
- * IPX/SPX privileges.
- */
-#define PRIV_NETIPX_RESERVEDPORT 520 /* Bind low port number. */
-#define PRIV_NETIPX_RAW 521 /* Open netipx raw socket. */
-
-/*
* NCP privileges.
*/
#define PRIV_NETNCP 530 /* Use another user's connection. */
diff --git a/tools/bsdbox/Makefile b/tools/bsdbox/Makefile
index ad25f4a..40fb8b9 100644
--- a/tools/bsdbox/Makefile
+++ b/tools/bsdbox/Makefile
@@ -72,9 +72,6 @@ CRUNCH_SRCDIRS+= sbin
CRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec
# Don't forget this - ifconfig, etc -adrian
-.if ${MK_IPX} != "no"
-CRUNCH_LIBS+= -lipx
-.endif
CRUNCH_LIBS+= -lgeom -lbsdxml -ljail -lkiconv -lmd -lsbuf -lufs
##################################################################
diff --git a/tools/bsdbox/Makefile.net b/tools/bsdbox/Makefile.net
index 1b9bc78..179fe70 100644
--- a/tools/bsdbox/Makefile.net
+++ b/tools/bsdbox/Makefile.net
@@ -18,11 +18,9 @@ CRUNCH_LIBS+= -lwrap
# netstat
CRUNCH_PROGS_usr.bin+= netstat
CRUNCH_LIBS+= -lmemstat -lnetgraph
-CRUNCH_BUILDOPTS_netstat=-DMK_IPX_SUPPORT=no
# ifconfig
CRUNCH_PROGS_sbin+= ifconfig
-CRUNCH_BUILDOPTS_ifconfig=-DMK_IPX_SUPPORT=no
# wlan stuff
CRUNCH_PROGS_usr.sbin+= wlandebug
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index f96023f..6f34d31 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -2074,24 +2074,6 @@ OLD_FILES+=usr/share/man/man8/ipfwpcap.8.gz
OLD_FILES+=usr/share/man/man8/natd.8.gz
.endif
-.if ${MK_IPX} == no
-OLD_LIBS+=lib/libipx.so.5
-OLD_FILES+=usr/lib/libipx.a
-OLD_FILES+=usr/lib/libipx.so
-OLD_FILES+=usr/lib/libipx_p.a
-.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
-OLD_FILES+=usr/lib32/libipx.a
-OLD_FILES+=usr/lib32/libipx.so
-OLD_LIBS+=usr/lib32/libipx.so.5
-OLD_FILES+=usr/lib32/libipx_p.a
-.endif
-OLD_FILES+=usr/sbin/IPXrouted
-OLD_FILES+=usr/share/man/man3/ipx.3.gz
-OLD_FILES+=usr/share/man/man3/ipx_addr.3.gz
-OLD_FILES+=usr/share/man/man3/ipx_ntoa.3.gz
-OLD_FILES+=usr/share/man/man8/IPXrouted.8.gz
-.endif
-
.if ${MK_JAIL} == no
OLD_FILES+=usr/sbin/jail
OLD_FILES+=usr/sbin/jexec
@@ -3688,7 +3670,6 @@ OLD_FILES+=usr/lib/libheimbase_p.a
OLD_FILES+=usr/lib/libheimsqlite_p.a
OLD_FILES+=usr/lib/libhistory_p.a
OLD_FILES+=usr/lib/libipsec_p.a
-OLD_FILES+=usr/lib/libipx_p.a
OLD_FILES+=usr/lib/libjail_p.a
OLD_FILES+=usr/lib/libkadm5clnt_p.a
OLD_FILES+=usr/lib/libkadm5srv_p.a
diff --git a/tools/build/options/WITHOUT_IPX b/tools/build/options/WITHOUT_IPX
deleted file mode 100644
index 6198d40..0000000
--- a/tools/build/options/WITHOUT_IPX
+++ /dev/null
@@ -1,2 +0,0 @@
-.\" $FreeBSD$
-Set to not build programs and libraries related to IPX networking.
diff --git a/tools/build/options/WITHOUT_IPX_SUPPORT b/tools/build/options/WITHOUT_IPX_SUPPORT
deleted file mode 100644
index b15cbf0..0000000
--- a/tools/build/options/WITHOUT_IPX_SUPPORT
+++ /dev/null
@@ -1,2 +0,0 @@
-.\" $FreeBSD$
-Set to build some programs without IPX support.
diff --git a/tools/regression/netipx/README b/tools/regression/netipx/README
deleted file mode 100644
index a1a07a4..0000000
--- a/tools/regression/netipx/README
+++ /dev/null
@@ -1,11 +0,0 @@
-These regression tests assume that the kernel is compiled with support for
-netipx:
-
- options IPX
-
-In addition, the loopback interface should be configured with the address
-0xbebe.1:
-
- ifconfig lo0 ipx 0xbebe.1
-
-$FreeBSD$
diff --git a/tools/regression/netipx/ipxdgramloopback/Makefile b/tools/regression/netipx/ipxdgramloopback/Makefile
deleted file mode 100644
index 78b3e45..0000000
--- a/tools/regression/netipx/ipxdgramloopback/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# $FreeBSD$
-#
-
-PROG= ipxdgramloopback
-NO_MAN=
-
-DPADD= ${LIBIPX}
-LDADD= -lipx
-WARNS?= 3
-
-.include <bsd.prog.mk>
diff --git a/tools/regression/netipx/ipxdgramloopback/ipxdgramloopback.c b/tools/regression/netipx/ipxdgramloopback/ipxdgramloopback.c
deleted file mode 100644
index 73b6a2a..0000000
--- a/tools/regression/netipx/ipxdgramloopback/ipxdgramloopback.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-
- * Copyright (c) 2006 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * Simple netipx regression test that attempts to build an IPX datagram
- * socket pair and send a packet from one to the other.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <netipx/ipx.h>
-
-#include <err.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-
-#define IPX_ENDPOINT "0xbebe.1.0x8a13"
-#define PACKETLEN 128
-
-int
-main(int argc, char *argv[])
-{
- struct sockaddr_ipx sipx_recv, sipx_send;
- u_char packet[PACKETLEN];
- int i, sock_recv, sock_send;
- ssize_t len;
-
- /*
- * Socket to receive with.
- */
- sock_recv = socket(PF_IPX, SOCK_DGRAM, 0);
- if (sock_recv < 0)
- err(-1, "sock_recv = socket(PF_IPX, SOCK_DGRAM, 0)");
-
- bzero(&sipx_recv, sizeof(sipx_recv));
- sipx_recv.sipx_len = sizeof(sipx_recv);
- sipx_recv.sipx_family = AF_IPX;
- sipx_recv.sipx_addr = ipx_addr(IPX_ENDPOINT);
-
- if (bind(sock_recv, (struct sockaddr *)&sipx_recv, sizeof(sipx_recv))
- < 0)
- err(-1, "bind(sock_recv)");
-
- /*
- * Set non-blocking to try to avoid blocking indefinitely if the
- * packet doesn't end up in the right place.
- */
- if (fcntl(sock_recv, F_SETFL, O_NONBLOCK) < 0)
- err(-1, "fcntl(O_NONBLOCK, sock_recv)");
-
- /*
- * Socket to send with.
- */
- sock_send = socket(PF_IPX, SOCK_DGRAM, 0);
- if (sock_send < 0)
- err(-1, "sock_send = socket(PF_IPX, SOCK_DGRAM, 0)");
-
- bzero(&sipx_send, sizeof(sipx_send));
- sipx_send.sipx_len = sizeof(sipx_send);
- sipx_send.sipx_family = AF_IPX;
- sipx_send.sipx_addr = ipx_addr(IPX_ENDPOINT);
-
- for (i = 0; i < PACKETLEN; i++)
- packet[i] = (i & 0xff);
-
- len = sendto(sock_send, packet, sizeof(packet), 0,
- (struct sockaddr *)&sipx_send, sizeof(sipx_send));
- if (len < 0)
- err(-1, "sendto()");
- if (len != sizeof(packet))
- errx(-1, "sendto(): short send (%zu length, %zd sent)",
- sizeof(packet), len);
-
- sleep(1); /* Arbitrary non-zero amount. */
-
- bzero(packet, sizeof(packet));
- len = recv(sock_recv, packet, sizeof(packet), 0);
- if (len < 0)
- err(-1, "recv()");
- if (len != sizeof(packet))
- errx(-1, "recv(): short receive (%zu length, %zd received)",
- sizeof(packet), len);
-
- for (i = 0; i < PACKETLEN; i++) {
- if (packet[i] != (i & 0xff))
- errx(-1, "recv(): byte %d wrong (%d instead of %d)",
- i, packet[i], i & 0xff);
- }
-
- return (0);
-}
diff --git a/tools/regression/netipx/ipxsocket/Makefile b/tools/regression/netipx/ipxsocket/Makefile
deleted file mode 100644
index 65157fa..0000000
--- a/tools/regression/netipx/ipxsocket/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# $FreeBSD$
-#
-
-PROG= ipxsocket
-NO_MAN=
-
-.include <bsd.prog.mk>
diff --git a/tools/regression/netipx/ipxsocket/ipxsocket.c b/tools/regression/netipx/ipxsocket/ipxsocket.c
deleted file mode 100644
index afcd2dc..0000000
--- a/tools/regression/netipx/ipxsocket/ipxsocket.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * Copyright (c) 2006 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * Simple regression test to open and then immediately close various types of
- * PF_IPX sockets. Run with various waits in order to make sure that the
- * various IPX/SPX timers have a chance to walk the pcb lists and hit the
- * sockets.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <netipx/ipx.h>
-
-#include <err.h>
-#include <unistd.h>
-
-static int
-maybe_sleep(int sec)
-{
-
- if (sec == 0)
- return (0);
- return (sleep(sec));
-}
-
-int
-main(int argc, char *argv[])
-{
- int delay, s;
-
- for (delay = 0; delay < 5; delay++) {
- s = socket(PF_IPX, SOCK_DGRAM, 0);
- if (s < 0)
- warn("socket(PF_IPX, SOCK_DGRAM, 0)");
- else {
- maybe_sleep(delay);
- close(s);
- }
-
- s = socket(PF_IPX, SOCK_STREAM, 0);
- if (s < 0)
- warn("socket(PF_IPX, SOCK_STREAM, 0)");
- else {
- maybe_sleep(delay);
- close(s);
- }
-
- s = socket(PF_IPX, SOCK_SEQPACKET, 0);
- if (s < 0)
- warn("socket(PF_IPX, SOCK_SEQPACKET, 0)");
- else {
- maybe_sleep(delay);
- close(s);
- }
-
- s = socket(PF_IPX, SOCK_RAW, 0);
- if (s < 0)
- warn("socket(PF_IPX, SOCK_RAW, 0)");
- else {
- maybe_sleep(delay);
- close(s);
- }
- }
-
- return (0);
-}
diff --git a/tools/regression/netipx/spxabort/Makefile b/tools/regression/netipx/spxabort/Makefile
deleted file mode 100644
index ec3ef5b..0000000
--- a/tools/regression/netipx/spxabort/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# $FreeBSD$
-#
-
-PROG= spxabort
-NO_MAN=
-
-DPADD= ${LIBIPX}
-LDADD= -lipx
-WARNS?= 3
-
-.include <bsd.prog.mk>
diff --git a/tools/regression/netipx/spxabort/spxabort.c b/tools/regression/netipx/spxabort/spxabort.c
deleted file mode 100644
index 8b6537f..0000000
--- a/tools/regression/netipx/spxabort/spxabort.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*-
- * Copyright (c) 2006 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * Exercise the pru_abort() code for SPX by opening an SPX connection to a
- * listen socket, then closing the listen socket before accepting.
- *
- * We would also like to be able to test the other two abort cases, in which
- * incomplete connections are aborted due to overflow, and due to close of
- * the listen socket, but that requires a packet level test rather than using
- * the socket API.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <netipx/ipx.h>
-
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#define IPX_ENDPOINT "0xbebe.1.0x8a13"
-
-int
-main(int argc, char *argv[])
-{
- struct sockaddr_ipx sipx;
- int sock_listen, sock;
-
- sock_listen = socket(PF_IPX, SOCK_STREAM, 0);
- if (sock_listen < 0)
- err(-1, "sock_listen = socket(PF_IPX, SOCK_STREAM, 0)");
-
- bzero(&sipx, sizeof(sipx));
- sipx.sipx_len = sizeof(sipx);
- sipx.sipx_family = AF_IPX;
- sipx.sipx_addr = ipx_addr(IPX_ENDPOINT);
-
- if (bind(sock_listen, (struct sockaddr *)&sipx, sizeof(sipx)) < 0)
- err(-1, "bind(sock_listen)");
-
- if (listen(sock_listen, -1) < 0)
- err(-1, "listen(sock_listen)");
-
- sock = socket(PF_IPX, SOCK_STREAM, 0);
- if (sock < 0)
- err(-1, "sock = socket(PF_IPX, SOCK_STREAM, 0)");
-
- bzero(&sipx, sizeof(sipx));
- sipx.sipx_len = sizeof(sipx);
- sipx.sipx_family = AF_IPX;
- sipx.sipx_addr = ipx_addr(IPX_ENDPOINT);
-
- if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0)
- err(-1, "fcntl(sock, F_SETFL, O_NONBLOCKING)");
-
- if (connect(sock, (struct sockaddr *)&sipx, sizeof(sipx)) < 0) {
- if (errno != EINPROGRESS)
- err(-1, "sock = socket(PF_IPX, SOCK_STREAM, 0)");
- }
-
- sleep(1); /* Arbitrary. */
-
- close(sock_listen);
-
- return (0);
-};
diff --git a/tools/regression/netipx/spxloopback/Makefile b/tools/regression/netipx/spxloopback/Makefile
deleted file mode 100644
index 4245217..0000000
--- a/tools/regression/netipx/spxloopback/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# $FreeBSD$
-#
-
-PROG= spxloopback
-NO_MAN=
-
-DPADD= ${LIBIPX}
-LDADD= -lipx
-WARNS?= 3
-
-.include <bsd.prog.mk>
diff --git a/tools/regression/netipx/spxloopback/spxloopback.c b/tools/regression/netipx/spxloopback/spxloopback.c
deleted file mode 100644
index 0f3f156..0000000
--- a/tools/regression/netipx/spxloopback/spxloopback.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*-
- * Copyright (c) 2006 Robert N. M. Watson
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$Exp $
- */
-
-/*
- * Simple netipx regression test that attempts to build an SPX stream socket
- * pair, and send data twice over the stream, once in each direction.
- * Purposefully pick a small packet length that should fit into the buffers
- * at both ends, and therefore not result in a buffer deadlock.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <netipx/ipx.h>
-
-#include <err.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#define IPX_ENDPOINT "0xbebe.1.0x8a13"
-#define PACKETLEN 16 * (1024 * 1024)
-
-static void
-packet_fill(u_char *packet)
-{
- int i;
-
- for (i = 0; i < PACKETLEN; i++)
- packet[i] = (i & 0xff);
-}
-
-static int
-packet_check(u_char *packet, size_t totlen, ssize_t len)
-{
- size_t i;
-
- for (i = totlen; i < totlen + len; i++) {
- if (packet[i] != (i & 0xff))
- return (-1);
- }
- return (0);
-}
-
-static void
-my_send(int sock, const char *who, pid_t pid)
-{
- u_char packet[PACKETLEN];
- ssize_t len;
- size_t totlen;
- int error;
-
- totlen = 0;
- packet_fill(packet);
- while (totlen < PACKETLEN) {
- len = send(sock, packet + totlen, PACKETLEN - totlen, 0);
- if (len < 0) {
- error = errno;
- (void)kill(pid, SIGTERM);
- errno = error;
- err(-1, "%s: send()", who);
- }
- if (len == 0) {
- (void)kill(pid, SIGTERM);
- errx(-1, "%s: send(): EOF", who);
- }
- totlen += len;
- }
-}
-
-static void
-my_recv(int sock, const char *who, pid_t pid)
-{
- u_char packet[PACKETLEN];
- ssize_t len;
- size_t totlen;
- int error;
-
- totlen = 0;
- bzero(packet, sizeof(packet));
- while (totlen < PACKETLEN) {
- len = recv(sock, packet + totlen, sizeof(packet) - totlen, 0);
- if (len < 0) {
- errno = error;
- (void)kill(pid, SIGTERM);
- errno = error;
- err(-1, "%s: recv()", who);
- }
- if (len == 0) {
- (void)kill(pid, SIGTERM);
- errx(-1, "%s: recv(): EOF", who);
- }
- if (packet_check(packet, totlen, len) < 0) {
- (void)kill(pid, SIGTERM);
- errx(-1, "%s: recv(): got bad data", who);
- }
- totlen += len;
- }
-}
-
-int
-main(int argc, char *argv[])
-{
- int error, sock_listen, sock_recv, sock_send;
- struct sockaddr_ipx sipx_listen, sipx_send;
- pid_t childpid, parentpid;
-
- /*
- * Socket to receive with.
- */
- sock_listen = socket(PF_IPX, SOCK_STREAM, 0);
- if (sock_listen < 0)
- err(-1, "sock_listen = socket(PF_IPX, SOCK_STREAM, 0)");
-
- bzero(&sipx_listen, sizeof(sipx_listen));
- sipx_listen.sipx_len = sizeof(sipx_listen);
- sipx_listen.sipx_family = AF_IPX;
- sipx_listen.sipx_addr = ipx_addr(IPX_ENDPOINT);
-
- if (bind(sock_listen, (struct sockaddr *)&sipx_listen,
- sizeof(sipx_listen)) < 0)
- err(-1, "bind(sock_listen)");
-
- if (listen(sock_listen, -1) < 0)
- err(-1, "listen(sock_listen)");
-
- parentpid = getpid();
-
- childpid = fork();
- if (childpid < 0)
- err(-1, "fork()");
-
- if (childpid == 0) {
- /*
- * The child: accept connections and process data on them.
- */
- while (1) {
- sock_recv = accept(sock_listen, NULL, NULL);
- if (sock_recv < 0) {
- warn("accept()");
- continue;
- }
-
- my_recv(sock_recv, "listener", parentpid);
- my_send(sock_recv, "listener", parentpid);
-
- close(sock_recv);
- }
- } else {
- /*
- * The parent: connect, send data, receive it back, and exit;
- * build two connections, once using a full connect() API
- * call, and the second using sendto().
- */
-
- /*
- * Socket to send with.
- */
- sock_send = socket(PF_IPX, SOCK_STREAM, 0);
- if (sock_send < 0) {
- error = errno;
- (void)kill(childpid, SIGTERM);
- errno = error;
- err(-1, "sock_send = socket(PF_IPX, SOCK_STREAM, 0)");
- }
-
- bzero(&sipx_send, sizeof(sipx_send));
- sipx_send.sipx_len = sizeof(sipx_send);
- sipx_send.sipx_family = AF_IPX;
- sipx_send.sipx_addr = ipx_addr(IPX_ENDPOINT);
-
- if (connect(sock_send, (struct sockaddr *)&sipx_send,
- sizeof(sipx_send)) < 0) {
- error = errno;
- (void)kill(childpid, SIGTERM);
- errno = error;
- err(-1, "sock_send = socket(PF_IPX, SOCK_STREAM, 0)");
- }
-
- my_send(sock_send, "connector", childpid);
- my_recv(sock_send, "connector", childpid);
-
- close(sock_send);
-
-#ifdef SPX_SUPPORTS_SENDTO_WITH_CONNECT
- sock_send = socket(PF_IPX, SOCK_STREAM, 0);
- if (sock_send < 0) {
- error = errno;
- (void)kill(childpid, SIGTERM);
- errno = error;
- err(-1, "sock_send = socket(PF_IPX, SOCK_STREAM, 0)");
- }
-
- bzero(&sipx_send, sizeof(sipx_send));
- sipx_send.sipx_len = sizeof(sipx_send);
- sipx_send.sipx_family = AF_IPX;
- sipx_send.sipx_addr = ipx_addr(IPX_ENDPOINT);
-
- my_sendto(sock_send, "connector", childpid,
- (struct sockaddr *)&sipx_send, sizeof(sipx_send));
- my_recv(sock_send, "connector", childpid);
-
- close(sock_send);
-#endif
-
- (void)kill(childpid, SIGTERM);
- }
-
- return (0);
-}
diff --git a/tools/tools/nanobsd/gateworks/common b/tools/tools/nanobsd/gateworks/common
index 182bfbd..8cedf38 100644
--- a/tools/tools/nanobsd/gateworks/common
+++ b/tools/tools/nanobsd/gateworks/common
@@ -125,7 +125,6 @@ WITHOUT_HTML=true
WITHOUT_INET6=true
WITHOUT_INFO=true
WITHOUT_IPFILTER=true
-WITHOUT_IPX=true
WITHOUT_KERBEROS=true
WITHOUT_LOCALES=true
WITHOUT_LPR=true
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index cf05f24..9e85f3a 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -60,10 +60,6 @@ extern int errno;
#include <sys/un.h>
#include <sys/queue.h>
#include <sys/wait.h>
-#ifdef IPX
-#include <sys/types.h>
-#include <netipx/ipx.h>
-#endif
#ifdef NETATALK
#include <netatalk/at.h>
#endif
@@ -1686,19 +1682,6 @@ ktrsockaddr(struct sockaddr *sa)
printf("[%s]:%u", addr, htons(sa_in6.sin6_port));
break;
}
-#ifdef IPX
- case AF_IPX: {
- struct sockaddr_ipx sa_ipx;
-
- memset(&sa_ipx, 0, sizeof(sa_ipx));
- memcpy(&sa_ipx, sa, sa->sa_len);
- check_sockaddr_len(ipx);
- /* XXX wish we had ipx_ntop */
- printf("%s", ipx_ntoa(sa_ipx.sipx_addr));
- free(sa_ipx);
- break;
- }
-#endif
case AF_UNIX: {
struct sockaddr_un sa_un;
diff --git a/usr.bin/netstat/Makefile b/usr.bin/netstat/Makefile
index 2432cfb..b9af87a 100644
--- a/usr.bin/netstat/Makefile
+++ b/usr.bin/netstat/Makefile
@@ -43,11 +43,4 @@ LDADD+= -lnetgraph
CFLAGS+=-DNETGRAPH
.endif
-.if ${MK_IPX_SUPPORT} != "no"
-SRCS+= ipx.c
-DPADD+= ${LIBIPX}
-LDADD+= -lipx
-CFLAGS+=-DIPX
-.endif
-
.include <bsd.prog.mk>
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index a87d68b..aeb59091 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -51,8 +51,6 @@ __FBSDID("$FreeBSD$");
#include <net/ethernet.h>
#include <netinet/in.h>
#include <netinet/in_var.h>
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
#include <arpa/inet.h>
#ifdef PF
#include <net/pfvar.h>
@@ -325,22 +323,6 @@ intpr(int interval, void (*pfunc)(char *), int af)
break;
}
#endif /* INET6 */
- case AF_IPX:
- {
- struct sockaddr_ipx *sipx;
- u_long net;
- char netnum[10];
-
- sipx = (struct sockaddr_ipx *)ifa->ifa_addr;
- *(union ipx_net *) &net = sipx->sipx_addr.x_net;
-
- sprintf(netnum, "%lx", (u_long)ntohl(net));
- printf("ipx:%-8s ", netnum);
- printf("%-17s ", ipx_phost((struct sockaddr *)sipx));
-
- network = 1;
- break;
- }
case AF_APPLETALK:
printf("atalk:%-12.12s ",
atalk_print(ifa->ifa_addr, 0x10));
diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c
deleted file mode 100644
index aa3dd40..0000000
--- a/usr.bin/netstat/ipx.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*-
- * Copyright (c) 2004, Robert N. M. Watson
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if 0
-#ifndef lint
-static char sccsid[] = "@(#)ns.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-#endif
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/queue.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/protosw.h>
-
-#include <net/route.h>
-
-#define TCPSTATES
-#include <netinet/tcp_fsm.h>
-
-#include <netipx/ipx.h>
-#include <netipx/ipx_pcb.h>
-#include <netipx/ipx_var.h>
-#ifdef IPXERRORMSGS
-#include <netipx/ipx_error.h>
-#endif
-#include <netipx/spx.h>
-#include <netipx/spx_timer.h>
-#include <netipx/spx_var.h>
-#define SANAMES
-#include <netipx/spx_debug.h>
-
-#include <nlist.h>
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include "netstat.h"
-
-static char *ipx_prpr(struct ipx_addr *);
-
-/*
- * Print a summary of connections related to a Network Systems
- * protocol. For SPX, also give state of connection.
- * Listening processes (aflag) are suppressed unless the
- * -a (all) flag is specified.
- */
-
-void
-ipxprotopr(u_long off, const char *name, int af1 __unused, int proto __unused)
-{
- struct ipxpcbhead cb;
- struct ipxpcb *ipxp;
- struct ipxpcb ipxpcb;
- struct spxpcb spxpcb;
- struct socket sockb;
- static int first = 1;
- int isspx;
-
- if (off == 0)
- return;
-
- isspx = strcmp(name, "spx") == 0;
- kread(off, (char *)&cb, sizeof (struct ipxpcbhead));
- ipxp = LIST_FIRST(&cb);
- while (ipxp != NULL) {
- u_long ppcb;
-
- kread((u_long)ipxp, (char *)&ipxpcb, sizeof (ipxpcb));
- ipxp = LIST_NEXT(&ipxpcb, ipxp_list);
-
- if (!aflag && ipx_nullhost(ipxpcb.ipxp_faddr) ) {
- continue;
- }
- kread((u_long)ipxpcb.ipxp_socket,
- (char *)&sockb, sizeof (sockb));
- ppcb = (u_long) ipxpcb.ipxp_pcb;
- if (ppcb) {
- if (isspx) {
- kread(ppcb, (char *)&spxpcb, sizeof (spxpcb));
- } else continue;
- } else
- if (isspx) continue;
- if (first) {
- printf("Active IPX connections");
- if (aflag)
- printf(" (including servers)");
- putchar('\n');
- if (Aflag)
- printf("%-8.8s ", "PCB");
- printf(Aflag ?
- "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %s\n" :
- "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n",
- "Proto", "Recv-Q", "Send-Q",
- "Local Address", "Foreign Address", "(state)");
- first = 0;
- }
- if (Aflag)
- printf("%8lx ", ppcb);
- printf("%-5.5s %6u %6u ", name, sockb.so_rcv.sb_cc,
- sockb.so_snd.sb_cc);
- printf(Aflag?" %-18.18s":" %-22.22s", ipx_prpr(&ipxpcb.ipxp_laddr));
- printf(Aflag?" %-18.18s":" %-22.22s", ipx_prpr(&ipxpcb.ipxp_faddr));
- if (isspx) {
- if (spxpcb.s_state >= TCP_NSTATES)
- printf(" %d", spxpcb.s_state);
- else
- printf(" %s", tcpstates[spxpcb.s_state]);
- }
- putchar('\n');
- }
-}
-
-#define ANY(x,y,z) \
- if (x || sflag <= 1) printf("\t%u %s%s%s\n", x, y, plural(x), z)
-#define ANYl(x,y,z) \
- if (x || sflag <= 1) printf("\t%lu %s%s%s\n", x, y, plural(x), z)
-
-/*
- * Dump SPX statistics structure.
- */
-void
-spx_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
-{
- struct spx_istat spx_istat;
-#define spxstat spx_istat.newstats
-
- if (off == 0)
- return;
- kread(off, (char *)&spx_istat, sizeof (spx_istat));
- printf("%s:\n", name);
- ANY(spx_istat.nonucn, "connection", " dropped due to no new sockets ");
- ANY(spx_istat.gonawy, "connection", " terminated due to our end dying");
- ANY(spx_istat.nonucn, "connection",
- " dropped due to inability to connect");
- ANY(spx_istat.noconn, "connection",
- " dropped due to inability to connect");
- ANY(spx_istat.notme, "connection",
- " incompleted due to mismatched id's");
- ANY(spx_istat.wrncon, "connection", " dropped due to mismatched id's");
- ANY(spx_istat.bdreas, "packet", " dropped out of sequence");
- ANY(spx_istat.lstdup, "packet", " duplicating the highest packet");
- ANY(spx_istat.notyet, "packet", " refused as exceeding allocation");
- ANYl(spxstat.spxs_connattempt, "connection", " initiated");
- ANYl(spxstat.spxs_accepts, "connection", " accepted");
- ANYl(spxstat.spxs_connects, "connection", " established");
- ANYl(spxstat.spxs_drops, "connection", " dropped");
- ANYl(spxstat.spxs_conndrops, "embryonic connection", " dropped");
- ANYl(spxstat.spxs_closed, "connection", " closed (includes drops)");
- ANYl(spxstat.spxs_segstimed, "packet", " where we tried to get rtt");
- ANYl(spxstat.spxs_rttupdated, "time", " we got rtt");
- ANYl(spxstat.spxs_delack, "delayed ack", " sent");
- ANYl(spxstat.spxs_timeoutdrop, "connection",
- " dropped in rxmt timeout");
- ANYl(spxstat.spxs_rexmttimeo, "retransmit timeout", "");
- ANYl(spxstat.spxs_persisttimeo, "persist timeout", "");
- ANYl(spxstat.spxs_keeptimeo, "keepalive timeout", "");
- ANYl(spxstat.spxs_keepprobe, "keepalive probe", " sent");
- ANYl(spxstat.spxs_keepdrops, "connection", " dropped in keepalive");
- ANYl(spxstat.spxs_sndtotal, "total packet", " sent");
- ANYl(spxstat.spxs_sndpack, "data packet", " sent");
- ANYl(spxstat.spxs_sndbyte, "data byte", " sent");
- ANYl(spxstat.spxs_sndrexmitpack, "data packet", " retransmitted");
- ANYl(spxstat.spxs_sndrexmitbyte, "data byte", " retransmitted");
- ANYl(spxstat.spxs_sndacks, "ack-only packet", " sent");
- ANYl(spxstat.spxs_sndprobe, "window probe", " sent");
- ANYl(spxstat.spxs_sndurg, "packet", " sent with URG only");
- ANYl(spxstat.spxs_sndwinup, "window update-only packet", " sent");
- ANYl(spxstat.spxs_sndctrl, "control (SYN|FIN|RST) packet", " sent");
- ANYl(spxstat.spxs_sndvoid, "request", " to send a non-existent packet");
- ANYl(spxstat.spxs_rcvtotal, "total packet", " received");
- ANYl(spxstat.spxs_rcvpack, "packet", " received in sequence");
- ANYl(spxstat.spxs_rcvbyte, "byte", " received in sequence");
- ANYl(spxstat.spxs_rcvbadsum, "packet", " received with ccksum errs");
- ANYl(spxstat.spxs_rcvbadoff, "packet", " received with bad offset");
- ANYl(spxstat.spxs_rcvshort, "packet", " received too short");
- ANYl(spxstat.spxs_rcvduppack, "duplicate-only packet", " received");
- ANYl(spxstat.spxs_rcvdupbyte, "duplicate-only byte", " received");
- ANYl(spxstat.spxs_rcvpartduppack, "packet",
- " with some duplicate data");
- ANYl(spxstat.spxs_rcvpartdupbyte, "dup. byte", " in part-dup. packet");
- ANYl(spxstat.spxs_rcvoopack, "out-of-order packet", " received");
- ANYl(spxstat.spxs_rcvoobyte, "out-of-order byte", " received");
- ANYl(spxstat.spxs_rcvpackafterwin, "packet", " with data after window");
- ANYl(spxstat.spxs_rcvbyteafterwin, "byte", " rcvd after window");
- ANYl(spxstat.spxs_rcvafterclose, "packet", " rcvd after 'close'");
- ANYl(spxstat.spxs_rcvwinprobe, "rcvd window probe packet", "");
- ANYl(spxstat.spxs_rcvdupack, "rcvd duplicate ack", "");
- ANYl(spxstat.spxs_rcvacktoomuch, "rcvd ack", " for unsent data");
- ANYl(spxstat.spxs_rcvackpack, "rcvd ack packet", "");
- ANYl(spxstat.spxs_rcvackbyte, "byte", " acked by rcvd acks");
- ANYl(spxstat.spxs_rcvwinupd, "rcvd window update packet", "");
-}
-
-/*
- * Dump IPX statistics structure.
- */
-void
-ipx_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
-{
- struct ipxstat ipxstat;
-
- if (off == 0)
- return;
- kread(off, (char *)&ipxstat, sizeof (ipxstat));
- printf("%s:\n", name);
- ANYl(ipxstat.ipxs_total, "total packet", " received");
- ANYl(ipxstat.ipxs_badsum, "packet", " with bad checksums");
- ANYl(ipxstat.ipxs_tooshort, "packet", " smaller than advertised");
- ANYl(ipxstat.ipxs_toosmall, "packet", " smaller than a header");
- ANYl(ipxstat.ipxs_forward, "packet", " forwarded");
- ANYl(ipxstat.ipxs_cantforward, "packet", " not forwardable");
- ANYl(ipxstat.ipxs_delivered, "packet", " for this host");
- ANYl(ipxstat.ipxs_localout, "packet", " sent from this host");
- ANYl(ipxstat.ipxs_odropped, "packet", " dropped due to no bufs, etc.");
- ANYl(ipxstat.ipxs_noroute, "packet", " discarded due to no route");
- ANYl(ipxstat.ipxs_mtutoosmall, "packet", " too big");
-}
-
-#ifdef IPXERRORMSGS
-static struct {
- u_short code;
- char *name;
- char *where;
-} ipx_errnames[] = {
- {0, "Unspecified Error", " at Destination"},
- {1, "Bad Checksum", " at Destination"},
- {2, "No Listener", " at Socket"},
- {3, "Packet", " Refused due to lack of space at Destination"},
- {01000, "Unspecified Error", " while gatewayed"},
- {01001, "Bad Checksum", " while gatewayed"},
- {01002, "Packet", " forwarded too many times"},
- {01003, "Packet", " too large to be forwarded"},
- {-1, 0, 0},
-};
-
-/*
- * Dump IPX Error statistics structure.
- */
-/*ARGSUSED*/
-void
-ipxerr_stats(u_long off, const char *name, int af __unused, int proto __unused)
-{
- struct ipx_errstat ipx_errstat;
- int j;
- int histoprint = 1;
- int z;
-
- if (off == 0)
- return;
- kread(off, (char *)&ipx_errstat, sizeof (ipx_errstat));
- printf("IPX error statistics:\n");
- ANY(ipx_errstat.ipx_es_error, "call", " to ipx_error");
- ANY(ipx_errstat.ipx_es_oldshort, "error",
- " ignored due to insufficient addressing");
- ANY(ipx_errstat.ipx_es_oldipx_err, "error request",
- " in response to error packets");
- ANY(ipx_errstat.ipx_es_tooshort, "error packet",
- " received incomplete");
- ANY(ipx_errstat.ipx_es_badcode, "error packet",
- " received of unknown type");
- for(j = 0; j < IPX_ERR_MAX; j ++) {
- z = ipx_errstat.ipx_es_outhist[j];
- if (z && histoprint) {
- printf("Output Error Histogram:\n");
- histoprint = 0;
- }
- ipx_erputil(z, ipx_errstat.ipx_es_codes[j]);
- }
- histoprint = 1;
- for(j = 0; j < IPX_ERR_MAX; j ++) {
- z = ipx_errstat.ipx_es_inhist[j];
- if (z && histoprint) {
- printf("Input Error Histogram:\n");
- histoprint = 0;
- }
- ipx_erputil(z, ipx_errstat.ipx_es_codes[j]);
- }
-}
-
-static void
-ipx_erputil(int z, int c)
-{
- int j;
- char codebuf[30];
- char *name, *where;
-
- for(j = 0;; j ++) {
- if ((name = ipx_errnames[j].name) == 0)
- break;
- if (ipx_errnames[j].code == c)
- break;
- }
- if (name == 0) {
- if (c > 01000)
- where = "in transit";
- else
- where = "at destination";
- sprintf(codebuf, "Unknown IPX error code 0%o", c);
- name = codebuf;
- } else
- where = ipx_errnames[j].where;
- ANY(z, name, where);
-}
-#endif /* IPXERRORMSGS */
-
-static struct sockaddr_ipx ssipx = { .sipx_family = AF_IPX };
-
-static
-char *ipx_prpr(struct ipx_addr *x)
-{
- struct sockaddr_ipx *sipx = &ssipx;
-
- sipx->sipx_addr = *x;
- return(ipx_print((struct sockaddr *)sipx));
-}
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 42e7080..d928b7f 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -70,99 +70,91 @@ __FBSDID("$FreeBSD$");
#include "netstat.h"
static struct nlist nl[] = {
-#define N_IFNET 0
- { .n_name = "_ifnet" }, /* XXXGL: can be deleted */
-#define N_RTSTAT 1
+#define N_RTSTAT 0
{ .n_name = "_rtstat" },
-#define N_RTREE 2
+#define N_RTREE 1
{ .n_name = "_rt_tables"},
-#define N_MRTSTAT 3
+#define N_MRTSTAT 2
{ .n_name = "_mrtstat" },
-#define N_MFCHASHTBL 4
+#define N_MFCHASHTBL 3
{ .n_name = "_mfchashtbl" },
-#define N_VIFTABLE 5
+#define N_VIFTABLE 4
{ .n_name = "_viftable" },
-#define N_IPX 6
- { .n_name = "_ipxpcb_list"},
-#define N_IPXSTAT 7
- { .n_name = "_ipxstat"},
-#define N_SPXSTAT 8
- { .n_name = "_spx_istat"},
-#define N_DDPSTAT 9
+#define N_DDPSTAT 5
{ .n_name = "_ddpstat"},
-#define N_DDPCB 10
+#define N_DDPCB 6
{ .n_name = "_ddpcb"},
-#define N_NGSOCKS 11
+#define N_NGSOCKS 7
{ .n_name = "_ngsocklist"},
-#define N_IP6STAT 12
+#define N_IP6STAT 8
{ .n_name = "_ip6stat" },
-#define N_ICMP6STAT 13
+#define N_ICMP6STAT 9
{ .n_name = "_icmp6stat" },
-#define N_IPSECSTAT 14
+#define N_IPSECSTAT 10
{ .n_name = "_ipsec4stat" },
-#define N_IPSEC6STAT 15
+#define N_IPSEC6STAT 11
{ .n_name = "_ipsec6stat" },
-#define N_PIM6STAT 16
+#define N_PIM6STAT 12
{ .n_name = "_pim6stat" },
-#define N_MRT6STAT 17
+#define N_MRT6STAT 13
{ .n_name = "_mrt6stat" },
-#define N_MF6CTABLE 18
+#define N_MF6CTABLE 14
{ .n_name = "_mf6ctable" },
-#define N_MIF6TABLE 19
+#define N_MIF6TABLE 15
{ .n_name = "_mif6table" },
-#define N_PFKEYSTAT 20
+#define N_PFKEYSTAT 16
{ .n_name = "_pfkeystat" },
-#define N_RTTRASH 21
+#define N_RTTRASH 17
{ .n_name = "_rttrash" },
-#define N_CARPSTAT 22
+#define N_CARPSTAT 18
{ .n_name = "_carpstats" },
-#define N_PFSYNCSTAT 23
+#define N_PFSYNCSTAT 19
{ .n_name = "_pfsyncstats" },
-#define N_AHSTAT 24
+#define N_AHSTAT 20
{ .n_name = "_ahstat" },
-#define N_ESPSTAT 25
+#define N_ESPSTAT 21
{ .n_name = "_espstat" },
-#define N_IPCOMPSTAT 26
+#define N_IPCOMPSTAT 22
{ .n_name = "_ipcompstat" },
-#define N_TCPSTAT 27
+#define N_TCPSTAT 23
{ .n_name = "_tcpstat" },
-#define N_UDPSTAT 28
+#define N_UDPSTAT 24
{ .n_name = "_udpstat" },
-#define N_IPSTAT 29
+#define N_IPSTAT 25
{ .n_name = "_ipstat" },
-#define N_ICMPSTAT 30
+#define N_ICMPSTAT 26
{ .n_name = "_icmpstat" },
-#define N_IGMPSTAT 31
+#define N_IGMPSTAT 27
{ .n_name = "_igmpstat" },
-#define N_PIMSTAT 32
+#define N_PIMSTAT 28
{ .n_name = "_pimstat" },
-#define N_TCBINFO 33
+#define N_TCBINFO 29
{ .n_name = "_tcbinfo" },
-#define N_UDBINFO 34
+#define N_UDBINFO 30
{ .n_name = "_udbinfo" },
-#define N_DIVCBINFO 35
+#define N_DIVCBINFO 31
{ .n_name = "_divcbinfo" },
-#define N_RIPCBINFO 36
+#define N_RIPCBINFO 32
{ .n_name = "_ripcbinfo" },
-#define N_UNP_COUNT 37
+#define N_UNP_COUNT 33
{ .n_name = "_unp_count" },
-#define N_UNP_GENCNT 38
+#define N_UNP_GENCNT 34
{ .n_name = "_unp_gencnt" },
-#define N_UNP_DHEAD 39
+#define N_UNP_DHEAD 35
{ .n_name = "_unp_dhead" },
-#define N_UNP_SHEAD 40
+#define N_UNP_SHEAD 36
{ .n_name = "_unp_shead" },
-#define N_RIP6STAT 41
+#define N_RIP6STAT 37
{ .n_name = "_rip6stat" },
-#define N_SCTPSTAT 42
+#define N_SCTPSTAT 38
{ .n_name = "_sctpstat" },
-#define N_MFCTABLESIZE 43
+#define N_MFCTABLESIZE 39
{ .n_name = "_mfctablesize" },
-#define N_ARPSTAT 44
+#define N_ARPSTAT 40
{ .n_name = "_arpstat" },
-#define N_UNP_SPHEAD 45
+#define N_UNP_SPHEAD 41
{ .n_name = "unp_sphead" },
-#define N_SFSTAT 46
+#define N_SFSTAT 42
{ .n_name = "_sfstat"},
{ .n_name = NULL },
};
@@ -278,16 +270,6 @@ struct protox netgraphprotox[] = {
NULL, NULL, NULL, 0, 0 }
};
#endif
-#ifdef IPX
-struct protox ipxprotox[] = {
- { N_IPX, N_IPXSTAT, 1, ipxprotopr,
- ipx_stats, NULL, "ipx", 0, 0 },
- { N_IPX, N_SPXSTAT, 1, ipxprotopr,
- spx_stats, NULL, "spx", 0, 0 },
- { -1, -1, 0, NULL,
- NULL, NULL, 0, 0, 0 }
-};
-#endif
struct protox *protoprotox[] = {
protox,
@@ -297,9 +279,6 @@ struct protox *protoprotox[] = {
#ifdef IPSEC
pfkeyprotox,
#endif
-#ifdef IPX
- ipxprotox,
-#endif
atalkprotox, NULL };
static void printproto(struct protox *, const char *);
@@ -389,9 +368,7 @@ main(int argc, char *argv[])
errx(1, "%s: invalid fib", optarg);
break;
case 'f':
- if (strcmp(optarg, "ipx") == 0)
- af = AF_IPX;
- else if (strcmp(optarg, "inet") == 0)
+ if (strcmp(optarg, "inet") == 0)
af = AF_INET;
#ifdef INET6
else if (strcmp(optarg, "inet6") == 0)
@@ -618,12 +595,6 @@ main(int argc, char *argv[])
for (tp = pfkeyprotox; tp->pr_name; tp++)
printproto(tp, tp->pr_name);
#endif /*IPSEC*/
-#ifdef IPX
- if (af == AF_IPX || af == AF_UNSPEC) {
- for (tp = ipxprotox; tp->pr_name; tp++)
- printproto(tp, tp->pr_name);
- }
-#endif /* IPX */
if (af == AF_APPLETALK || af == AF_UNSPEC)
for (tp = atalkprotox; tp->pr_name; tp++)
printproto(tp, tp->pr_name);
diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1
index 61e21b3..575db85 100644
--- a/usr.bin/netstat/netstat.1
+++ b/usr.bin/netstat/netstat.1
@@ -354,12 +354,6 @@ The following address families and protocols are recognized:
.Cm ddp
.It Cm netgraph , ng Pq Dv AF_NETGRAPH
.Cm ctrl , data
-.It Cm ipx Pq Dv AF_IPX
-.Cm ipx , spx
-.\".It Cm ns Pq Dv AF_NS
-.\".Cm idp , ns_err , spp
-.\".It Cm iso Pq Dv AF_ISO
-.\".Cm clnp , cltp , esis , tp
.It Cm unix Pq Dv AF_UNIX
.It Cm link Pq Dv AF_LINK
.El
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
index 414b4ce..5747cea 100644
--- a/usr.bin/netstat/netstat.h
+++ b/usr.bin/netstat/netstat.h
@@ -127,24 +127,14 @@ void pr_rthdr(int);
void pr_family(int);
void rt_stats(void);
void flowtable_stats(void);
-char *ipx_pnet(struct sockaddr *);
-char *ipx_phost(struct sockaddr *);
-char *ns_phost(struct sockaddr *);
-void upHex(char *);
char *routename(in_addr_t);
char *netname(in_addr_t, in_addr_t);
char *atalk_print(struct sockaddr *, int);
char *atalk_print2(struct sockaddr *, struct sockaddr *, int);
-char *ipx_print(struct sockaddr *);
char *ns_print(struct sockaddr *);
void routepr(int, int);
-void ipxprotopr(u_long, const char *, int, int);
-void spx_stats(u_long, const char *, int, int);
-void ipx_stats(u_long, const char *, int, int);
-void ipxerr_stats(u_long, const char *, int, int);
-
void nsprotopr(u_long, const char *, int, int);
void spp_stats(u_long, const char *, int, int);
void idp_stats(u_long, const char *, int, int);
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 88fe07d..2d443a5 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
#include <net/route.h>
#include <netinet/in.h>
-#include <netipx/ipx.h>
#include <netatalk/at.h>
#include <netgraph/ng_socket.h>
@@ -216,9 +215,6 @@ pr_family(int af1)
afname = "Internet6";
break;
#endif /*INET6*/
- case AF_IPX:
- afname = "IPX";
- break;
case AF_ISO:
afname = "ISO";
break;
@@ -754,15 +750,6 @@ fmt_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags)
}
#endif /*INET6*/
- case AF_IPX:
- {
- struct ipx_addr work = ((struct sockaddr_ipx *)sa)->sipx_addr;
- if (ipx_nullnet(satoipx_addr(work)))
- cp = "default";
- else
- cp = ipx_print(sa);
- break;
- }
case AF_APPLETALK:
{
if (!(flags & RTF_HOST) && mask)
@@ -1134,109 +1121,3 @@ rt_stats(void)
printf("\t%u route%s not in table but not freed\n",
rttrash, plural(rttrash));
}
-
-char *
-ipx_print(struct sockaddr *sa)
-{
- u_short port;
- struct servent *sp = 0;
- const char *net = "", *host = "";
- char *p;
- u_char *q;
- struct ipx_addr work = ((struct sockaddr_ipx *)sa)->sipx_addr;
- static char mybuf[50];
- char cport[10], chost[15], cnet[15];
-
- port = ntohs(work.x_port);
-
- if (ipx_nullnet(work) && ipx_nullhost(work)) {
-
- if (port) {
- if (sp)
- sprintf(mybuf, "*.%s", sp->s_name);
- else
- sprintf(mybuf, "*.%x", port);
- } else
- sprintf(mybuf, "*.*");
-
- return (mybuf);
- }
-
- if (ipx_wildnet(work))
- net = "any";
- else if (ipx_nullnet(work))
- net = "*";
- else {
- q = work.x_net.c_net;
- sprintf(cnet, "%02x%02x%02x%02x",
- q[0], q[1], q[2], q[3]);
- for (p = cnet; *p == '0' && p < cnet + 8; p++)
- continue;
- net = p;
- }
-
- if (ipx_wildhost(work))
- host = "any";
- else if (ipx_nullhost(work))
- host = "*";
- else {
- q = work.x_host.c_host;
- sprintf(chost, "%02x%02x%02x%02x%02x%02x",
- q[0], q[1], q[2], q[3], q[4], q[5]);
- for (p = chost; *p == '0' && p < chost + 12; p++)
- continue;
- host = p;
- }
-
- if (port) {
- if (strcmp(host, "*") == 0)
- host = "";
- if (sp)
- snprintf(cport, sizeof(cport),
- "%s%s", *host ? "." : "", sp->s_name);
- else
- snprintf(cport, sizeof(cport),
- "%s%x", *host ? "." : "", port);
- } else
- *cport = 0;
-
- snprintf(mybuf, sizeof(mybuf), "%s.%s%s", net, host, cport);
- return(mybuf);
-}
-
-char *
-ipx_phost(struct sockaddr *sa)
-{
- struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)sa;
- struct sockaddr_ipx work;
- static union ipx_net ipx_zeronet;
- char *p;
-
- work = *sipx;
-
- work.sipx_addr.x_port = 0;
- work.sipx_addr.x_net = ipx_zeronet;
- p = ipx_print((struct sockaddr *)&work);
- if (strncmp("*.", p, 2) == 0) p += 2;
-
- return(p);
-}
-
-void
-upHex(char *p0)
-{
- char *p = p0;
-
- for (; *p; p++)
- switch (*p) {
-
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- *p += ('A' - 'a');
- break;
- }
-}
diff --git a/usr.sbin/IPXrouted/IPXrouted.8 b/usr.sbin/IPXrouted/IPXrouted.8
deleted file mode 100644
index f5d0e13..0000000
--- a/usr.sbin/IPXrouted/IPXrouted.8
+++ /dev/null
@@ -1,224 +0,0 @@
-.\" Copyright (c) 1986, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Copyright (c) 1995 John Hay. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 11, 1995
-.Dt IPXROUTED 8
-.Os
-.Sh NAME
-.Nm IPXrouted
-.Nd IPX Routing Information Protocol daemon
-.Sh SYNOPSIS
-.Nm
-.Op Fl N
-.Op Fl q
-.Op Fl s
-.Op Fl S
-.Op Fl t
-.Op Ar logfile
-.Sh DESCRIPTION
-The
-.Nm
-utility is invoked at boot time to manage the
-.Tn IPX
-routing tables.
-The
-.Tn IPX
-routing daemon uses the Novell
-.Tn IPX
-Routing Information Protocol in maintaining up to date kernel routing
-table entries.
-.Pp
-Available options:
-.Bl -tag -width logfile
-.It Fl N
-Do not reply on GetNearestServer
-.Tn SAP
-request.
-.It Fl q
-Do not supply routing information (opposite of
-.Fl s
-option below).
-.It Fl s
-Forces
-.Nm
-to supply routing information whether it is acting as an internetwork
-router or not.
-.It Fl S
-Do not supply Service Advertising Protocol
-.Pq Tn SAP
-information.
-The default is to supply
-.Tn SAP
-information.
-.It Fl t
-All packets sent or received are
-printed on the standard output.
-In addition,
-.Nm
-will not divorce itself from the controlling terminal
-so that interrupts from the keyboard will kill the process.
-.It Ar logfile
-Name of file in which
-.Nm Ns 's
-actions should be logged.
-This log contains information
-about any changes to the routing tables and a history of
-recent messages sent and received which are related to
-the changed route.
-.El
-.Pp
-In normal operation
-.Nm
-listens
-for routing information packets.
-If the host is connected to
-multiple
-.Tn IPX
-networks, it periodically supplies copies
-of its routing tables to any directly connected hosts
-and networks.
-.Pp
-When
-.Nm
-is started, it uses the
-.Dv SIOCGIFCONF
-.Xr ioctl 2
-to find those
-directly connected interfaces configured into the
-system and marked
-.Dq up
-(the software loopback interface is ignored).
-If multiple interfaces
-are present, it is assumed the host will forward packets
-between networks.
-The
-.Nm
-utility then transmits a
-.Em request
-packet on each interface (using a broadcast packet if
-the interface supports it) and enters a loop, listening
-for
-.Em request
-and
-.Em response
-packets from other hosts.
-.Pp
-When a
-.Em request
-packet is received,
-.Nm
-formulates a reply based on the information maintained in its
-internal tables.
-The
-.Em response
-packet generated contains a list of known routes, each marked
-with a
-.Dq hop count
-metric (a count of 16, or greater, is
-considered
-.Dq infinite ) .
-The metric associated with each
-route returned provides a metric
-.Em relative to the sender .
-.Pp
-.Em Response
-packets received by
-.Nm
-are used to update the routing tables if one of the following
-conditions is satisfied:
-.Bl -bullet
-.It
-No routing table entry exists for the destination network
-or host, and the metric indicates the destination is
-.Dq reachable
-(i.e., the hop count is not infinite).
-.It
-The source host of the packet is the same as the router in the
-existing routing table entry.
-That is, updated information is
-being received from the very internetwork router through which
-packets for the destination are being routed.
-.It
-The existing entry in the routing table has not been updated for
-some time (defined to be 90 seconds) and the route is at least
-as cost effective as the current route.
-.It
-The new route describes a shorter route to the destination than
-the one currently stored in the routing tables; the metric of
-the new route is compared against the one stored in the table
-to decide this.
-.El
-.Pp
-When an update is applied,
-.Nm
-records the change in its internal tables and generates a
-.Em response
-packet to all directly connected hosts and networks.
-The
-.Xr routed 8
-utility waits a short period
-of time (no more than 30 seconds) before modifying the kernel's
-routing tables to allow possible unstable situations to settle.
-.Pp
-In addition to processing incoming packets,
-.Nm
-also periodically checks the routing table entries.
-If an entry has not been updated for 3 minutes, the entry's metric
-is set to infinity and marked for deletion.
-Deletions are delayed
-an additional 60 seconds to ensure the invalidation is propagated
-to other routers.
-.Pp
-Hosts acting as internetwork routers gratuitously supply their
-routing tables every 30 seconds to all directly connected hosts
-and networks.
-.Pp
-If
-.Nm
-receives a
-.Dv SIGINFO
-signal the current contents of the
-.Tn RIP
-and
-.Tn SAP
-tables are appended to the file
-.Pa /var/log/ipxrouted.dmp .
-.Sh SEE ALSO
-.Xr ipx 3
-.Sh HISTORY
-The
-.Nm
-utility first appeared in
-.Fx 2.2 .
diff --git a/usr.sbin/IPXrouted/Makefile b/usr.sbin/IPXrouted/Makefile
deleted file mode 100644
index 44605ac..0000000
--- a/usr.sbin/IPXrouted/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/5/93
-# $FreeBSD$
-
-PROG= IPXrouted
-MAN= IPXrouted.8
-SRCS= af.c if.c input.c main.c output.c startup.c tables.c timer.c trace.c
-SRCS+= sap_input.c sap_tables.c sap_output.c
-
-WARNS?= 2
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/IPXrouted/af.c b/usr.sbin/IPXrouted/af.c
deleted file mode 100644
index ea61762..0000000
--- a/usr.sbin/IPXrouted/af.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * This file includes significant work done at Cornell University by
- * Bill Nesheim. That work included by permission.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef lint
-static const char sccsid[] = "@(#)af.c 8.1 (Berkeley) 6/5/93";
-#endif /* not lint */
-
-#include "defs.h"
-
-/*
- * Address family support routines
- */
-af_hash_t null_hash;
-af_netmatch_t null_netmatch;
-af_output_t null_output;
-af_portmatch_t null_portmatch;
-af_portcheck_t null_portcheck;
-af_checkhost_t null_checkhost;
-af_ishost_t null_ishost;
-af_canon_t null_canon;
-
-void ipxnet_hash(struct sockaddr_ipx *, struct afhash *);
-int ipxnet_netmatch(struct sockaddr_ipx *, struct sockaddr_ipx *);
-void ipxnet_output(int, int, struct sockaddr_ipx *, int);
-int ipxnet_portmatch(struct sockaddr_ipx *);
-int ipxnet_checkhost(struct sockaddr_ipx *);
-int ipxnet_ishost(struct sockaddr_ipx *);
-void ipxnet_canon(struct sockaddr_ipx *);
-
-#define NIL \
- { null_hash, null_netmatch, null_output, \
- null_portmatch, null_portcheck, null_checkhost, \
- null_ishost, null_canon }
-#define IPXNET \
- { (af_hash_t *)ipxnet_hash, \
- (af_netmatch_t *)ipxnet_netmatch, \
- (af_output_t *)ipxnet_output, \
- (af_portmatch_t *)ipxnet_portmatch, \
- (af_portcheck_t *)ipxnet_portmatch, \
- (af_checkhost_t *)ipxnet_checkhost, \
- (af_ishost_t *)ipxnet_ishost, \
- (af_canon_t *)ipxnet_canon }
-
-struct afswitch afswitch[AF_MAX] =
- { NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL,
- NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL, NIL,
- NIL, NIL, NIL, IPXNET, NIL, NIL };
-
-struct sockaddr_ipx ipxnet_default = { sizeof(struct sockaddr_ipx), AF_IPX };
-
-union ipx_net ipx_anynet;
-union ipx_net ipx_zeronet;
-
-void
-ipxnet_hash(sipx, hp)
- register struct sockaddr_ipx *sipx;
- struct afhash *hp;
-{
- long hash;
-#if 0
- u_short *s = sipx->sipx_addr.x_host.s_host;
-#endif
- u_char *c;
-
- c = sipx->sipx_addr.x_net.c_net;
-
-#define IMVAL 33
- hash = 0;
- hash = hash * IMVAL + *c++;
- hash = hash * IMVAL + *c++;
- hash = hash * IMVAL + *c++;
- hash = hash * IMVAL + *c++;
-#undef IMVAL
-
- hp->afh_nethash = hash;
- hp->afh_nethash ^= (hash >> 8);
- hp->afh_nethash ^= (hash >> 16);
- hp->afh_nethash ^= (hash >> 24);
-
-#if 0
- hash = 0;
- hash = *s++; hash <<= 8; hash += *s++; hash <<= 8; hash += *s;
- hp->afh_hosthash = hash;
-#endif
-}
-
-int
-ipxnet_netmatch(sxn1, sxn2)
- struct sockaddr_ipx *sxn1, *sxn2;
-{
- return (ipx_neteq(sxn1->sipx_addr, sxn2->sipx_addr));
-}
-
-/*
- * Verify the message is from the right port.
- */
-int
-ipxnet_portmatch(sipx)
- register struct sockaddr_ipx *sipx;
-{
-
- return (ntohs(sipx->sipx_addr.x_port) == IPXPORT_RIP );
-}
-
-
-/*
- * ipx output routine.
- */
-#ifdef DEBUG
-int do_output = 0;
-#endif
-void
-ipxnet_output(s, flags, sipx, size)
- int s;
- int flags;
- struct sockaddr_ipx *sipx;
- int size;
-{
- struct sockaddr_ipx dst;
-
- dst = *sipx;
- sipx = &dst;
- if (sipx->sipx_addr.x_port == 0)
- sipx->sipx_addr.x_port = htons(IPXPORT_RIP);
-#ifdef DEBUG
- if(do_output || ntohs(msg->rip_cmd) == RIPCMD_REQUEST)
-#endif
- /*
- * Kludge to allow us to get routes out to machines that
- * don't know their addresses yet; send to that address on
- * ALL connected nets
- */
- if (ipx_neteqnn(sipx->sipx_addr.x_net, ipx_zeronet)) {
- extern struct interface *ifnet;
- register struct interface *ifp;
-
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- sipx->sipx_addr.x_net =
- satoipx_addr(ifp->int_addr).x_net;
- (void) sendto(s, msg, size, flags,
- (struct sockaddr *)sipx, sizeof (*sipx));
- }
- return;
- }
-
- (void) sendto(s, msg, size, flags,
- (struct sockaddr *)sipx, sizeof (*sipx));
-}
-
-/*
- * Return 1 if we want this route.
- * We use this to disallow route net G entries for one for multiple
- * point to point links.
- */
-int
-ipxnet_checkhost(sipx)
- struct sockaddr_ipx *sipx;
-{
- register struct interface *ifp = if_ifwithnet((struct sockaddr *)sipx);
- /*
- * We want this route if there is no more than one
- * point to point interface with this network.
- */
- if (ifp == 0 || (ifp->int_flags & IFF_POINTOPOINT)==0) return (1);
- return (ifp->int_sq.n == ifp->int_sq.p);
-}
-
-/*
- * Return 1 if the address is
- * for a host, 0 for a network.
- */
-int
-ipxnet_ishost(sipx)
-struct sockaddr_ipx *sipx;
-{
- register u_short *s = sipx->sipx_addr.x_host.s_host;
-
- if ((s[0]==0x0000) && (s[1]==0x0000) && (s[2]==0x0000))
- return (0);
- if ((s[0]==0xffff) && (s[1]==0xffff) && (s[2]==0xffff))
- return (0);
-
- return (1);
-}
-
-void
-ipxnet_canon(sipx)
- struct sockaddr_ipx *sipx;
-{
-
- sipx->sipx_addr.x_port = 0;
-}
-
-void
-null_hash(addr, hp)
- struct sockaddr *addr;
- struct afhash *hp;
-{
-
- hp->afh_nethash = hp->afh_hosthash = 0;
-}
-
-int
-null_netmatch(a1, a2)
- struct sockaddr *a1, *a2;
-{
-
- return (0);
-}
-
-void
-null_output(s, f, a1, n)
- int s;
- int f;
- struct sockaddr *a1;
- int n;
-{
-
- ;
-}
-
-int
-null_portmatch(a1)
- struct sockaddr *a1;
-{
-
- return (0);
-}
-
-int
-null_portcheck(a1)
- struct sockaddr *a1;
-{
-
- return (0);
-}
-
-int
-null_ishost(a1)
- struct sockaddr *a1;
-{
-
- return (0);
-}
-
-int
-null_checkhost(a1)
- struct sockaddr *a1;
-{
-
- return (0);
-}
-
-void
-null_canon(a1)
- struct sockaddr *a1;
-{
-
- ;
-}
-
diff --git a/usr.sbin/IPXrouted/af.h b/usr.sbin/IPXrouted/af.h
deleted file mode 100644
index 576a6c7..0000000
--- a/usr.sbin/IPXrouted/af.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)af.h 5.1 (Berkeley) 6/4/85 (routed/af.h)
- *
- * @(#)af.h 8.1 (Berkeley) 6/5/93
- *
- * $FreeBSD$
- */
-
-/*
- * Routing table management daemon.
- */
-
-/*
- * Structure returned by af_hash routines.
- */
-struct afhash {
- u_int afh_hosthash; /* host based hash */
- u_int afh_nethash; /* network based hash */
-};
-
-/*
- * Per address family routines.
- */
-typedef void af_hash_t(struct sockaddr *, struct afhash *);
-typedef int af_netmatch_t(struct sockaddr *, struct sockaddr *);
-typedef void af_output_t(int, int, struct sockaddr *, int);
-typedef int af_portmatch_t(struct sockaddr *);
-typedef int af_portcheck_t(struct sockaddr *);
-typedef int af_checkhost_t(struct sockaddr *);
-typedef int af_ishost_t(struct sockaddr *);
-typedef void af_canon_t(struct sockaddr *);
-
-struct afswitch {
- af_hash_t *af_hash; /* returns keys based on address */
- af_netmatch_t *af_netmatch; /* verifies net # matching */
- af_output_t *af_output; /* interprets address for sending */
- af_portmatch_t *af_portmatch; /* packet from some other router? */
- af_portcheck_t *af_portcheck; /* packet from privileged peer? */
- af_checkhost_t *af_checkhost; /* tells if address for host or net */
- af_ishost_t *af_ishost; /* tells if address is valid */
- af_canon_t *af_canon; /* canonicalize address for compares */
-};
-
-struct afswitch afswitch[AF_MAX]; /* table proper */
diff --git a/usr.sbin/IPXrouted/defs.h b/usr.sbin/IPXrouted/defs.h
deleted file mode 100644
index c2b28a7..0000000
--- a/usr.sbin/IPXrouted/defs.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- *
- * $FreeBSD$
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <arpa/inet.h>
-#include <net/route.h>
-#include <netipx/ipx.h>
-#if defined(vax) || defined(pdp11)
-#define xnnet(x) ((u_long) (x)->rip_dst[1] << 16 | (u_long) (x)->rip_dst[0] )
-#else
-#define xnnet(x) ((u_long) (x)->rip_dst[0] << 16 | (u_long) (x)->rip_dst[1] )
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <syslog.h>
-
-#include "protocol.h"
-#include "sap.h"
-#include "table.h"
-#include "trace.h"
-#include "interface.h"
-#include "af.h"
-
-
-/*
- * When we find any interfaces marked down we rescan the
- * kernel every CHECK_INTERVAL seconds to see if they've
- * come up.
- */
-#define CHECK_INTERVAL (5*60)
-
-#define equal(a1, a2) \
- (bcmp((caddr_t)(a1), (caddr_t)(a2), sizeof (struct sockaddr)) == 0)
-#define min(a,b) ((a)>(b)?(b):(a))
-#define max(a,b) ((a)<(b)?(b):(a))
-
-extern int ripsock; /* Socket to listen on */
-extern int sapsock; /* Socket to listen on */
-extern int kmem;
-extern int supplier; /* process should supply updates */
-extern int dosap; /* SAP is enabled */
-extern int dognreply; /* enable GET_NEAREST response */
-extern int install; /* if 1 call kernel */
-extern int lookforinterfaces; /* if 1 probe kernel for new up ifs */
-extern int performnlist; /* if 1 check if /kernel has changed */
-extern int externalinterfaces; /* # of remote and local interfaces */
-extern int timeval; /* local idea of time */
-extern int noteremoterequests; /* squawk on requests from non-local nets */
-extern int r; /* Routing socket to install updates with */
-extern int gateway;
-extern struct sockaddr_ipx ipx_netmask; /* Used in installing routes */
-
-extern char packet[MAXRXPACKETSIZE+1];
-extern struct rip *msg;
-
-extern char **argv0;
-
-#define ADD 1
-#define DELETE 2
-#define CHANGE 3
-
-void sndmsg(struct sockaddr *, int, struct interface *, int);
-void supply(struct sockaddr *, int, struct interface *, int);
-void addrouteforif(struct interface *);
-void ifinit(void);
-void toall(void (*f)(struct sockaddr *, int, struct interface *, int),
- struct rt_entry *, int);
-void rip_input(struct sockaddr *, int);
-
diff --git a/usr.sbin/IPXrouted/if.c b/usr.sbin/IPXrouted/if.c
deleted file mode 100644
index 2c6e664..0000000
--- a/usr.sbin/IPXrouted/if.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * static char sccsid[] = "@(#)if.c 5.1 (Berkeley) 6/4/85"; (routed/if.c)
- *
- * $FreeBSD$
- */
-
-#ifndef lint
-static const char sccsid[] = "@(#)if.c 8.1 (Berkeley) 6/5/93";
-#endif /* not lint */
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-
-extern struct interface *ifnet;
-
-/*
- * Find the interface with address addr.
- */
-struct interface *
-if_ifwithaddr(addr)
- struct sockaddr *addr;
-{
- register struct interface *ifp;
-
-#define same(a1, a2) \
- (bcmp((caddr_t)((a1)->sa_data), (caddr_t)((a2)->sa_data), 10) == 0)
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if (ifp->int_flags & IFF_REMOTE)
- continue;
- if (ifp->int_addr.sa_family != addr->sa_family)
- continue;
- if (same(&ifp->int_addr, addr))
- break;
- if ((ifp->int_flags & IFF_BROADCAST) &&
- same(&ifp->int_broadaddr, addr))
- break;
- }
- return (ifp);
-}
-
-/*
- * Find the point-to-point interface with destination address addr.
- */
-struct interface *
-if_ifwithdstaddr(addr)
- struct sockaddr *addr;
-{
- register struct interface *ifp;
-
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if ((ifp->int_flags & IFF_POINTOPOINT) == 0)
- continue;
- if (same(&ifp->int_dstaddr, addr))
- break;
- }
- return (ifp);
-}
-
-/*
- * Find the interface on the network
- * of the specified address.
- */
-struct interface *
-if_ifwithnet(addr)
- register struct sockaddr *addr;
-{
- register struct interface *ifp;
- register int af = addr->sa_family;
- register int (*netmatch)();
-
- if (af >= AF_MAX)
- return (0);
- netmatch = afswitch[af].af_netmatch;
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if (ifp->int_flags & IFF_REMOTE)
- continue;
- if (af != ifp->int_addr.sa_family)
- continue;
- if ((*netmatch)(addr, &ifp->int_addr))
- break;
- }
- return (ifp);
-}
-
-/*
- * Find an interface from which the specified address
- * should have come from. Used for figuring out which
- * interface a packet came in on -- for tracing.
- */
-struct interface *
-if_iflookup(addr)
- struct sockaddr *addr;
-{
- register struct interface *ifp, *maybe;
- register int af = addr->sa_family;
- register int (*netmatch)();
-
- if (af >= AF_MAX)
- return (0);
- maybe = 0;
- netmatch = afswitch[af].af_netmatch;
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if (ifp->int_addr.sa_family != af)
- continue;
- if (same(&ifp->int_addr, addr))
- break;
- if ((ifp->int_flags & IFF_BROADCAST) &&
- same(&ifp->int_broadaddr, addr))
- break;
- if (maybe == 0 && (*netmatch)(addr, &ifp->int_addr))
- maybe = ifp;
- }
- if (ifp == 0)
- ifp = maybe;
- return (ifp);
-}
diff --git a/usr.sbin/IPXrouted/input.c b/usr.sbin/IPXrouted/input.c
deleted file mode 100644
index 651a8ae..0000000
--- a/usr.sbin/IPXrouted/input.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * This file includes significant work done at Cornell University by
- * Bill Nesheim. That work included by permission.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef lint
-static const char sccsid[] = "@(#)input.c 8.1 (Berkeley) 6/5/93";
-#endif /* not lint */
-
-/*
- * IPX Routing Table Management Daemon
- */
-#include "defs.h"
-
-struct sockaddr *
-ipx_nettosa(net)
-union ipx_net net;
-{
- static struct sockaddr_ipx sxn;
-
- bzero(&sxn, sizeof (struct sockaddr_ipx));
- sxn.sipx_family = AF_IPX;
- sxn.sipx_len = sizeof (sxn);
- sxn.sipx_addr.x_net = net;
- return( (struct sockaddr *)&sxn);
-
-}
-
-/*
- * Process a newly received packet.
- */
-void
-rip_input(from, size)
- struct sockaddr *from;
- int size;
-{
- int newsize;
- int rtchanged = 0;
- struct rt_entry *rt;
- struct netinfo *n;
- struct interface *ifp = 0;
- struct afswitch *afp;
- struct sockaddr_ipx *ipxp;
-
- ifp = if_ifwithnet(from);
- ipxp = (struct sockaddr_ipx *)from;
- if (ifp == 0) {
- if(ftrace) {
- fprintf(ftrace, "Received bogus packet from %s\n",
- ipxdp_ntoa(&ipxp->sipx_addr));
- }
- return;
- }
-
- TRACE_INPUT(ifp, from, size);
- if (from->sa_family >= AF_MAX)
- return;
- afp = &afswitch[from->sa_family];
-
- size -= sizeof (u_short) /* command */;
- n = msg->rip_nets;
-
- switch (ntohs(msg->rip_cmd)) {
-
- case RIPCMD_REQUEST:
- if (ipx_hosteq(satoipx_addr(ifp->int_addr), ipxp->sipx_addr))
- return;
- newsize = 0;
- while (size > 0) {
- if (size < sizeof (struct netinfo))
- break;
- size -= sizeof (struct netinfo);
-
- /*
- * A single entry with rip_dst == DSTNETS_ALL and
- * metric ``infinity'' means ``all routes''.
- *
- * XXX According to the IPX RIP spec the metric
- * and tick fields can be anything. So maybe we
- * should not check the metric???
- */
- if (ipx_neteqnn(n->rip_dst, ipx_anynet) &&
- ntohs(n->rip_metric) == HOPCNT_INFINITY &&
- size == 0) {
- supply(from, 0, ifp, 0);
- return;
- }
- /*
- * request for specific nets
- */
- rt = rtlookup(ipx_nettosa(n->rip_dst));
- if (ftrace) {
- fprintf(ftrace,
- "specific request for %s",
- ipxdp_nettoa(n->rip_dst));
- fprintf(ftrace,
- " yields route %lx\n",
- (u_long)rt);
- }
- /*
- * XXX We break out on the first net that isn't
- * found. The specs is a bit vague here. I'm not
- * sure what we should do.
- */
- if (rt == 0)
- return;
- /* XXX
- * According to the spec we should not include
- * information about networks for which the number
- * of hops is 16.
- */
- if (rt->rt_metric == (HOPCNT_INFINITY-1))
- return;
- n->rip_metric = htons( rt == 0 ? HOPCNT_INFINITY :
- min(rt->rt_metric+1, HOPCNT_INFINITY));
- n->rip_ticks = htons(rt->rt_ticks+1);
-
- /*
- * We use split horizon with a twist. If the requested
- * net is the directly connected net we supply an
- * answer. This is so that the host can learn about
- * the routers on its net.
- */
- {
- register struct rt_entry *trt = rt;
-
- while (trt) {
- if ((trt->rt_ifp == ifp) &&
- !ipx_neteqnn(n->rip_dst,
- satoipx_addr(ifp->int_addr).x_net))
- return;
- trt = trt->rt_clone;
- }
- n++;
- newsize += sizeof (struct netinfo);
- }
- }
- if (newsize > 0) {
- msg->rip_cmd = htons(RIPCMD_RESPONSE);
- newsize += sizeof (u_short);
- /* should check for if with dstaddr(from) first */
- (*afp->af_output)(ripsock, 0, from, newsize);
- TRACE_OUTPUT(ifp, from, newsize);
- if (ftrace) {
- /* XXX This should not happen anymore. */
- if(ifp == 0)
- fprintf(ftrace, "--- ifp = 0\n");
- else
- fprintf(ftrace,
- "request arrived on interface %s\n",
- ifp->int_name);
- }
- }
- return;
-
- case RIPCMD_RESPONSE:
- /* verify message came from a router */
- if ((*afp->af_portmatch)(from) == 0)
- return;
- (*afp->af_canon)(from);
- /* are we talking to ourselves? */
- if ((ifp = if_ifwithaddr(from)) != 0) {
- rt = rtfind(from);
- if (rt == 0 || (rt->rt_state & RTS_INTERFACE) == 0) {
- addrouteforif(ifp);
- rtchanged = 1;
- } else
- rt->rt_timer = 0;
- return;
- }
- /* Update timer for interface on which the packet arrived.
- * If from other end of a point-to-point link that isn't
- * in the routing tables, (re-)add the route.
- */
- if ((rt = rtfind(from)) && (rt->rt_state & RTS_INTERFACE)) {
- if(ftrace) fprintf(ftrace, "Got route\n");
- rt->rt_timer = 0;
- } else if ((ifp = if_ifwithdstaddr(from)) != 0) {
- if(ftrace) fprintf(ftrace, "Got partner\n");
- addrouteforif(ifp);
- rtchanged = 1;
- }
- for (; size > 0; size -= sizeof (struct netinfo), n++) {
- struct sockaddr *sa;
- if (size < sizeof (struct netinfo))
- break;
- if ((unsigned) ntohs(n->rip_metric) > HOPCNT_INFINITY)
- continue;
- rt = rtfind(sa = ipx_nettosa(n->rip_dst));
- if (rt == 0) {
- if (ntohs(n->rip_metric) == HOPCNT_INFINITY)
- continue;
- rtadd(sa, from, ntohs(n->rip_metric),
- ntohs(n->rip_ticks), 0);
- rtchanged = 1;
- continue;
- }
-
- /*
- * A clone is a different route to the same net
- * with exactly the same cost (ticks and metric).
- * They must all be recorded because those interfaces
- * must be handled in the same way as the first route
- * to that net. ie When using the split horizon
- * algorithm we must look at these interfaces also.
- *
- * Update if from gateway and different,
- * from anywhere and less ticks or
- * if same ticks and shorter,
- * or getting stale and equivalent.
- */
- if (!equal(from, &rt->rt_router) &&
- ntohs(n->rip_ticks) == rt->rt_ticks &&
- ntohs(n->rip_metric) == rt->rt_metric &&
- ntohs(n->rip_metric) != HOPCNT_INFINITY) {
- register struct rt_entry *trt = rt->rt_clone;
-
- while (trt) {
- if (equal(from, &trt->rt_router)) {
- trt->rt_timer = 0;
- break;
- }
- trt = trt->rt_clone;
- }
- if (trt == NULL) {
- rtadd_clone(rt, sa, from,
- ntohs(n->rip_metric),
- ntohs(n->rip_ticks), 0);
- }
- continue;
- }
- if ((equal(from, &rt->rt_router) &&
- ((ntohs(n->rip_ticks) != rt->rt_ticks) ||
- (ntohs(n->rip_metric) != rt->rt_metric))) ||
- (ntohs(n->rip_ticks) < rt->rt_ticks) ||
- ((ntohs(n->rip_ticks) == rt->rt_ticks) &&
- (ntohs(n->rip_metric) < rt->rt_metric)) ||
- (rt->rt_timer > (EXPIRE_TIME*2/3) &&
- rt->rt_metric == ntohs(n->rip_metric) &&
- ntohs(n->rip_metric) != HOPCNT_INFINITY)) {
- rtchange(rt, from, ntohs(n->rip_metric),
- ntohs(n->rip_ticks));
- if (ntohs(n->rip_metric) == HOPCNT_INFINITY)
- rt->rt_timer = EXPIRE_TIME;
- else
- rt->rt_timer = 0;
- rtchanged = 1;
- } else if (equal(from, &rt->rt_router) &&
- (ntohs(n->rip_ticks) == rt->rt_ticks) &&
- (ntohs(n->rip_metric) == rt->rt_metric) &&
- (ntohs(n->rip_metric) != HOPCNT_INFINITY)) {
- rt->rt_timer = 0;
- }
- }
- if (rtchanged) {
- register struct rthash *rh;
- register struct rt_entry *rt;
-
- toall(supply, NULL, 1);
- for (rh = nethash; rh < &nethash[ROUTEHASHSIZ]; rh++)
- for (rt = rh->rt_forw;
- rt != (struct rt_entry *)rh;
- rt = rt->rt_forw)
- rt->rt_state &= ~RTS_CHANGED;
- }
-
- return;
- }
-}
diff --git a/usr.sbin/IPXrouted/interface.h b/usr.sbin/IPXrouted/interface.h
deleted file mode 100644
index ed7b988..0000000
--- a/usr.sbin/IPXrouted/interface.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)interface.h 8.1 (Berkeley) 6/5/93
- *
- * $FreeBSD$
- */
-
-/*
- * Routing table management daemon.
- */
-
-/*
- * An ``interface'' is similar to an ifnet structure,
- * except it doesn't contain q'ing info, and it also
- * handles ``logical'' interfaces (remote gateways
- * that we want to keep polling even if they go down).
- * The list of interfaces which we maintain is used
- * in supplying the gratuitous routing table updates.
- * We list only one address for each interface, the AF_IPX one.
- */
-struct interface {
- struct interface *int_next;
- struct sockaddr int_addr; /* address on this host */
- union {
- struct sockaddr intu_broadaddr;
- struct sockaddr intu_dstaddr;
- } int_intu;
-#define int_broadaddr int_intu.intu_broadaddr /* broadcast address */
-#define int_dstaddr int_intu.intu_dstaddr /* other end of p-to-p link */
- int int_metric; /* init's routing entry */
- int int_flags; /* see below */
- struct ifdebug int_input, int_output; /* packet tracing stuff */
- int int_ipackets; /* input packets received */
- int int_opackets; /* output packets sent */
- char *int_name; /* from kernel if structure */
- u_short int_transitions; /* times gone up-down */
-
- /* XXX IPX Specific entry */
- struct sameq {
- struct sameq *n; /* q of other pt-to-pt links */
- struct sameq *p; /* with same net # */
- } int_sq;
-};
-
-/*
- * 0x1 to 0x10 are reused from the kernel's ifnet definitions,
- * the others agree with the RTS_ flags defined elsewhere.
- */
-#define IFF_UP 0x1 /* interface is up */
-#define IFF_BROADCAST 0x2 /* broadcast address valid */
-#define IFF_DEBUG 0x4 /* turn on debugging */
-#define IFF_ROUTE 0x8 /* routing entry installed */
-#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
-
-#define IFF_PASSIVE 0x200000 /* can't tell if up/down */
-#define IFF_INTERFACE 0x400000 /* hardware interface */
-#define IFF_REMOTE 0x800000 /* interface isn't on this machine */
-
-struct interface *if_ifwithaddr(struct sockaddr *);
-struct interface *if_ifwithdstaddr(struct sockaddr *);
-struct interface *if_ifwithnet(struct sockaddr *);
-struct interface *if_iflookup(struct sockaddr *);
-
diff --git a/usr.sbin/IPXrouted/main.c b/usr.sbin/IPXrouted/main.c
deleted file mode 100644
index 773410a..0000000
--- a/usr.sbin/IPXrouted/main.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * This file includes significant work done at Cornell University by
- * Bill Nesheim. That work included by permission.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1985, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static const char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/5/93";
-#endif /* not lint */
-
-/*
- * IPX Routing Information Protocol Daemon
- */
-#include "defs.h"
-#include <sys/time.h>
-
-#include <net/if.h>
-
-#include <errno.h>
-#include <nlist.h>
-#include <signal.h>
-#include <paths.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#define SAP_PKT 0
-#define RIP_PKT 1
-
-struct sockaddr_ipx addr; /* Daemon's Address */
-int ripsock; /* RIP Socket to listen on */
-int sapsock; /* SAP Socket to listen on */
-int kmem;
-int install; /* if 1 call kernel */
-int lookforinterfaces; /* if 1 probe kernel for new up interfaces */
-int performnlist; /* if 1 check if /kernel has changed */
-int externalinterfaces; /* # of remote and local interfaces */
-int timeval; /* local idea of time */
-int noteremoterequests; /* squawk on requests from non-local nets */
-int r; /* Routing socket to install updates with */
-struct sockaddr_ipx ipx_netmask; /* Used in installing routes */
-
-char packet[MAXRXPACKETSIZE+1];
-
-char **argv0;
-
-int supplier = -1; /* process should supply updates */
-int dosap = 1; /* By default do SAP services. */
-int dobcast = 1; /* A RIP/SAP broadcast is needed. */
-time_t lastbcast; /* Time of last RIP/SAP broadcast */
-
-struct rip *msg = (struct rip *) &packet[sizeof (struct ipx)];
-struct sap_packet *sap_msg =
- (struct sap_packet *) &packet[sizeof (struct ipx)];
-void hup(), fkexit(), timer();
-void process(int fd, int pkt_type);
-int getsocket(int type, int proto, struct sockaddr_ipx *sipx);
-void getinfo();
-void catchtimer();
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int nfds;
- fd_set fdvar;
- time_t ttime;
- struct itimerval tval;
-
- argv0 = argv;
- argv++, argc--;
- while (argc > 0 && **argv == '-') {
- if (strcmp(*argv, "-s") == 0) {
- supplier = 1;
- argv++, argc--;
- continue;
- }
- if (strcmp(*argv, "-q") == 0) {
- supplier = 0;
- argv++, argc--;
- continue;
- }
- if (strcmp(*argv, "-R") == 0) {
- noteremoterequests++;
- argv++, argc--;
- continue;
- }
- if (strcmp(*argv, "-S") == 0) {
- dosap = 0;
- argv++, argc--;
- continue;
- }
- if (strcmp(*argv, "-t") == 0) {
- tracepackets++;
- argv++, argc--;
- ftrace = stderr;
- tracing = 1;
- continue;
- }
- if (strcmp(*argv, "-g") == 0) {
- gateway = 1;
- argv++, argc--;
- continue;
- }
- if (strcmp(*argv, "-l") == 0) {
- gateway = -1;
- argv++, argc--;
- continue;
- }
- if (strcmp(*argv, "-N") == 0) {
- dognreply = 0;
- argv++, argc--;
- continue;
- }
- fprintf(stderr,
- "usage: ipxrouted [ -s ] [ -q ] [ -t ] [ -g ] [ -l ] [ -N ]\n");
- exit(1);
- }
-
-
-#ifndef DEBUG
- if (!tracepackets)
- daemon(0, 0);
-#endif
- openlog("IPXrouted", LOG_PID, LOG_DAEMON);
-
- addr.sipx_family = AF_IPX;
- addr.sipx_len = sizeof(addr);
- addr.sipx_port = htons(IPXPORT_RIP);
- ipx_anynet.s_net[0] = ipx_anynet.s_net[1] = -1;
- ipx_netmask.sipx_addr.x_net = ipx_anynet;
- ipx_netmask.sipx_len = 6;
- ipx_netmask.sipx_family = AF_IPX;
- r = socket(AF_ROUTE, SOCK_RAW, 0);
- /* later, get smart about lookingforinterfaces */
- if (r)
- shutdown(r, SHUT_RD); /* for now, don't want reponses */
- else {
- fprintf(stderr, "IPXrouted: no routing socket\n");
- exit(1);
- }
- ripsock = getsocket(SOCK_DGRAM, 0, &addr);
- if (ripsock < 0)
- exit(1);
-
- if (dosap) {
- addr.sipx_port = htons(IPXPORT_SAP);
- sapsock = getsocket(SOCK_DGRAM, 0, &addr);
- if (sapsock < 0)
- exit(1);
- } else
- sapsock = -1;
-
- /*
- * Any extra argument is considered
- * a tracing log file.
- */
- if (argc > 0)
- traceon(*argv);
- /*
- * Collect an initial view of the world by
- * snooping in the kernel. Then, send a request packet on all
- * directly connected networks to find out what
- * everyone else thinks.
- */
- rtinit();
- sapinit();
- ifinit();
- if (supplier < 0)
- supplier = 0;
- /* request the state of the world */
- msg->rip_cmd = htons(RIPCMD_REQUEST);
- msg->rip_nets[0].rip_dst = ipx_anynet;
- msg->rip_nets[0].rip_metric = htons(HOPCNT_INFINITY);
- msg->rip_nets[0].rip_ticks = htons(-1);
- toall(sndmsg, NULL, 0);
-
- if (dosap) {
- sap_msg->sap_cmd = htons(SAP_REQ);
- sap_msg->sap[0].ServType = htons(SAP_WILDCARD);
- toall(sapsndmsg, NULL, 0);
- }
-
- signal(SIGALRM, catchtimer);
- signal(SIGHUP, hup);
- signal(SIGINT, hup);
- signal(SIGEMT, fkexit);
- signal(SIGINFO, getinfo);
-
- tval.it_interval.tv_sec = TIMER_RATE;
- tval.it_interval.tv_usec = 0;
- tval.it_value.tv_sec = TIMER_RATE;
- tval.it_value.tv_usec = 0;
- setitimer(ITIMER_REAL, &tval, NULL);
-
- nfds = 1 + max(sapsock, ripsock);
-
- for (;;) {
- if (dobcast) {
- dobcast = 0;
- lastbcast = time(NULL);
- timer();
- }
-
- FD_ZERO(&fdvar);
- if (dosap) {
- FD_SET(sapsock, &fdvar);
- }
- FD_SET(ripsock, &fdvar);
-
- if(select(nfds, &fdvar, (fd_set *)NULL, (fd_set *)NULL,
- (struct timeval *)NULL) < 0) {
- if(errno == EINTR)
- continue;
- perror("during select");
- exit(1);
- }
-
- if(FD_ISSET(ripsock, &fdvar))
- process(ripsock, RIP_PKT);
-
- if(dosap && FD_ISSET(sapsock, &fdvar))
- process(sapsock, SAP_PKT);
-
- ttime = time(NULL);
- if (ttime > (lastbcast + TIMER_RATE + (TIMER_RATE * 2 / 3))) {
- dobcast = 1;
- syslog(LOG_ERR, "Missed alarm");
- }
- }
-}
-
-void
-process(fd, pkt_type)
- int fd;
- int pkt_type;
-{
- struct sockaddr from;
- int cc, omask;
- socklen_t fromlen = sizeof (from);
- struct ipx *ipxdp = (struct ipx *)packet;
-
- cc = recvfrom(fd, packet, sizeof (packet), 0, &from, &fromlen);
- if (cc <= 0) {
- if (cc < 0 && errno != EINTR)
- syslog(LOG_ERR, "recvfrom: %m");
- return;
- }
- if (tracepackets > 1 && ftrace) {
- fprintf(ftrace,"rcv %d bytes on %s ",
- cc, ipxdp_ntoa(&ipxdp->ipx_dna));
- fprintf(ftrace," from %s\n", ipxdp_ntoa(&ipxdp->ipx_sna));
- }
-
- if (noteremoterequests &&
- !ipx_neteqnn(ipxdp->ipx_sna.x_net, ipx_zeronet) &&
- !ipx_neteq(ipxdp->ipx_sna, ipxdp->ipx_dna))
- {
- syslog(LOG_ERR,
- "net of interface (%s) != net on ether (%s)!\n",
- ipxdp_nettoa(ipxdp->ipx_dna.x_net),
- ipxdp_nettoa(ipxdp->ipx_sna.x_net));
- }
-
- /* We get the IPX header in front of the RIF packet*/
- cc -= sizeof (struct ipx);
-#define mask(s) (1<<((s)-1))
- omask = sigblock(mask(SIGALRM));
- switch(pkt_type) {
- case SAP_PKT: sap_input(&from, cc);
- break;
- case RIP_PKT: rip_input(&from, cc);
- break;
- }
- sigsetmask(omask);
-}
-
-int
-getsocket(type, proto, sipx)
- int type, proto;
- struct sockaddr_ipx *sipx;
-{
- int domain = sipx->sipx_family;
- int retry, s, on = 1;
-
- retry = 1;
- while ((s = socket(domain, type, proto)) < 0 && retry) {
- syslog(LOG_ERR, "socket: %m");
- sleep(5 * retry);
- retry <<= 1;
- }
- if (retry == 0)
- return (-1);
- while (bind(s, (struct sockaddr *)sipx, sizeof (*sipx)) < 0 && retry) {
- syslog(LOG_ERR, "bind: %m");
- sleep(5 * retry);
- retry <<= 1;
- }
- if (retry == 0)
- return (-1);
- if (domain==AF_IPX) {
- struct ipx ipxdp;
- if (setsockopt(s, 0, SO_HEADERS_ON_INPUT, &on, sizeof(on))) {
- syslog(LOG_ERR, "setsockopt SEE HEADERS: %m");
- exit(1);
- }
- if (ntohs(sipx->sipx_addr.x_port) == IPXPORT_RIP)
- ipxdp.ipx_pt = IPXPROTO_RI;
- else if (ntohs(sipx->sipx_addr.x_port) == IPXPORT_SAP)
-#ifdef IPXPROTO_SAP
- ipxdp.ipx_pt = IPXPROTO_SAP;
-#else
- ipxdp.ipx_pt = IPXPROTO_PXP;
-#endif
- else {
- syslog(LOG_ERR, "port should be either RIP or SAP");
- exit(1);
- }
- if (setsockopt(s, 0, SO_DEFAULT_HEADERS, &ipxdp, sizeof(ipxdp))) {
- syslog(LOG_ERR, "setsockopt SET HEADER: %m");
- exit(1);
- }
- }
- if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) {
- syslog(LOG_ERR, "setsockopt SO_BROADCAST: %m");
- exit(1);
- }
- return (s);
-}
-
-/*
- * Fork and exit on EMT-- for profiling.
- */
-void
-fkexit()
-{
- if (fork() == 0)
- exit(0);
-}
-
-void
-catchtimer()
-{
- dobcast = 1;
-}
-
-void
-getinfo()
-{
- FILE *fh;
-
- fh = fopen("/var/log/ipxrouted.dmp", "a");
- if(fh == NULL)
- return;
-
- dumpriptable(fh);
- dumpsaptable(fh, sap_head);
-
- fclose(fh);
-}
-
diff --git a/usr.sbin/IPXrouted/output.c b/usr.sbin/IPXrouted/output.c
deleted file mode 100644
index 78922c9..0000000
--- a/usr.sbin/IPXrouted/output.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * This file includes significant work done at Cornell University by
- * Bill Nesheim. That work included by permission.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef lint
-static const char sccsid[] = "@(#)output.c 8.1 (Berkeley) 6/5/93";
-#endif /* not lint */
-
-/*
- * Routing Table Management Daemon
- */
-#include <unistd.h>
-#include "defs.h"
-
-/*
- * Apply the function "f" to all non-passive
- * interfaces. If the interface supports the
- * use of broadcasting use it, otherwise address
- * the output to the known router.
- */
-void
-toall(f, except, changesonly)
- void (*f)(struct sockaddr *, int, struct interface *, int);
- struct rt_entry *except;
- int changesonly;
-{
- register struct interface *ifp;
- register struct sockaddr *dst;
- register int flags;
- register struct rt_entry *trt;
- int onlist;
- extern struct interface *ifnet;
-
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if (ifp->int_flags & IFF_PASSIVE)
- continue;
-
- /*
- * Don't send it on interfaces in the except list.
- */
- onlist = 0;
- trt = except;
- while(trt) {
- if (ifp == trt->rt_ifp) {
- onlist = 1;
- break;
- }
- trt = trt->rt_clone;
- }
- if (onlist)
- continue;
-
- dst = ifp->int_flags & IFF_BROADCAST ? &ifp->int_broadaddr :
- ifp->int_flags & IFF_POINTOPOINT ? &ifp->int_dstaddr :
- &ifp->int_addr;
- flags = ifp->int_flags & IFF_INTERFACE ? MSG_DONTROUTE : 0;
- (*f)(dst, flags, ifp, changesonly);
- }
-}
-
-/*
- * Output a preformed packet.
- */
-void
-sndmsg(dst, flags, ifp, changesonly)
- struct sockaddr *dst;
- int flags;
- struct interface *ifp;
- int changesonly;
-{
-
- (*afswitch[dst->sa_family].af_output)
- (ripsock, flags, dst, sizeof (struct rip));
- TRACE_OUTPUT(ifp, dst, sizeof (struct rip));
-}
-
-/*
- * Supply dst with the contents of the routing tables.
- * If this won't fit in one packet, chop it up into several.
- *
- * This must be done using the split horizon algorithm.
- * 1. Don't send routing info to the interface from where it was received.
- * 2. Don't publish an interface to itself.
- * 3. If a route is received from more than one interface and the cost is
- * the same, don't publish it on either interface. I am calling this
- * clones.
- */
-void
-supply(dst, flags, ifp, changesonly)
- struct sockaddr *dst;
- int flags;
- struct interface *ifp;
- int changesonly;
-{
- register struct rt_entry *rt;
- register struct rt_entry *crt; /* Clone route */
- register struct rthash *rh;
- register struct netinfo *nn;
- register struct netinfo *n = msg->rip_nets;
- struct sockaddr_ipx *sipx = (struct sockaddr_ipx *) dst;
- af_output_t *output = afswitch[dst->sa_family].af_output;
- int size, metric, ticks;
- union ipx_net net;
- int delay = 0;
-
- if (sipx->sipx_port == 0)
- sipx->sipx_port = htons(IPXPORT_RIP);
-
- msg->rip_cmd = ntohs(RIPCMD_RESPONSE);
- for (rh = nethash; rh < &nethash[ROUTEHASHSIZ]; rh++)
- for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
- size = (char *)n - (char *)msg;
- if (size >= ((MAXRIPNETS * sizeof (struct netinfo)) +
- sizeof (msg->rip_cmd))) {
- (*output)(ripsock, flags, dst, size);
- TRACE_OUTPUT(ifp, dst, size);
- n = msg->rip_nets;
- delay++;
- if(delay == 2) {
- usleep(50000);
- delay = 0;
- }
- }
-
- if (changesonly && !(rt->rt_state & RTS_CHANGED))
- continue;
-
- /*
- * This should do rule one and two of the split horizon
- * algorithm.
- */
- if (rt->rt_ifp == ifp)
- continue;
-
- /*
- * Rule 3.
- * Look if we have clones (different routes to the same
- * place with exactly the same cost).
- *
- * We should not publish on any of the clone interfaces.
- */
- crt = rt->rt_clone;
- while (crt) {
- if (crt->rt_ifp == ifp)
- goto next;
- crt = crt->rt_clone;
- }
-
- sipx = (struct sockaddr_ipx *)&rt->rt_dst;
- if ((rt->rt_flags & (RTF_HOST|RTF_GATEWAY)) == RTF_HOST)
- sipx = (struct sockaddr_ipx *)&rt->rt_router;
- if (rt->rt_metric == HOPCNT_INFINITY)
- metric = HOPCNT_INFINITY;
- else {
- metric = rt->rt_metric + 1;
- /*
- * We don't advertize routes with more than 15 hops.
- */
- if (metric >= HOPCNT_INFINITY)
- continue;
- }
- /* XXX One day we should cater for slow interfaces also. */
- ticks = rt->rt_ticks + 1;
- net = sipx->sipx_addr.x_net;
-
- /*
- * Make sure that we don't put out a two net entries
- * for a pt to pt link (one for the G route, one for the if)
- * This is a kludge, and won't work if there are lots of nets.
- */
- for (nn = msg->rip_nets; nn < n; nn++) {
- if (ipx_neteqnn(net, nn->rip_dst)) {
- if (ticks < ntohs(nn->rip_ticks)) {
- nn->rip_metric = htons(metric);
- nn->rip_ticks = htons(ticks);
- } else if ((ticks == ntohs(nn->rip_ticks)) &&
- (metric < ntohs(nn->rip_metric))) {
- nn->rip_metric = htons(metric);
- nn->rip_ticks = htons(ticks);
- }
- goto next;
- }
- }
- n->rip_dst = net;
- n->rip_metric = htons(metric);
- n->rip_ticks = htons(ticks);
- n++;
- next:;
- }
- if (n != msg->rip_nets) {
- size = (char *)n - (char *)msg;
- (*output)(ripsock, flags, dst, size);
- TRACE_OUTPUT(ifp, dst, size);
- }
-}
diff --git a/usr.sbin/IPXrouted/protocol.h b/usr.sbin/IPXrouted/protocol.h
deleted file mode 100644
index 7fae536..0000000
--- a/usr.sbin/IPXrouted/protocol.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * This file includes significant work done at Cornell University by
- * Bill Nesheim. That work included by permission.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)protocol.h 8.1 (Berkeley) 6/5/93
- *
- * $FreeBSD$
- */
-
-/*
- * IPX Routing Information Protocol
- *
- */
-
-struct netinfo {
- union ipx_net rip_dst; /* destination net */
- u_short rip_metric; /* cost of route */
- u_short rip_ticks; /* cost of route */
-};
-
-struct rip {
- u_short rip_cmd; /* request/response */
- struct netinfo rip_nets[1]; /* variable length */
-};
-
-/*
- * Packet types.
- */
-#define RIPCMD_REQUEST 1 /* want info */
-#define RIPCMD_RESPONSE 2 /* responding to request */
-
-#define RIPCMD_MAX 3
-#ifdef RIPCMDS
-char *ripcmds[RIPCMD_MAX] =
- { "#0", "REQUEST", "RESPONSE" };
-#endif
-
-#define HOPCNT_INFINITY 16 /* per IPX */
-#define DSTNETS_ALL 0xffffffff /* per IPX */
-#define MAXRXPACKETSIZE 1500 /* max rx broadcast size */
-#define MAXRIPNETS 50 /* max nets in tx packet */
-
-extern union ipx_net ipx_anynet;
-extern union ipx_net ipx_zeronet;
-
-/*
- * Timer values used in managing the routing table.
- * Every update forces an entry's timer to be reset. After
- * EXPIRE_TIME without updates, the entry is marked invalid,
- * but held onto until GARBAGE_TIME so that others may
- * see it "be deleted".
- */
-#define TIMER_RATE 30 /* alarm clocks every 30 seconds */
-
-#define SUPPLY_INTERVAL 30 /* time to supply tables */
-#define RIP_INTERVAL 60 /* time to supply rip tables */
-
-#define EXPIRE_TIME 180 /* time to mark entry invalid */
-#define GARBAGE_TIME 240 /* time to garbage collect */
diff --git a/usr.sbin/IPXrouted/sap.h b/usr.sbin/IPXrouted/sap.h
deleted file mode 100644
index b4e9dcb..0000000
--- a/usr.sbin/IPXrouted/sap.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Hay.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY John Hay AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL John Hay OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-#ifndef _SAP_H_
-#define _SAP_H_
-
-#define SAP_REQ 1
-#define SAP_RESP 2
-#define SAP_REQ_NEAR 3
-#define SAP_RESP_NEAR 4
-
-#define SAPCMD_MAX 5
-#ifdef SAPCMDS
-char *sapcmds[SAPCMD_MAX] =
- { "#0", "REQUEST", "RESPONSE", "REQ NEAREST", "RESP NEAREST"};
-#endif
-
-#define MAXSAPENTRIES 7
-#define SAP_WILDCARD 0xFFFF
-#define SERVNAMELEN 48
-typedef struct sap_info {
- u_short ServType;
- char ServName[SERVNAMELEN];
- struct ipx_addr ipx;
- u_short hops;
- }sap_info;
-
-typedef struct sap_packet {
- u_short sap_cmd;
- sap_info sap[0]; /* Variable length. */
- }sap_packet;
-
-typedef struct sap_entry {
- struct sap_entry *forw;
- struct sap_entry *back;
- struct sap_entry *clone;
- struct interface *ifp;
- struct sap_info sap;
- struct sockaddr source;
- int hash;
- int state;
- int timer;
- }sap_entry;
-
-#define SAPHASHSIZ 256 /* Should be a power of 2 */
-#define SAPHASHMASK (SAPHASHSIZ-1)
-typedef struct sap_hash {
- struct sap_entry *forw;
- struct sap_entry *back;
- }sap_hash;
-
-extern sap_hash sap_head[SAPHASHSIZ];
-
-extern struct sap_packet *sap_msg;
-
-void sapinit(void);
-void sap_input(struct sockaddr *from, int size);
-void sapsndmsg(struct sockaddr *dst, int flags, struct interface *ifp,
- int changesonly);
-void sap_supply_toall(int changesonly);
-void sap_supply(struct sockaddr *dst,
- int flags,
- struct interface *ifp,
- int ServType,
- int changesonly);
-
-struct sap_entry *sap_lookup(u_short ServType, char *ServName);
-struct sap_entry *sap_nearestserver(ushort ServType, struct interface *ifp);
-void sap_add(struct sap_info *si, struct sockaddr *from);
-void sap_change(struct sap_entry *sap,
- struct sap_info *si,
- struct sockaddr *from);
-void sap_add_clone(struct sap_entry *sap,
- struct sap_info *clone,
- struct sockaddr *from);
-void sap_delete(struct sap_entry *sap);
-
-#endif /*_SAP_H_*/
-
diff --git a/usr.sbin/IPXrouted/sap_input.c b/usr.sbin/IPXrouted/sap_input.c
deleted file mode 100644
index a503471..0000000
--- a/usr.sbin/IPXrouted/sap_input.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Hay.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY John Hay AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL John Hay OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * IPX Routing Table Management Daemon
- */
-#include "defs.h"
-
-int dognreply = 1;
-
-/*
- * Process a newly received packet.
- */
-void
-sap_input(from, size)
- struct sockaddr *from;
- int size;
-{
- int newsize;
- int sapchanged = 0;
- struct sap_entry *sap;
- struct sap_info *n;
- struct interface *ifp = 0;
- struct afswitch *afp;
- struct sockaddr_ipx *ipxp;
-
- ifp = if_ifwithnet(from);
- ipxp = (struct sockaddr_ipx *)from;
- if (ifp == 0) {
- if(ftrace) {
- fprintf(ftrace, "Received bogus packet from %s\n",
- ipxdp_ntoa(&ipxp->sipx_addr));
- }
- return;
- }
-
- if (ftrace)
- dumpsappacket(ftrace, "received", from, (char *)sap_msg , size);
-
- if (from->sa_family >= AF_MAX)
- return;
- afp = &afswitch[from->sa_family];
-
- size -= sizeof (u_short) /* command */;
- n = sap_msg->sap;
-
- switch (ntohs(sap_msg->sap_cmd)) {
-
- case SAP_REQ_NEAR:
- if (ftrace)
- fprintf(ftrace, "Received a sap REQ_NEAR packet.\n");
- if (!dognreply)
- return;
- sap = sap_nearestserver(n->ServType, ifp);
- if (sap == NULL)
- return;
- sap_msg->sap_cmd = htons(SAP_RESP_NEAR);
- *n = sap->sap;
- n->hops = htons(ntohs(n->hops) + 1);
- if (ntohs(n->hops) >= HOPCNT_INFINITY)
- return;
-
- newsize = sizeof(struct sap_info) + sizeof(struct sap_packet);
- (*afp->af_output)(sapsock, 0, from, newsize);
- if (ftrace) {
- fprintf(ftrace, "sap_nearestserver %X %s returned:\n",
- ntohs(n->ServType),
- ifp->int_name);
- fprintf(ftrace, " service %04X %-20.20s "
- "addr %s.%04X metric %d\n",
- ntohs(sap->sap.ServType),
- sap->sap.ServName,
- ipxdp_ntoa(&sap->sap.ipx),
- ntohs(sap->sap.ipx.x_port),
- ntohs(sap->sap.hops));
- }
- return;
-
- case SAP_REQ:
- if (ftrace)
- fprintf(ftrace, "Received a sap REQ packet.\n");
-
- sap_supply(from, 0, ifp, n->ServType, 0);
- return;
-
- case SAP_RESP_NEAR:
- /* XXX We do nothing here, for the moment.
- * Maybe we should check if the service is in our table?
- *
- */
- if (ftrace)
- fprintf(ftrace, "Received a sap RESP_NEAR packet.\n");
-
- return;
-
- case SAP_RESP:
- if (ftrace)
- fprintf(ftrace, "Received a sap RESP packet.\n");
-
- (*afp->af_canon)(from);
-
- for (; size > 0; size -= sizeof (struct sap_info), n++) {
- if (size < sizeof (struct netinfo))
- break;
- /*
- * The idea here is that if the hop count is more
- * than INFINITY it is bogus and should be discarded.
- * If it is equal to INFINITY it is a message to say
- * that a service went down. If we don't already
- * have it in our tables discard it. Otherwise
- * update our table and set the timer to EXPIRE_TIME
- * so that it is removed next time we go through the
- * tables.
- */
- if (ntohs(n->hops) > HOPCNT_INFINITY)
- continue;
- sap = sap_lookup(n->ServType, n->ServName);
- if (sap == 0) {
- if (ntohs(n->hops) == HOPCNT_INFINITY)
- continue;
- sap_add(n, from);
- sapchanged = 1;
- continue;
- }
-
- /*
- * A clone is a different route to the same service
- * with exactly the same cost (metric).
- * They must all be recorded because those interfaces
- * must be handled in the same way as the first route
- * to that service. ie When using the split horizon
- * algorithm we must look at these interfaces also.
- *
- * Update if from gateway and different,
- * from anywhere and less hops or
- * getting stale and equivalent.
- */
- if (((ifp != sap->ifp) ||
- !equal(&sap->source, from)) &&
- (n->hops == sap->sap.hops) &&
- (ntohs(n->hops) != HOPCNT_INFINITY)) {
- register struct sap_entry *tsap = sap->clone;
-
- while (tsap) {
- if ((ifp == tsap->ifp) &&
- equal(&tsap->source, from)) {
- tsap->timer = 0;
- break;
- }
- tsap = tsap->clone;
- }
- if (tsap == NULL) {
- sap_add_clone(sap, n, from);
- }
- continue;
- }
- if ((ifp == sap->ifp) &&
- equal(&sap->source, from) &&
- (ntohs(n->hops) == ntohs(sap->sap.hops)))
- sap->timer = 0;
- else if (((ifp == sap->ifp) &&
- equal(&sap->source, from) &&
- (n->hops != sap->sap.hops)) ||
- (ntohs(n->hops) < ntohs(sap->sap.hops)) ||
- (sap->timer > (EXPIRE_TIME*2/3) &&
- ntohs(sap->sap.hops) == ntohs(n->hops) &&
- ntohs(n->hops) != HOPCNT_INFINITY)) {
- sap_change(sap, n, from);
- sapchanged = 1;
- }
- }
- if (sapchanged) {
- register struct sap_entry *sap;
- register struct sap_hash *sh;
- sap_supply_toall(1);
-
- for (sh = sap_head; sh < &sap_head[SAPHASHSIZ]; sh++)
- for (sap = sh->forw;
- sap != (struct sap_entry *)sh;
- sap = sap->forw)
- sap->state &= ~RTS_CHANGED;
- }
- return;
- }
-}
diff --git a/usr.sbin/IPXrouted/sap_output.c b/usr.sbin/IPXrouted/sap_output.c
deleted file mode 100644
index d1f1a28..0000000
--- a/usr.sbin/IPXrouted/sap_output.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Hay.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY John Hay AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL John Hay OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/*
- * Routing Table Management Daemon
- */
-#include <unistd.h>
-#include "defs.h"
-
-/*
- * Apply the function "f" to all non-passive
- * interfaces. If the interface supports the
- * use of broadcasting use it, otherwise address
- * the output to the known router.
- */
-void
-sap_supply_toall(changesonly)
- int changesonly;
-{
- register struct interface *ifp;
- struct sockaddr dst;
- register struct sockaddr_ipx *ipx_dst;
- register int flags;
- extern struct interface *ifnet;
-
- ipx_dst = (struct sockaddr_ipx *)&dst;
-
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if (ifp->int_flags & IFF_PASSIVE)
- continue;
-
- dst = ifp->int_flags & IFF_BROADCAST ? ifp->int_broadaddr :
- ifp->int_flags & IFF_POINTOPOINT ? ifp->int_dstaddr :
- ifp->int_addr;
-
- ipx_dst->sipx_addr.x_port = htons(IPXPORT_SAP);
-
- flags = ifp->int_flags & IFF_INTERFACE ? MSG_DONTROUTE : 0;
- sap_supply(&dst, flags, ifp, SAP_WILDCARD, changesonly);
- }
-}
-
-void
-sapsndmsg(dst, flags, ifp, changesonly)
- struct sockaddr *dst;
- int flags;
- struct interface *ifp;
- int changesonly;
-{
- struct sockaddr t_dst;
- struct sockaddr_ipx *ipx_dst;
-
- t_dst = *dst;
- ipx_dst = (struct sockaddr_ipx *)&t_dst;
-
- if (ipx_dst->sipx_addr.x_port == 0)
- ipx_dst->sipx_addr.x_port = htons(IPXPORT_SAP);
-
- (*afswitch[dst->sa_family].af_output)
- (sapsock, flags, &t_dst,
- sizeof (struct sap_packet) + sizeof(u_short));
- TRACE_SAP_OUTPUT(ifp, &t_dst,
- sizeof (struct sap_packet) + sizeof(u_short));
-}
-
-/*
- * Supply dst with the contents of the SAP tables. If the ServType ==
- * SAP_WILDCARD (0xFFFF) supply the whole table, otherwise only the
- * services that are of ServType. If this won't fit in one packet, chop
- * it up into several.
- *
- * This must be done using the split horizon algorithm.
- * 1. Don't send SAP info to the interface from where it was received.
- * 2. If a service is received from more than one interface and the cost is
- * the same, don't publish it on either interface. I am calling this
- * clones.
- */
-void
-sap_supply(dst, flags, ifp, ServType, changesonly)
- struct sockaddr *dst;
- int flags;
- struct interface *ifp;
- int ServType;
- int changesonly;
-{
- register struct sap_entry *sap;
- register struct sap_entry *csap; /* Clone route */
- register struct sap_hash *sh;
- register struct sap_info *n = sap_msg->sap;
- struct sap_hash *base = sap_head;
- struct sockaddr_ipx *sipx = (struct sockaddr_ipx *) dst;
- af_output_t *output = afswitch[dst->sa_family].af_output;
- int size, metric;
- int delay = 0;
-
- if (sipx->sipx_port == 0)
- sipx->sipx_port = htons(IPXPORT_SAP);
-
- sap_msg->sap_cmd = ntohs(SAP_RESP);
-
- for (sh = base; sh < &base[SAPHASHSIZ]; sh++)
- for (sap = sh->forw; sap != (struct sap_entry *)sh; sap = sap->forw) {
- size = (char *)n - (char *)sap_msg;
- if (size >= ((MAXSAPENTRIES * sizeof (struct sap_info)) +
- sizeof (sap_msg->sap_cmd))) {
- (*output)(sapsock, flags, dst, size);
- TRACE_SAP_OUTPUT(ifp, dst, size);
- n = sap_msg->sap;
- delay++;
- if(delay == 2) {
- usleep(50000);
- delay = 0;
- }
- }
-
- if (changesonly && !(sap->state & RTS_CHANGED))
- continue;
-
- /*
- * Check for the servicetype except if the ServType is
- * a wildcard (0xFFFF).
- */
- if ((ServType != SAP_WILDCARD) &&
- (ServType != sap->sap.ServType))
- continue;
-
- /*
- * This should do rule one and two of the split horizon
- * algorithm.
- */
- if (sap->ifp == ifp)
- continue;
-
- /*
- * Rule 2.
- * Look if we have clones (different routes to the same
- * place with exactly the same cost).
- *
- * We should not publish on any of the clone interfaces.
- */
- csap = sap->clone;
- while (csap) {
- if (csap->ifp == ifp)
- goto next;
- csap = csap->clone;
- }
-
- /*
- * Don't advertise services with more than 15 hops. It
- * will be confused with a service that has gone down.
- */
- if (ntohs(sap->sap.hops) == (HOPCNT_INFINITY - 1))
- continue;
- metric = min(ntohs(sap->sap.hops) + 1, HOPCNT_INFINITY);
-
- *n = sap->sap;
- n->hops = htons(metric);
- n++;
-next:
- ;
- }
- if (n != sap_msg->sap) {
- size = (char *)n - (char *)sap_msg;
- (*output)(sapsock, flags, dst, size);
- TRACE_SAP_OUTPUT(ifp, dst, size);
- }
-}
-
diff --git a/usr.sbin/IPXrouted/sap_tables.c b/usr.sbin/IPXrouted/sap_tables.c
deleted file mode 100644
index 57b5af5..0000000
--- a/usr.sbin/IPXrouted/sap_tables.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by John Hay.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY John Hay AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL John Hay OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include "defs.h"
-#include <search.h>
-#include <string.h>
-#include <stdlib.h>
-
-#define FIXLEN(s) { if ((s)->sa_len == 0) (s)->sa_len = sizeof (*(s));}
-
-sap_hash sap_head[SAPHASHSIZ];
-
-void
-sapinit(void)
-{
- int i;
-
- for (i=0; i<SAPHASHSIZ; i++)
- sap_head[i].forw = sap_head[i].back =
- (struct sap_entry *)&sap_head[i];
-}
-
-/*
- * This hash use the first 14 letters of the ServName and the ServType
- * to create a 32 bit hash value.
- */
-int
-saphash(u_short ServType, char *ServName)
-{
- int hsh, i;
- char name[SERVNAMELEN];
-
- bzero(name, SERVNAMELEN);
- strncpy(name, ServName, SERVNAMELEN);
- ServName = name;
-
- hsh = 0;
-
-#define SMVAL 33
-
- hsh = hsh * SMVAL + (ServType & 0xff);
- hsh = hsh * SMVAL + (ServType >> 8);
-
- for (i=0;i<14;i++) {
- hsh = hsh * SMVAL + *ServName++;
- ServName++;
- }
-
-#undef SMVAL
-
- return hsh;
-}
-
-/*
- * Look for an exact match on ServType and ServName. It is
- * mostly used by the function that process SAP RESPONSE packets.
- *
- * A hash is created and used to index into the hash table. Then
- * that list is walk through searching for a match.
- *
- * If no match is found NULL is returned.
- */
-struct sap_entry *
-sap_lookup(u_short ServType, char *ServName)
-{
- register struct sap_entry *sap;
- register struct sap_hash *sh;
- int hsh;
-
- hsh = saphash(ServType, ServName);
- sh = &sap_head[hsh & SAPHASHMASK];
-
- for(sap = sh->forw; sap != (sap_entry *)sh; sap = sap->forw) {
- if ((hsh == sap->hash) &&
- (ServType == sap->sap.ServType) &&
- (strncmp(ServName, sap->sap.ServName, SERVNAMELEN) == 0)) {
- return sap;
- }
- }
- return NULL;
-}
-
-/*
- * This returns the nearest service of the specified type. If no
- * suitable service is found or if that service is on the interface
- * where the request came from, NULL is returned.
- *
- * When checking interfaces clones must be considered also.
- *
- * XXX TODO:
- * Maybe we can use RIP tables to get the fastest service (ticks).
- */
-struct sap_entry *
-sap_nearestserver(ushort ServType, struct interface *ifp)
-{
- register struct sap_entry *sap;
- struct sap_hash *sh;
- register struct sap_entry *best = NULL;
- register int besthops = HOPCNT_INFINITY;
-
- sh = sap_head;
-
- for (; sh < &sap_head[SAPHASHSIZ]; sh++)
- for(sap = sh->forw; sap != (sap_entry *)sh; sap = sap->forw) {
- if (ServType != sap->sap.ServType)
- continue;
-
- if (ntohs(sap->sap.hops) < besthops) {
- best = sap;
- besthops = ntohs(best->sap.hops);
- }
- }
- return best;
-}
-
-/*
- * Add an entry to the SAP table.
- *
- * If the malloc fail, the entry will silently be thrown away.
- */
-void
-sap_add(struct sap_info *si, struct sockaddr *from)
-{
- register struct sap_entry *nsap;
- register struct sap_hash *sh;
-
- if (ntohs(si->hops) == HOPCNT_INFINITY)
- return;
-
- FIXLEN(from);
- nsap = malloc(sizeof(struct sap_entry));
- if (nsap == NULL)
- return;
-
- nsap->sap = *si;
- nsap->source = *from;
- nsap->clone = NULL;
- nsap->ifp = if_ifwithnet(from);
- nsap->state = RTS_CHANGED;
- nsap->timer = 0;
- nsap->hash = saphash(si->ServType, si->ServName);
-
- sh = &sap_head[nsap->hash & SAPHASHMASK];
-
- insque(nsap, sh);
- TRACE_SAP_ACTION("ADD", nsap);
-}
-
-/*
- * Change an existing SAP entry. If a clone exist for the old one,
- * check if it is cheaper. If it is change to the clone, otherwise
- * delete all the clones.
- */
-void
-sap_change(struct sap_entry *sap,
- struct sap_info *si,
- struct sockaddr *from)
-{
- struct sap_entry *osap = NULL;
-
- FIXLEN(from);
- TRACE_SAP_ACTION("CHANGE FROM", sap);
- /*
- * If the hopcount (metric) is HOPCNT_INFINITY (16) it means that
- * a service has gone down. We should keep it like that for 30
- * seconds, so that it will get broadcast and then change to a
- * clone if one exist.
- */
- if (sap->clone && (ntohs(si->hops) != HOPCNT_INFINITY)) {
- /*
- * There are three possibilities:
- * 1. The new path is cheaper than the old one.
- * Free all the clones.
- *
- * 2. The new path is the same cost as the old ones.
- * If it is on the list of clones remove it
- * from the clone list and free it.
- *
- * 3. The new path is more expensive than the old one.
- * Use the values of the first clone and take it
- * out of the list, to be freed at the end.
- */
- osap = sap->clone;
- if (ntohs(osap->sap.hops) > ntohs(si->hops)) {
- struct sap_entry *nsap;
-
- while (osap) {
- nsap = osap->clone;
- TRACE_SAP_ACTION("DELETE", osap);
- free(osap);
- osap = nsap;
- }
- sap->clone = NULL;
- } else if (ntohs(osap->sap.hops) == ntohs(si->hops)) {
- struct sap_entry *psap;
-
- psap = sap;
- while (osap) {
- if (equal(&osap->source, from)) {
- psap->clone = osap->clone;
- TRACE_SAP_ACTION("DELETE", osap);
- free(osap);
- osap = psap->clone;
- } else {
- psap = osap;
- osap = osap->clone;
- }
- }
- } else {
- from = &osap->source;
- si = &osap->sap;
- sap->clone = osap->clone;
- }
- }
- sap->sap = *si;
- sap->source = *from;
- sap->ifp = if_ifwithnet(from);
- sap->state = RTS_CHANGED;
- if (ntohs(si->hops) == HOPCNT_INFINITY)
- sap->timer = EXPIRE_TIME;
- else
- sap->timer = 0;
-
- if (osap) {
- TRACE_SAP_ACTION("DELETE", osap);
- free(osap);
- }
- TRACE_SAP_ACTION("CHANGE TO", sap);
-}
-
-/*
- * Add a clone to the specified SAP entry. A clone is a different
- * route to the same service. We must know about them when we use
- * the split horizon algorithm.
- *
- * If the malloc fail, the entry will silently be thrown away.
- */
-void
-sap_add_clone(struct sap_entry *sap,
- struct sap_info *clone,
- struct sockaddr *from)
-{
- register struct sap_entry *nsap;
- register struct sap_entry *csap;
-
- if (ntohs(clone->hops) == HOPCNT_INFINITY)
- return;
-
- FIXLEN(from);
- nsap = malloc(sizeof(struct sap_entry));
- if (nsap == NULL)
- return;
-
- if (ftrace)
- fprintf(ftrace, "CLONE ADD %4.4X %s.\n",
- ntohs(clone->ServType),
- clone->ServName);
-
- nsap->sap = *clone;
- nsap->source = *from;
- nsap->clone = NULL;
- nsap->ifp = if_ifwithnet(from);
- nsap->state = RTS_CHANGED;
- nsap->timer = 0;
- nsap->hash = saphash(clone->ServType, clone->ServName);
-
- csap = sap;
- while (csap->clone)
- csap = csap->clone;
- csap->clone = nsap;
- TRACE_SAP_ACTION("ADD CLONE", nsap);
-}
-
-/*
- * Remove a SAP entry from the table and free the memory
- * used by it.
- *
- * If the service have clone, do a sap_change to it and free
- * the clone.
- */
-void
-sap_delete(struct sap_entry *sap)
-{
- if (sap->clone) {
- sap_change(sap, &sap->clone->sap, &sap->clone->source);
- return;
- }
- remque(sap);
- TRACE_SAP_ACTION("DELETE", sap);
- free(sap);
-}
diff --git a/usr.sbin/IPXrouted/startup.c b/usr.sbin/IPXrouted/startup.c
deleted file mode 100644
index 2b9ccfa..0000000
--- a/usr.sbin/IPXrouted/startup.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * This file includes significant work done at Cornell University by
- * Bill Nesheim. That work included by permission.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef lint
-static const char sccsid[] = "@(#)startup.c 8.1 (Berkeley) 6/5/93";
-#endif /* not lint */
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/sysctl.h>
-#include <sys/time.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-
-#include <errno.h>
-#include <nlist.h>
-#include <search.h>
-#include <stdlib.h>
-
-struct interface *ifnet;
-int lookforinterfaces = 1;
-int performnlist = 1;
-int gateway = 0;
-int externalinterfaces = 0; /* # of remote and local interfaces */
-
-void
-quit(s)
- char *s;
-{
- int sverrno = errno;
-
- (void) fprintf(stderr, "IPXroute: ");
- if (s)
- (void) fprintf(stderr, "%s: ", s);
- (void) fprintf(stderr, "%s\n", strerror(sverrno));
- exit(1);
- /* NOTREACHED */
-}
-
-struct rt_addrinfo info;
-/* XXX Sleazy use of local variables throughout file, warning!!!! */
-#define netmask info.rti_info[RTAX_NETMASK]
-#define ifaaddr info.rti_info[RTAX_IFA]
-#define brdaddr info.rti_info[RTAX_BRD]
-
-void
-rt_xaddrs(cp, cplim, rtinfo)
- register caddr_t cp, cplim;
- register struct rt_addrinfo *rtinfo;
-{
- register struct sockaddr *sa;
- register int i;
-
- bzero(rtinfo->rti_info, sizeof(rtinfo->rti_info));
- for (i = 0; (i < RTAX_MAX) && (cp < cplim); i++) {
- if ((rtinfo->rti_addrs & (1 << i)) == 0)
- continue;
- rtinfo->rti_info[i] = sa = (struct sockaddr *)cp;
- cp += SA_SIZE(sa);
- }
-}
-
-/*
- * Find the network interfaces which have configured themselves.
- * If the interface is present but not yet up (for example an
- * ARPANET IMP), set the lookforinterfaces flag so we'll
- * come back later and look again.
- */
-void
-ifinit(void)
-{
- struct interface ifs, *ifp;
- size_t needed;
- int mib[6], no_ipxaddr = 0, flags = 0;
- char *buf, *cplim, *cp;
- register struct if_msghdr *ifm;
- register struct ifa_msghdr *ifam;
- struct sockaddr_dl *sdl = 0;
-
- mib[0] = CTL_NET;
- mib[1] = PF_ROUTE;
- mib[2] = 0;
- mib[3] = AF_IPX;
- mib[4] = NET_RT_IFLIST;
- mib[5] = 0;
- if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
- quit("route-sysctl-estimate");
- if ((buf = malloc(needed)) == NULL)
- quit("malloc");
- if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
- lookforinterfaces = 0;
- cplim = buf + needed;
- for (cp = buf; cp < cplim; cp += ifm->ifm_msglen) {
- ifm = (struct if_msghdr *)cp;
- if (ifm->ifm_type == RTM_IFINFO) {
- bzero(&ifs, sizeof(ifs));
- ifs.int_flags = flags = ifm->ifm_flags | IFF_INTERFACE;
- if ((flags & IFF_UP) == 0 || no_ipxaddr)
- lookforinterfaces = 1;
- sdl = (struct sockaddr_dl *) (ifm + 1);
- sdl->sdl_data[sdl->sdl_nlen] = 0;
- no_ipxaddr = 1;
- continue;
- }
- if (ifm->ifm_type != RTM_NEWADDR)
- quit("ifinit: out of sync");
- if ((flags & IFF_UP) == 0)
- continue;
- ifam = (struct ifa_msghdr *)ifm;
- info.rti_addrs = ifam->ifam_addrs;
- rt_xaddrs((char *)(ifam + 1), cp + ifam->ifam_msglen, &info);
- if (ifaaddr == 0) {
- syslog(LOG_ERR, "%s: (get addr)", sdl->sdl_data);
- continue;
- }
- ifs.int_addr = *ifaaddr;
- if (ifs.int_addr.sa_family != AF_IPX)
- continue;
- no_ipxaddr = 0;
- if (ifs.int_flags & IFF_POINTOPOINT) {
- if (brdaddr == 0) {
- syslog(LOG_ERR, "%s: (get dstaddr)",
- sdl->sdl_data);
- continue;
- }
- if (brdaddr->sa_family == AF_UNSPEC) {
- lookforinterfaces = 1;
- continue;
- }
- ifs.int_dstaddr = *brdaddr;
- }
- if (ifs.int_flags & IFF_BROADCAST) {
- if (brdaddr == 0) {
- syslog(LOG_ERR, "%s: (get broadaddr)",
- sdl->sdl_data);
- continue;
- }
- ifs.int_dstaddr = *brdaddr;
- }
- if (ifs.int_flags & IFF_LOOPBACK) {
- ifs.int_dstaddr = ifs.int_addr;
- }
- /*
- * already known to us?
- * what makes a POINTOPOINT if unique is its dst addr,
- * NOT its source address
- */
- if ( ((ifs.int_flags & IFF_POINTOPOINT) &&
- if_ifwithdstaddr(&ifs.int_dstaddr)) ||
- ( ((ifs.int_flags & IFF_POINTOPOINT) == 0) &&
- if_ifwithaddr(&ifs.int_addr)))
- continue;
- ifp = (struct interface *)
- malloc(sdl->sdl_nlen + 1 + sizeof(ifs));
- if (ifp == 0) {
- syslog(LOG_ERR, "IPXrouted: out of memory\n");
- lookforinterfaces = 1;
- break;
- }
- *ifp = ifs;
- /*
- * Count the # of directly connected networks
- * and point to point links which aren't looped
- * back to ourself. This is used below to
- * decide if we should be a routing ``supplier''.
- */
- if ((ifs.int_flags & IFF_POINTOPOINT) == 0 ||
- if_ifwithaddr(&ifs.int_dstaddr) == 0)
- externalinterfaces++;
- /*
- * If we have a point-to-point link, we want to act
- * as a supplier even if it's our only interface,
- * as that's the only way our peer on the other end
- * can tell that the link is up.
- */
- if ((ifs.int_flags & IFF_POINTOPOINT) && supplier < 0)
- supplier = 1;
- ifp->int_name = (char *)(ifp + 1);
- strcpy(ifp->int_name, sdl->sdl_data);
-
- ifp->int_metric = ifam->ifam_metric;
- ifp->int_next = ifnet;
- ifnet = ifp;
- traceinit(ifp);
- addrouteforif(ifp);
- }
- if (externalinterfaces > 1 && supplier < 0)
- supplier = 1;
- free(buf);
-}
-
-void
-addrouteforif(ifp)
- struct interface *ifp;
-{
- struct sockaddr_ipx net;
- struct sockaddr *dst;
- struct rt_entry *rt;
-
- if (ifp->int_flags & IFF_POINTOPOINT) {
- int (*match)();
- register struct interface *ifp2 = ifnet;
-
- dst = &ifp->int_dstaddr;
-
- /* Search for interfaces with the same net */
- ifp->int_sq.n = ifp->int_sq.p = &(ifp->int_sq);
- match = afswitch[dst->sa_family].af_netmatch;
- if (match)
- for (ifp2 = ifnet; ifp2; ifp2 =ifp2->int_next) {
- if ((ifp->int_flags & IFF_POINTOPOINT) == 0)
- continue;
- if ((*match)(&ifp2->int_dstaddr,&ifp->int_dstaddr)) {
- insque(&ifp2->int_sq,&ifp->int_sq);
- break;
- }
- }
- } else {
- bzero(&net, sizeof(net));
- net.sipx_family = AF_IPX;
- net.sipx_len = sizeof (net);
- net.sipx_addr.x_net = satoipx_addr(ifp->int_broadaddr).x_net;
- dst = (struct sockaddr *)&net;
- }
- rt = rtlookup(dst);
- if (rt)
- rtdelete(rt);
- if (tracing)
- fprintf(stderr, "Adding route to interface %s\n", ifp->int_name);
- if (ifp->int_transitions++ > 0)
- syslog(LOG_ERR, "re-installing interface %s", ifp->int_name);
- rtadd(dst, &ifp->int_addr, ifp->int_metric, 0,
- ifp->int_flags & (IFF_INTERFACE|IFF_PASSIVE|IFF_REMOTE));
-}
-
diff --git a/usr.sbin/IPXrouted/table.h b/usr.sbin/IPXrouted/table.h
deleted file mode 100644
index 3f9693f..0000000
--- a/usr.sbin/IPXrouted/table.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)table.h 5.1 (Berkeley) 6/4/85 (routed/table.h)
- *
- * @(#)table.h 8.1 (Berkeley) 6/5/93
- *
- * $FreeBSD$
- */
-
-/*
- * Routing table management daemon.
- */
-
-/*
- * Routing table structure; differs a bit from kernel tables.
- *
- * Note: the union below must agree in the first 4 members
- * so the ioctl's will work.
- */
-struct rthash {
- struct rt_entry *rt_forw;
- struct rt_entry *rt_back;
-};
-
-#ifdef RTM_ADD
-#define rtentry ortentry
-#endif
-
-struct rt_entry {
- struct rt_entry *rt_forw;
- struct rt_entry *rt_back;
- union {
- struct rtentry rtu_rt;
- struct rtuentry {
- u_long rtu_hash;
- struct sockaddr rtu_dst;
- struct sockaddr rtu_router;
- short rtu_rtflags; /* used by old rtioctl */
- short rtu_wasted; /* XXX routed does it this way. */
- int rtu_flags;
- int rtu_state;
- int rtu_timer;
- int rtu_metric;
- int rtu_ticks;
- struct interface *rtu_ifp;
- } rtu_entry;
- } rt_rtu;
- struct rt_entry *rt_clone;
-};
-
-#define rt_rt rt_rtu.rtu_entry /* pass to ioctl */
-#define rt_hash rt_rtu.rtu_entry.rtu_hash /* for net or host */
-#define rt_dst rt_rtu.rtu_entry.rtu_dst /* match value */
-#define rt_router rt_rtu.rtu_entry.rtu_router /* who to forward to */
-#define rt_flags rt_rtu.rtu_entry.rtu_flags /* kernel flags */
-#define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */
-#define rt_state rt_rtu.rtu_entry.rtu_state /* see below */
-#define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */
-#define rt_ticks rt_rtu.rtu_entry.rtu_ticks /* time of route */
-#define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */
-
-#define ROUTEHASHSIZ 128 /* must be a power of 2 */
-#define ROUTEHASHMASK (ROUTEHASHSIZ - 1)
-
-/*
- * "State" of routing table entry.
- */
-#define RTS_CHANGED 0x1 /* route has been altered recently */
-#define RTS_PASSIVE IFF_PASSIVE /* don't time out route */
-#define RTS_INTERFACE IFF_INTERFACE /* route is for network interface */
-#define RTS_REMOTE IFF_REMOTE /* route is for ``remote'' entity */
-
-extern struct rthash nethash[ROUTEHASHSIZ];
-struct rt_entry *rtlookup(struct sockaddr *);
-struct rt_entry *rtfind(struct sockaddr *);
-void rtadd(struct sockaddr *, struct sockaddr *, short, short, int);
-void rtadd_clone(struct rt_entry *, struct sockaddr *, struct sockaddr *,
- short, short, int);
-void rtchange(struct rt_entry *, struct sockaddr *, short, short);
-void rtdelete(struct rt_entry *);
-int rtioctl(int, struct rtuentry *);
-void rtinit(void);
-
diff --git a/usr.sbin/IPXrouted/tables.c b/usr.sbin/IPXrouted/tables.c
deleted file mode 100644
index aebc792..0000000
--- a/usr.sbin/IPXrouted/tables.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef lint
-static const char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 6/5/93";
-#endif /* not lint */
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <search.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#ifndef DEBUG
-#define DEBUG 0
-#endif
-
-#define FIXLEN(s) { if ((s)->sa_len == 0) (s)->sa_len = sizeof (*(s));}
-
-int install = !DEBUG; /* if 1 call kernel */
-int delete = 1;
-
-struct rthash nethash[ROUTEHASHSIZ];
-
-/*
- * Lookup dst in the tables for an exact match.
- */
-struct rt_entry *
-rtlookup(struct sockaddr *dst)
-{
- register struct rt_entry *rt;
- register struct rthash *rh;
- register u_int hash;
- struct afhash h;
-
- if (dst->sa_family >= AF_MAX)
- return (0);
- (*afswitch[dst->sa_family].af_hash)(dst, &h);
- hash = h.afh_nethash;
- rh = &nethash[hash & ROUTEHASHMASK];
- for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
- if (rt->rt_hash != hash)
- continue;
- if (equal(&rt->rt_dst, dst))
- return (rt);
- }
- return (0);
-}
-
-/*
- * Find a route to dst as the kernel would.
- */
-struct rt_entry *
-rtfind(struct sockaddr *dst)
-{
- register struct rt_entry *rt;
- register struct rthash *rh;
- register u_int hash;
- struct afhash h;
- int af = dst->sa_family;
- int (*match)() = 0;
-
- if (af >= AF_MAX)
- return (0);
- (*afswitch[af].af_hash)(dst, &h);
-
- hash = h.afh_nethash;
- rh = &nethash[hash & ROUTEHASHMASK];
- match = afswitch[af].af_netmatch;
- for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
- if (rt->rt_hash != hash)
- continue;
- if (rt->rt_dst.sa_family == af &&
- (*match)(&rt->rt_dst, dst))
- return (rt);
- }
- return (0);
-}
-
-void
-rtadd(struct sockaddr *dst, struct sockaddr *gate, short metric,
- short ticks, int state)
-{
- struct afhash h;
- register struct rt_entry *rt;
- struct rthash *rh;
- int af = dst->sa_family, flags;
- u_int hash;
-
- FIXLEN(dst);
- FIXLEN(gate);
- if (af >= AF_MAX)
- return;
- (*afswitch[af].af_hash)(dst, &h);
- flags = (*afswitch[af].af_ishost)(dst) ? RTF_HOST : 0;
- hash = h.afh_nethash;
- rh = &nethash[hash & ROUTEHASHMASK];
- rt = (struct rt_entry *)malloc(sizeof (*rt));
- if (rt == 0)
- return;
- rt->rt_hash = hash;
- rt->rt_dst = *dst;
- rt->rt_router = *gate;
- rt->rt_metric = metric;
- rt->rt_ticks = ticks;
- rt->rt_timer = 0;
- rt->rt_flags = RTF_UP | flags;
- rt->rt_state = state | RTS_CHANGED;
- rt->rt_ifp = if_ifwithnet(&rt->rt_router);
- rt->rt_clone = NULL;
- if (metric)
- rt->rt_flags |= RTF_GATEWAY;
- insque(rt, rh);
- TRACE_ACTION("ADD", rt);
- /*
- * If the ioctl fails because the gateway is unreachable
- * from this host, discard the entry. This should only
- * occur because of an incorrect entry in /etc/gateways.
- */
- if (install && rtioctl(ADD, &rt->rt_rt) < 0) {
- if (errno != EEXIST)
- perror("SIOCADDRT");
- if (errno == ENETUNREACH) {
- TRACE_ACTION("DELETE", rt);
- remque(rt);
- free((char *)rt);
- }
- }
-}
-
-void
-rtadd_clone(struct rt_entry *ort, struct sockaddr *dst,
- struct sockaddr *gate, short metric, short ticks, int state)
-{
- struct afhash h;
- register struct rt_entry *rt;
- int af = dst->sa_family, flags;
- u_int hash;
-
- FIXLEN(dst);
- FIXLEN(gate);
- if (af >= AF_MAX)
- return;
- (*afswitch[af].af_hash)(dst, &h);
- flags = (*afswitch[af].af_ishost)(dst) ? RTF_HOST : 0;
- hash = h.afh_nethash;
- rt = (struct rt_entry *)malloc(sizeof (*rt));
- if (rt == 0)
- return;
- rt->rt_hash = hash;
- rt->rt_dst = *dst;
- rt->rt_router = *gate;
- rt->rt_metric = metric;
- rt->rt_ticks = ticks;
- rt->rt_timer = 0;
- rt->rt_flags = RTF_UP | flags;
- rt->rt_state = state | RTS_CHANGED;
- rt->rt_ifp = if_ifwithnet(&rt->rt_router);
- rt->rt_clone = NULL;
- rt->rt_forw = NULL;
- rt->rt_back = NULL;
- if (metric)
- rt->rt_flags |= RTF_GATEWAY;
-
- while(ort->rt_clone != NULL)
- ort = ort->rt_clone;
- ort->rt_clone = rt;
- TRACE_ACTION("ADD_CLONE", rt);
-}
-
-void
-rtchange(struct rt_entry *rt, struct sockaddr *gate, short metric,
- short ticks)
-{
- int doioctl = 0, metricchanged = 0;
-
- FIXLEN(gate);
- /*
- * Handling of clones.
- * When the route changed and it had clones, handle it special.
- * 1. If the new route is cheaper than the clone(s), free the clones.
- * 2. If the new route is the same cost, it may be one of the clones,
- * search for it and free it.
- * 3. If the new route is more expensive than the clone(s), use the
- * values of the clone(s).
- */
- if (rt->rt_clone) {
- if ((ticks < rt->rt_clone->rt_ticks) ||
- ((ticks == rt->rt_clone->rt_ticks) &&
- (metric < rt->rt_clone->rt_metric))) {
- /*
- * Free all clones.
- */
- struct rt_entry *trt, *nrt;
-
- trt = rt->rt_clone;
- rt->rt_clone = NULL;
- while(trt) {
- nrt = trt->rt_clone;
- free((char *)trt);
- trt = nrt;
- }
- } else if ((ticks == rt->rt_clone->rt_ticks) &&
- (metric == rt->rt_clone->rt_metric)) {
- struct rt_entry *prt, *trt;
-
- prt = rt;
- trt = rt->rt_clone;
-
- while(trt) {
- if (equal(&trt->rt_router, gate)) {
- prt->rt_clone = trt->rt_clone;
- free(trt);
- trt = prt->rt_clone;
- } else {
- prt = trt;
- trt = trt->rt_clone;
- }
- }
- } else {
- /*
- * Use the values of the first clone.
- * Delete the corresponding clone.
- */
- struct rt_entry *trt;
-
- trt = rt->rt_clone;
- rt->rt_clone = rt->rt_clone->rt_clone;
- metric = trt->rt_metric;
- ticks = trt->rt_ticks;
- *gate = trt->rt_router;
- free((char *)trt);
- }
- }
-
- if (!equal(&rt->rt_router, gate))
- doioctl++;
- if ((metric != rt->rt_metric) || (ticks != rt->rt_ticks))
- metricchanged++;
- if (doioctl || metricchanged) {
- TRACE_ACTION("CHANGE FROM", rt);
- if (doioctl) {
- rt->rt_router = *gate;
- }
- rt->rt_metric = metric;
- rt->rt_ticks = ticks;
- if ((rt->rt_state & RTS_INTERFACE) && metric) {
- rt->rt_state &= ~RTS_INTERFACE;
- if(rt->rt_ifp)
- syslog(LOG_ERR,
- "changing route from interface %s (timed out)",
- rt->rt_ifp->int_name);
- else
- syslog(LOG_ERR,
- "changing route from interface ??? (timed out)");
- }
- if (metric)
- rt->rt_flags |= RTF_GATEWAY;
- else
- rt->rt_flags &= ~RTF_GATEWAY;
- rt->rt_ifp = if_ifwithnet(&rt->rt_router);
- rt->rt_state |= RTS_CHANGED;
- TRACE_ACTION("CHANGE TO", rt);
- }
- if (doioctl && install) {
-#ifndef RTM_ADD
- if (rtioctl(ADD, &rt->rt_rt) < 0)
- syslog(LOG_ERR, "rtioctl ADD dst %s, gw %s: %m",
- ipx_ntoa(&((struct sockaddr_ipx *)&rt->rt_dst)->sipx_addr),
- ipx_ntoa(&((struct sockaddr_ipx *)&rt->rt_router)->sipx_addr));
- if (delete && rtioctl(DELETE, &oldroute) < 0)
- perror("rtioctl DELETE");
-#else
- if (delete == 0) {
- if (rtioctl(ADD, &rt->rt_rt) >= 0)
- return;
- } else {
- if (rtioctl(CHANGE, &rt->rt_rt) >= 0)
- return;
- }
- syslog(LOG_ERR, "rtioctl ADD dst %s, gw %s: %m",
- ipxdp_ntoa(&((struct sockaddr_ipx *)&rt->rt_dst)->sipx_addr),
- ipxdp_ntoa(&((struct sockaddr_ipx *)&rt->rt_router)->sipx_addr));
-#endif
- }
-}
-
-void
-rtdelete(struct rt_entry *rt)
-{
-
- struct sockaddr *sa = &(rt->rt_router);
- FIXLEN(sa);
- sa = &(rt->rt_dst);
- FIXLEN(sa);
- if (rt->rt_clone) {
- /*
- * If there is a clone we just do a rt_change to it.
- */
- struct rt_entry *trt = rt->rt_clone;
- rtchange(rt, &trt->rt_router, trt->rt_metric, trt->rt_ticks);
- return;
- }
- if (rt->rt_state & RTS_INTERFACE) {
- if (rt->rt_ifp)
- syslog(LOG_ERR,
- "deleting route to interface %s (timed out)",
- rt->rt_ifp->int_name);
- else
- syslog(LOG_ERR,
- "deleting route to interface ??? (timed out)");
- }
- TRACE_ACTION("DELETE", rt);
- if (install && rtioctl(DELETE, &rt->rt_rt) < 0)
- perror("rtioctl DELETE");
- remque(rt);
- free((char *)rt);
-}
-
-void
-rtinit(void)
-{
- register struct rthash *rh;
-
- for (rh = nethash; rh < &nethash[ROUTEHASHSIZ]; rh++)
- rh->rt_forw = rh->rt_back = (struct rt_entry *)rh;
-}
-int seqno;
-
-int
-rtioctl(int action, struct rtuentry *ort)
-{
-#ifndef RTM_ADD
- if (install == 0)
- return (errno = 0);
-
- ort->rtu_rtflags = ort->rtu_flags;
-
- switch (action) {
-
- case ADD:
- return (ioctl(s, SIOCADDRT, (char *)ort));
-
- case DELETE:
- return (ioctl(s, SIOCDELRT, (char *)ort));
-
- default:
- return (-1);
- }
-#else /* RTM_ADD */
- struct {
- struct rt_msghdr w_rtm;
- struct sockaddr w_dst;
- struct sockaddr w_gate;
- struct sockaddr_ipx w_netmask;
- } w;
-#define rtm w.w_rtm
-
- bzero((char *)&w, sizeof(w));
- rtm.rtm_msglen = sizeof(w);
- rtm.rtm_version = RTM_VERSION;
- rtm.rtm_type = (action == ADD ? RTM_ADD :
- (action == DELETE ? RTM_DELETE : RTM_CHANGE));
- rtm.rtm_flags = ort->rtu_flags;
- rtm.rtm_seq = ++seqno;
- rtm.rtm_addrs = RTA_DST|RTA_GATEWAY;
- bcopy((char *)&ort->rtu_dst, (char *)&w.w_dst, sizeof(w.w_dst));
- bcopy((char *)&ort->rtu_router, (char *)&w.w_gate, sizeof(w.w_gate));
- w.w_gate.sa_family = w.w_dst.sa_family = AF_IPX;
- w.w_gate.sa_len = w.w_dst.sa_len = sizeof(w.w_dst);
- if (rtm.rtm_flags & RTF_HOST) {
- rtm.rtm_msglen -= sizeof(w.w_netmask);
- } else {
- rtm.rtm_addrs |= RTA_NETMASK;
- w.w_netmask = ipx_netmask;
- rtm.rtm_msglen -= sizeof(w.w_netmask) - ipx_netmask.sipx_len;
- }
- errno = 0;
- return write(r, (char *)&w, rtm.rtm_msglen);
-#endif /* RTM_ADD */
-}
diff --git a/usr.sbin/IPXrouted/timer.c b/usr.sbin/IPXrouted/timer.c
deleted file mode 100644
index 2159730..0000000
--- a/usr.sbin/IPXrouted/timer.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * This file includes significant work done at Cornell University by
- * Bill Nesheim. That work included by permission.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef lint
-static const char sccsid[] = "@(#)timer.c 8.1 (Berkeley) 6/5/93";
-#endif /* not lint */
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-#include <unistd.h>
-#include <stdlib.h>
-
-int timeval = -TIMER_RATE;
-
-/*
- * Timer routine. Performs routing information supply
- * duties and manages timers on routing and SAP table entries.
- */
-void
-timer()
-{
- register struct rthash *rh;
- register struct rt_entry *rt;
- register struct sap_hash *sh;
- register struct sap_entry *sap;
- struct sap_hash *sap_base = sap_head;
- int timetobroadcast, ripbroadcast, sapbroadcast;
-
- timeval += TIMER_RATE;
- if (lookforinterfaces && (timeval % CHECK_INTERVAL) == 0)
- ifinit();
- timetobroadcast = supplier && (timeval % SUPPLY_INTERVAL) == 0;
- ripbroadcast = supplier && timetobroadcast &&
- (timeval % RIP_INTERVAL) == 0;
- sapbroadcast = timetobroadcast && dosap && !ripbroadcast;
-
- for (rh = nethash; rh < &nethash[ROUTEHASHSIZ]; rh++) {
- rt = rh->rt_forw;
- for (; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
- if (rt->rt_clone) {
- struct rt_entry *trt, *prt;
- /*
- * If a clone expire free it and mark the
- * main route RTS_CHANGED.
- */
- prt = rt;
- trt = rt->rt_clone;
- while (trt) {
- trt->rt_timer += TIMER_RATE;
- if (trt->rt_timer >= EXPIRE_TIME) {
- prt->rt_clone = trt->rt_clone;
- free((char *)trt);
- trt = prt->rt_clone;
- rt->rt_state |= RTS_CHANGED;
- } else {
- prt = trt;
- trt = prt->rt_clone;
- }
- }
- }
- /*
- * We don't advance time on a routing entry for
- * a passive gateway or that for our only interface.
- * The latter is excused because we don't act as
- * a routing information supplier and hence would
- * time it out. This is fair as if it's down
- * we're cut off from the world anyway and it's
- * not likely we'll grow any new hardware in
- * the mean time.
- */
- if (!(rt->rt_state & RTS_PASSIVE) &&
- !(rt->rt_state & RTS_INTERFACE))
- rt->rt_timer += TIMER_RATE;
- if (rt->rt_timer >= EXPIRE_TIME) {
- rt->rt_metric = HOPCNT_INFINITY;
- rt->rt_state |= RTS_CHANGED;
- }
- if (rt->rt_timer >= GARBAGE_TIME) {
- rt = rt->rt_back;
- /* Perhaps we should send a REQUEST for this route? */
- rtdelete(rt->rt_forw);
- continue;
- }
- if (rt->rt_state & RTS_CHANGED) {
- rt->rt_state &= ~RTS_CHANGED;
- /* don't send extraneous packets */
- if (!supplier || ripbroadcast)
- continue;
- if ((rt->rt_metric + 1) == HOPCNT_INFINITY)
- continue;
- msg->rip_cmd = htons(RIPCMD_RESPONSE);
- msg->rip_nets[0].rip_dst =
- (satoipx_addr(rt->rt_dst)).x_net;
- msg->rip_nets[0].rip_metric =
- htons(min(rt->rt_metric+1, HOPCNT_INFINITY));
- msg->rip_nets[0].rip_ticks =
- htons(rt->rt_ticks + 1);
- toall(sndmsg, rt, 0);
- }
- }
- }
- if (ripbroadcast)
- toall(supply, NULL, 0);
-
- /*
- * Now do the SAP stuff.
- */
- for (sh = sap_base; sh < &sap_base[SAPHASHSIZ]; sh++) {
- sap = sh->forw;
- for (; sap != (struct sap_entry *)sh; sap = sap->forw) {
- if (sap->clone) {
- struct sap_entry *tsap, *psap;
- /*
- * If a clone expire free it and mark the
- * main sap entry RTS_CHANGED.
- */
- psap = sap;
- tsap = sap->clone;
- while (tsap) {
- tsap->timer += TIMER_RATE;
- if (tsap->timer >= EXPIRE_TIME) {
- psap->clone = tsap->clone;
- free((char *)tsap);
- tsap = psap->clone;
- sap->state |= RTS_CHANGED;
- } else {
- psap = tsap;
- tsap = psap->clone;
- }
- }
- }
- sap->timer += TIMER_RATE;
- if (sap->timer >= EXPIRE_TIME) {
- sap->sap.hops = htons(HOPCNT_INFINITY);
- sap->state |= RTS_CHANGED;
- }
- if (sap->timer >= GARBAGE_TIME) {
- sap = sap->back;
- /* Perhaps we should send a REQUEST for this route? */
- sap_delete(sap->forw);
- continue;
- }
- /*
- * XXX sap_sndmsg on RTS_CHANGED
- */
- if (sap->state & RTS_CHANGED) {
- sap->state &= ~RTS_CHANGED;
-#ifdef notyet
- /* don't send extraneous packets */
- if (!supplier || sapbroadcast)
- continue;
- if ((ntohs(sap->sap.hops) + 1) == HOPCNT_INFINITY)
- continue;
- sap_msg->sap_cmd = htons(SAP_RESP);
- sap_msg->sap[0] = sap->sap;
- sap_msg->sap[0].hops =
- htons(min(sap->sap.hops+1, HOPCNT_INFINITY));
- toall(sapsndmsg, rt, 0);
-#endif
- }
- }
- }
- if (sapbroadcast)
- sap_supply_toall(0);
- if (ftrace && sapbroadcast)
- dumpsaptable(ftrace, sap_head);
-}
-
-/*
- * On hangup, let everyone know we're going away.
- */
-void
-hup()
-{
- register struct rthash *rh;
- register struct rt_entry *rt;
- register struct sap_hash *sh;
- register struct sap_entry *sap;
-
- if (supplier) {
- for (rh = nethash; rh < &nethash[ROUTEHASHSIZ]; rh++) {
- rt = rh->rt_forw;
- for (; rt != (struct rt_entry *)rh; rt = rt->rt_forw)
- rt->rt_metric = HOPCNT_INFINITY;
- }
- toall(supply, NULL, 0);
-
- /*
- * Now for SAP.
- */
- for (sh = sap_head; sh < &sap_head[SAPHASHSIZ]; sh++) {
- sap = sh->forw;
- for (; sap != (struct sap_entry *)sh; sap = sap->forw)
- sap->sap.hops = htons(HOPCNT_INFINITY);
- }
- if (dosap)
- sap_supply_toall(0);
- }
- exit(1);
-}
diff --git a/usr.sbin/IPXrouted/trace.c b/usr.sbin/IPXrouted/trace.c
deleted file mode 100644
index d9e74b8..0000000
--- a/usr.sbin/IPXrouted/trace.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * This file includes significant work done at Cornell University by
- * Bill Nesheim. That work included by permission.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)trace.c 8.1 (Berkeley) 6/5/93";
-#endif
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
-/*
- * Routing Table Management Daemon
- */
-#define RIPCMDS
-#define SAPCMDS
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <time.h>
-#include "defs.h"
-
-#define NRECORDS 50 /* size of circular trace buffer */
-#ifdef DEBUG
-FILE *ftrace = stdout;
-int tracing = 1;
-#else /* DEBUG */
-FILE *ftrace = NULL;
-int tracing = 0;
-#endif
-
-void dumpif(FILE *fd, struct interface *ifp);
-void dumptrace(FILE *fd, char *dir, struct ifdebug *ifd);
-static int iftraceinit(struct interface *ifp, struct ifdebug *ifd);
-
-void
-traceinit(ifp)
- register struct interface *ifp;
-{
- if (iftraceinit(ifp, &ifp->int_input) &&
- iftraceinit(ifp, &ifp->int_output))
- return;
- tracing = 0;
- syslog(LOG_ERR, "traceinit: can't init %s\n", ifp->int_name);
-}
-
-static int
-iftraceinit(ifp, ifd)
- struct interface *ifp;
- register struct ifdebug *ifd;
-{
- register struct iftrace *t;
-
- ifd->ifd_records =
- (struct iftrace *)malloc(NRECORDS * sizeof (struct iftrace));
- if (ifd->ifd_records == 0)
- return (0);
- ifd->ifd_front = ifd->ifd_records;
- ifd->ifd_count = 0;
- for (t = ifd->ifd_records; t < ifd->ifd_records + NRECORDS; t++) {
- t->ift_size = 0;
- t->ift_packet = 0;
- }
- ifd->ifd_if = ifp;
- return (1);
-}
-
-void
-traceon(file)
- char *file;
-{
-
- if (ftrace != NULL)
- return;
- ftrace = fopen(file, "a");
- if (ftrace == NULL)
- return;
- dup2(fileno(ftrace), 1);
- dup2(fileno(ftrace), 2);
- tracing = 1;
-}
-
-void
-traceoff(void)
-{
- if (!tracing)
- return;
- if (ftrace != NULL)
- fclose(ftrace);
- ftrace = NULL;
- tracing = 0;
-}
-
-void
-trace(ifd, who, p, len, m)
- register struct ifdebug *ifd;
- struct sockaddr *who;
- char *p;
- int len, m;
-{
- register struct iftrace *t;
-
- if (ifd->ifd_records == 0)
- return;
- t = ifd->ifd_front++;
- if (ifd->ifd_front >= ifd->ifd_records + NRECORDS)
- ifd->ifd_front = ifd->ifd_records;
- if (ifd->ifd_count < NRECORDS)
- ifd->ifd_count++;
- if (t->ift_size > 0 && t->ift_packet)
- free(t->ift_packet);
- t->ift_packet = 0;
- t->ift_stamp = time(0);
- t->ift_who = *who;
- if (len > 0) {
- t->ift_packet = malloc(len);
- if (t->ift_packet)
- bcopy(p, t->ift_packet, len);
- else
- len = 0;
- }
- t->ift_size = len;
- t->ift_metric = m;
-}
-
-void
-traceaction(fd, action, rt)
- FILE *fd;
- char *action;
- struct rt_entry *rt;
-{
- struct sockaddr_ipx *dst, *gate;
- static struct bits {
- int t_bits;
- char *t_name;
- } flagbits[] = {
- { RTF_UP, "UP" },
- { RTF_GATEWAY, "GATEWAY" },
- { RTF_HOST, "HOST" },
- { 0 }
- }, statebits[] = {
- { RTS_PASSIVE, "PASSIVE" },
- { RTS_REMOTE, "REMOTE" },
- { RTS_INTERFACE,"INTERFACE" },
- { RTS_CHANGED, "CHANGED" },
- { 0 }
- };
- register struct bits *p;
- register int first;
- char *cp;
-
- if (fd == NULL)
- return;
- fprintf(fd, "%s ", action);
- dst = (struct sockaddr_ipx *)&rt->rt_dst;
- gate = (struct sockaddr_ipx *)&rt->rt_router;
- fprintf(fd, "dst %s, ", ipxdp_ntoa(&dst->sipx_addr));
- fprintf(fd, "router %s, metric %d, ticks %d, flags",
- ipxdp_ntoa(&gate->sipx_addr), rt->rt_metric, rt->rt_ticks);
- cp = " %s";
- for (first = 1, p = flagbits; p->t_bits > 0; p++) {
- if ((rt->rt_flags & p->t_bits) == 0)
- continue;
- fprintf(fd, cp, p->t_name);
- if (first) {
- cp = "|%s";
- first = 0;
- }
- }
- fprintf(fd, " state");
- cp = " %s";
- for (first = 1, p = statebits; p->t_bits > 0; p++) {
- if ((rt->rt_state & p->t_bits) == 0)
- continue;
- fprintf(fd, cp, p->t_name);
- if (first) {
- cp = "|%s";
- first = 0;
- }
- }
- putc('\n', fd);
- if (!tracepackets && (rt->rt_state & RTS_PASSIVE) == 0 && rt->rt_ifp)
- dumpif(fd, rt->rt_ifp);
- fflush(fd);
-}
-
-void
-traceactionlog(action, rt)
- char *action;
- struct rt_entry *rt;
-{
- struct sockaddr_ipx *dst, *gate;
- static struct bits {
- int t_bits;
- char *t_name;
- } flagbits[] = {
- { RTF_UP, "UP" },
- { RTF_GATEWAY, "GATEWAY" },
- { RTF_HOST, "HOST" },
- { 0 }
- }, statebits[] = {
- { RTS_PASSIVE, "PASSIVE" },
- { RTS_REMOTE, "REMOTE" },
- { RTS_INTERFACE,"INTERFACE" },
- { RTS_CHANGED, "CHANGED" },
- { 0 }
- };
- register struct bits *p;
- register int first;
- char *cp;
- char *lstr, *olstr;
-
- dst = (struct sockaddr_ipx *)&rt->rt_dst;
- gate = (struct sockaddr_ipx *)&rt->rt_router;
- asprintf(&lstr, "%s dst %s,", action, ipxdp_ntoa(&dst->sipx_addr));
- olstr = lstr;
- asprintf(&lstr, "%s router %s, metric %d, ticks %d, flags",
- olstr, ipxdp_ntoa(&gate->sipx_addr), rt->rt_metric, rt->rt_ticks);
- free(olstr);
- olstr = lstr;
- cp = "%s %s";
- for (first = 1, p = flagbits; p->t_bits > 0; p++) {
- if ((rt->rt_flags & p->t_bits) == 0)
- continue;
- asprintf(&lstr, cp, olstr, p->t_name);
- free(olstr);
- olstr = lstr;
- if (first) {
- cp = "%s|%s";
- first = 0;
- }
- }
- asprintf(&lstr, "%s state", olstr);
- free(olstr);
- olstr = lstr;
- cp = "%s %s";
- for (first = 1, p = statebits; p->t_bits > 0; p++) {
- if ((rt->rt_state & p->t_bits) == 0)
- continue;
- asprintf(&lstr, cp, olstr, p->t_name);
- free(olstr);
- olstr = lstr;
- if (first) {
- cp = "%s|%s";
- first = 0;
- }
- }
- syslog(LOG_DEBUG, "%s", lstr);
- free(lstr);
-}
-
-void
-tracesapactionlog(action, sap)
- char *action;
- struct sap_entry *sap;
-{
- syslog(LOG_DEBUG, "%-12.12s service %04X %-20.20s "
- "addr %s.%04X %c metric %d\n",
- action,
- ntohs(sap->sap.ServType),
- sap->sap.ServName,
- ipxdp_ntoa(&sap->sap.ipx),
- ntohs(sap->sap.ipx.x_port),
- (sap->clone ? 'C' : ' '),
- ntohs(sap->sap.hops));
-}
-
-void
-dumpif(fd, ifp)
- register struct interface *ifp;
- FILE *fd;
-{
- if (ifp->int_input.ifd_count || ifp->int_output.ifd_count) {
- fprintf(fd, "*** Packet history for interface %s ***\n",
- ifp->int_name);
- dumptrace(fd, "to", &ifp->int_output);
- dumptrace(fd, "from", &ifp->int_input);
- fprintf(fd, "*** end packet history ***\n");
- }
-}
-
-void
-dumptrace(fd, dir, ifd)
- FILE *fd;
- char *dir;
- register struct ifdebug *ifd;
-{
- register struct iftrace *t;
- char *cp = !strcmp(dir, "to") ? "Output" : "Input";
-
- if (ifd->ifd_front == ifd->ifd_records &&
- ifd->ifd_front->ift_size == 0) {
- fprintf(fd, "%s: no packets.\n", cp);
- return;
- }
- fprintf(fd, "%s trace:\n", cp);
- t = ifd->ifd_front - ifd->ifd_count;
- if (t < ifd->ifd_records)
- t += NRECORDS;
- for ( ; ifd->ifd_count; ifd->ifd_count--, t++) {
- if (t >= ifd->ifd_records + NRECORDS)
- t = ifd->ifd_records;
- if (t->ift_size == 0)
- continue;
- fprintf(fd, "%.24s: metric=%d\n", ctime(&t->ift_stamp),
- t->ift_metric);
- dumppacket(fd, dir, &t->ift_who, t->ift_packet, t->ift_size);
- }
-}
-
-void
-dumppacket(fd, dir, source, cp, size)
- FILE *fd;
- char *dir;
- struct sockaddr *source;
- char *cp;
- register int size;
-{
- register struct rip *msg = (struct rip *)cp;
- register struct netinfo *n;
- struct sockaddr_ipx *who = (struct sockaddr_ipx *)source;
-
- if (msg->rip_cmd && ntohs(msg->rip_cmd) < RIPCMD_MAX)
- fprintf(fd, "%s %s %s#%x", ripcmds[ntohs(msg->rip_cmd)],
- dir, ipxdp_ntoa(&who->sipx_addr),
- ntohs(who->sipx_addr.x_port));
- else {
- fprintf(fd, "Bad cmd 0x%x %s %s#%x\n", ntohs(msg->rip_cmd),
- dir, ipxdp_ntoa(&who->sipx_addr),
- ntohs(who->sipx_addr.x_port));
- fprintf(fd, "size=%d cp=%p packet=%p\n", size,
- cp, packet);
- return;
- }
- switch (ntohs(msg->rip_cmd)) {
-
- case RIPCMD_REQUEST:
- case RIPCMD_RESPONSE:
- fprintf(fd, ":\n");
- size -= sizeof (u_short);
- n = msg->rip_nets;
- for (; size > 0; n++, size -= sizeof (struct netinfo)) {
- if (size < sizeof (struct netinfo))
- break;
- fprintf(fd, "\tnet %s metric %d ticks %d\n",
- ipxdp_nettoa(n->rip_dst),
- ntohs(n->rip_metric),
- ntohs(n->rip_ticks));
- }
- break;
-
- }
-}
-
-void
-dumpsappacket(fd, dir, source, cp, size)
- FILE *fd;
- char *dir;
- struct sockaddr *source;
- char *cp;
- register int size;
-{
- register struct sap_packet *msg = (struct sap_packet *)cp;
- register struct sap_info *n;
- struct sockaddr_ipx *who = (struct sockaddr_ipx *)source;
-
- if (msg->sap_cmd && ntohs(msg->sap_cmd) < SAPCMD_MAX)
- fprintf(fd, "%s %s %s#%x", sapcmds[ntohs(msg->sap_cmd)],
- dir, ipxdp_ntoa(&who->sipx_addr),
- ntohs(who->sipx_addr.x_port));
- else {
- fprintf(fd, "Bad cmd 0x%x %s %s#%x\n", ntohs(msg->sap_cmd),
- dir, ipxdp_ntoa(&who->sipx_addr),
- ntohs(who->sipx_addr.x_port));
- fprintf(fd, "size=%d cp=%p packet=%p\n", size,
- cp, packet);
- return;
- }
- switch (ntohs(msg->sap_cmd)) {
-
- case SAP_REQ:
- case SAP_RESP:
- case SAP_REQ_NEAR:
- case SAP_RESP_NEAR:
- fprintf(fd, ":\n");
- size -= sizeof (u_short);
- n = msg->sap;
- for (; size > 0; n++, size -= sizeof (struct sap_info)) {
- if (size < sizeof (struct sap_info))
- break;
- fprintf(fd, " service %04X %-20.20s "
- "addr %s.%04X metric %d\n",
- ntohs(n->ServType),
- n->ServName,
- ipxdp_ntoa(&n->ipx),
- ntohs(n->ipx.x_port),
- ntohs(n->hops));
- }
- break;
-
- }
-}
-
-void
-dumpsaptable(fd, sh)
- FILE *fd;
- struct sap_hash *sh;
-{
- register struct sap_entry *sap;
- struct sap_hash *hash;
- int x = 0;
-
- fprintf(fd, "------- SAP table dump. -------\n");
- for (hash = sh; hash < &sh[SAPHASHSIZ]; hash++, x++) {
- fprintf(fd, "HASH %d\n", x);
- sap = hash->forw;
- for (; sap != (struct sap_entry *)hash; sap = sap->forw) {
- fprintf(fd, " service %04X %-20.20s "
- "addr %s.%04X %c metric %d\n",
- ntohs(sap->sap.ServType),
- sap->sap.ServName,
- ipxdp_ntoa(&sap->sap.ipx),
- ntohs(sap->sap.ipx.x_port),
- (sap->clone ? 'C' : ' '),
- ntohs(sap->sap.hops));
- }
- }
- fprintf(fd, "\n");
-}
-
-void
-dumpriptable(fd)
- FILE *fd;
-{
- register struct rt_entry *rip;
- struct rthash *hash;
- int x;
- struct rthash *rh = nethash;
-
- fprintf(fd, "------- RIP table dump. -------\n");
- x = 0;
- fprintf(fd, "Network table.\n");
-
- for (hash = rh; hash < &rh[ROUTEHASHSIZ]; hash++, x++) {
- fprintf(fd, "HASH %d\n", x);
- rip = hash->rt_forw;
- for (; rip != (struct rt_entry *)hash; rip = rip->rt_forw) {
- fprintf(fd, " dest %s\t",
- ipxdp_ntoa(&satoipx_addr(rip->rt_dst)));
- fprintf(fd, "%s metric %d, ticks %d\n",
- ipxdp_ntoa(&satoipx_addr(rip->rt_router)),
- rip->rt_metric,
- rip->rt_ticks);
- }
- }
- fprintf(fd, "\n");
-}
-
-union ipx_net_u net;
-
-char *
-ipxdp_nettoa(val)
-union ipx_net val;
-{
- static char buf[100];
- net.net_e = val;
- (void)sprintf(buf, "%u", ntohl(net.long_e));
- return (buf);
-}
-
-
-char *
-ipxdp_ntoa(addr)
-struct ipx_addr *addr;
-{
- static char buf[100];
-
- (void)sprintf(buf, "%s#%x:%x:%x:%x:%x:%x",
- ipxdp_nettoa(addr->x_net),
- addr->x_host.c_host[0], addr->x_host.c_host[1],
- addr->x_host.c_host[2], addr->x_host.c_host[3],
- addr->x_host.c_host[4], addr->x_host.c_host[5]);
-
- return(buf);
-}
diff --git a/usr.sbin/IPXrouted/trace.h b/usr.sbin/IPXrouted/trace.h
deleted file mode 100644
index c83a9d1..0000000
--- a/usr.sbin/IPXrouted/trace.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Copyright (c) 1995 John Hay. All rights reserved.
- *
- * This file includes significant work done at Cornell University by
- * Bill Nesheim. That work included by permission.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)trace.h 8.1 (Berkeley) 6/5/93
- *
- * $FreeBSD$
- */
-
-/*
- * IPX Routing Information Protocol.
- */
-
-/*
- * Trace record format.
- */
-struct iftrace {
- time_t ift_stamp; /* time stamp */
- struct sockaddr ift_who; /* from/to */
- char *ift_packet; /* pointer to packet */
- short ift_size; /* size of packet */
- short ift_metric; /* metric */
-};
-
-/*
- * Per interface packet tracing buffers. An incoming and
- * outgoing circular buffer of packets is maintained, per
- * interface, for debugging. Buffers are dumped whenever
- * an interface is marked down.
- */
-struct ifdebug {
- struct iftrace *ifd_records; /* array of trace records */
- struct iftrace *ifd_front; /* next empty trace record */
- int ifd_count; /* number of unprinted records */
- struct interface *ifd_if; /* for locating stuff */
-};
-
-/*
- * Packet tracing stuff.
- */
-int tracepackets; /* watch packets as they go by */
-int tracing; /* on/off */
-FILE *ftrace; /* output trace file */
-
-#define TRACE_ACTION(action, route) { \
- if (tracing) \
- traceaction(ftrace, "action", route); \
- traceactionlog(action, route); \
- }
-#define TRACE_SAP_ACTION(action, service) { \
- tracesapactionlog(action, service); \
- }
-#define TRACE_INPUT(ifp, src, size) { \
- if (tracing) { \
- ifp = if_iflookup(src); \
- if (ifp) \
- trace(&ifp->int_input, src, \
- &packet[sizeof(struct ipx)], size, \
- ntohl(ifp->int_metric)); \
- } \
- if (tracepackets && ftrace) \
- dumppacket(ftrace, "from", src, \
- &packet[sizeof(struct ipx)], size); \
- }
-#define TRACE_OUTPUT(ifp, dst, size) { \
- if (tracing) { \
- ifp = if_iflookup(dst); \
- if (ifp) \
- trace(&ifp->int_output, dst, \
- &packet[sizeof(struct ipx)], \
- size, ifp->int_metric); \
- } \
- if (tracepackets && ftrace) \
- dumppacket(ftrace, "to", dst, \
- &packet[sizeof(struct ipx)], size); \
- }
-
-#define TRACE_SAP_OUTPUT(ifp, dst, size) { \
- if (tracing) { \
- ifp = if_iflookup(dst); \
- if (ifp) \
- trace(&ifp->int_output, dst, \
- &packet[sizeof(struct ipx)], \
- size, ifp->int_metric); \
- } \
- if (tracepackets && ftrace) \
- dumpsappacket(ftrace, "to", dst, \
- &packet[sizeof(struct ipx)], size); \
- }
-
-void traceinit(struct interface *);
-void traceon(char *file);
-void traceoff(void);
-void traceaction(FILE *, char *, struct rt_entry *);
-void traceactionlog(char *, struct rt_entry *);
-void tracesapactionlog(char *action, struct sap_entry *sap);
-void trace(struct ifdebug *, struct sockaddr *, char *, int, int);
-void dumppacket(FILE *, char *, struct sockaddr *, char *, int);
-void dumpsappacket(FILE *, char *, struct sockaddr *, char *, int);
-void dumpsaptable(FILE *fd, struct sap_hash *sh);
-void dumpriptable(FILE *fd);
-
-char *ipxdp_nettoa(union ipx_net);
-char *ipxdp_ntoa(struct ipx_addr *);
-
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
index c3f93cc..61d91b9 100644
--- a/usr.sbin/Makefile
+++ b/usr.sbin/Makefile
@@ -176,10 +176,6 @@ SUBDIR+= traceroute6
SUBDIR+= ipfwpcap
.endif
-.if ${MK_IPX} != "no"
-SUBDIR+= IPXrouted
-.endif
-
.if ${MK_JAIL} != "no"
SUBDIR+= jail
SUBDIR+= jexec
OpenPOWER on IntegriCloud