summaryrefslogtreecommitdiff
path: root/sys/netipx
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2000-01-13 07:10:37 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2000-01-13 07:10:37 +0000
commitae033437df6b116f49c77d3095dacd1832004868 (patch)
tree2f03bd6e81d0955e89b6bd2f3d31b1b1931c0560 /sys/netipx
parent9492df981810c2e66aed03d4ad8920e2f77c8d73 (diff)
Rearrange IPXPROTO and IPXPORT names; add socket option for checksum; use
higher ports (> 6000) for privileged users; from FreeBSD. Add some new port entries.
Diffstat (limited to 'sys/netipx')
-rw-r--r--sys/netipx/ipx.h59
-rw-r--r--sys/netipx/ipx_input.c4
-rw-r--r--sys/netipx/ipx_pcb.c9
3 files changed, 42 insertions, 30 deletions
diff --git a/sys/netipx/ipx.h b/sys/netipx/ipx.h
index 2ee147c6b8a..b78c075d87e 100644
--- a/sys/netipx/ipx.h
+++ b/sys/netipx/ipx.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipx.h,v 1.10 2000/01/13 06:48:21 fgsch Exp $ */
+/* $OpenBSD: ipx.h,v 1.11 2000/01/13 07:10:36 fgsch Exp $ */
/*-
*
@@ -50,50 +50,61 @@
/*
* Protocols
*/
-#define IPXPROTO_UNKWN 0 /* Unknown */
-#define IPXPROTO_RI 1 /* RIP Routing Information */
-#define IPXPROTO_ECHO 2 /* Echo Protocol */
-#define IPXPROTO_PXP 4 /* PXP Packet Exchange */
-#define IPXPROTO_SPX 5 /* SPX Sequenced Packet */
-#define IPXPROTO_NCP 17 /* NCP NetWare Core */
-#define IPXPROTO_PPROP 20 /* complicated flood w/ bcast */
-#define IPXPROTO_RAW 255 /* Placemarker*/
-#define IPXPROTO_MAX 256 /* Placemarker*/
+#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_FSP 0x0451 /* NW FSP File Service */
-#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 */
-#define IPXPORT_WDOG 0x4001 /* NW Watchdog Packets */
-#define IPXPORT_SHELL 0x4003 /* NW Shell Socket */
-#define IPXPORT_MAX 0x8000 /* Maximum User Addressable Port */
+#define IPXPORT_RI 1 /* NS RIP Routing Information */
+#define IPXPORT_ECHO 2 /* NS Echo */
+#define IPXPORT_RE 3 /* NS Router Error */
+#define IPXPORT_FSP 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 */
+#define IPXPORT_SERIAL 0x0457 /* NW Serialization */
+#define IPXPORT_NLSP 0x9001 /* NW NLSP */
+#define IPXPORT_WAN 0x9004 /* NW IPXWAN */
+#define IPXPORT_PING 0x9086 /* NW IPX Ping */
+#define IPXPORT_MOBILE 0x9088 /* NW Mobile IPX Socket */
+/*
+ * 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_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_DEFAULT_HEADERS 3
#define SO_LAST_HEADER 4
#define SO_IPXIP_ROUTE 5
-#define SO_SEQNO 6
+#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
diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c
index b80f7543d7a..3b25e9b0633 100644
--- a/sys/netipx/ipx_input.c
+++ b/sys/netipx/ipx_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipx_input.c,v 1.10 2000/01/13 04:41:03 fgsch Exp $ */
+/* $OpenBSD: ipx_input.c,v 1.11 2000/01/13 07:10:36 fgsch Exp $ */
/*-
*
@@ -189,7 +189,7 @@ next:
* Propagated (Netbios) packets (type 20) has to be handled
* different. :-(
*/
- if (ipx->ipx_pt == IPXPROTO_PPROP) {
+ if (ipx->ipx_pt == IPXPROTO_NETBIOS) {
if (ipxnetbios) {
ipx_output_type20(m);
goto next;
diff --git a/sys/netipx/ipx_pcb.c b/sys/netipx/ipx_pcb.c
index 8acd0df5f7e..ee514c67555 100644
--- a/sys/netipx/ipx_pcb.c
+++ b/sys/netipx/ipx_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipx_pcb.c,v 1.6 2000/01/13 04:45:14 fgsch Exp $ */
+/* $OpenBSD: ipx_pcb.c,v 1.7 2000/01/13 07:10:36 fgsch Exp $ */
/*-
*
@@ -120,7 +120,7 @@ ipx_pcbbind(ipxp, nam)
if (lport) {
u_short aport = ntohs(lport);
- if (aport < IPXPORT_MAX &&
+ if (aport < IPXPORT_RESERVED &&
(ipxp->ipxp_socket->so_state & SS_PRIV) == 0)
return (EACCES);
if (ipx_pcblookup(&zeroipx_addr, lport, 0))
@@ -130,8 +130,9 @@ ipx_pcbbind(ipxp, nam)
noname:
if (lport == 0)
do {
- if (ipxcbtable.ipxpt_lport++ < IPXPORT_MAX)
- ipxcbtable.ipxpt_lport = IPXPORT_MAX;
+ if ((ipxcbtable.ipxpt_lport++ < IPXPORT_RESERVED) ||
+ (ipxcbtable.ipxpt_lport >= IPXPORT_WELLKNOWN))
+ ipxcbtable.ipxpt_lport = IPXPORT_RESERVED;
lport = htons(ipxcbtable.ipxpt_lport);
} while (ipx_pcblookup(&zeroipx_addr, lport, 0));
ipxp->ipxp_lport = lport;