kern/80266: IPX routing doesn't work

Keith White Keith.White at site.uottawa.ca
Fri Apr 22 15:00:45 PDT 2005


>Number:         80266
>Category:       kern
>Synopsis:       IPX routing doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 22 22:00:43 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Keith White
>Release:        FreeBSD 5.4-RC3 i386
>Organization:
SITE, University of Ottawa
>Environment:
System: FreeBSD  5.4-RC3 FreeBSD 5.4-RC3 #3: Fri Apr 22 14:18:59 EDT 2005     root@:/usr/obj/usr/src/sys/NOSMPPAE  i386

>Description:

IPX routing in 5.4-RC3 doesn't work.

See also: kern/74105

Some more structures need to be declared as "packed" for IPXrouted(8)
and kernel routines that use "struct sockaddr_ipx" so that
routes are created correctly.

>How-To-Repeat:

Find a busy IPX network.  Run "IPXrouted -q -t".  Notice misaligned
hostnames, invalid IPX network addresses, negative ticks and extreme
metric.

Run "netstat -rnf ipx".  Notice how all "Destinations" are "default"
rather than "network.*"

Run "ncplist s".  Wait for output (it'll likely timeout).

>Fix:

Patches against 5.4-RC3

--- usr/src/usr.sbin/IPXrouted/protocol.h	Fri Aug 27 21:15:03 1999
+++ /usr/src/usr.sbin/IPXrouted/protocol.h	Fri Apr 22 11:30:40 2005
@@ -49,12 +49,12 @@
 	union ipx_net	rip_dst;		/* destination net */
 	u_short		rip_metric;		/* cost of route */
 	u_short		rip_ticks;		/* cost of route */
-};
+} __packed;
 
 struct rip {
 	u_short	rip_cmd;		/* request/response */
 	struct netinfo rip_nets[1];	/* variable length */
-};
+} __packed;
  
 /*
  * Packet types.
--- usr/src/usr.sbin/IPXrouted/sap.h	Fri Aug 27 21:15:03 1999
+++ /usr/src/usr.sbin/IPXrouted/sap.h	Thu Apr 21 10:57:10 2005
@@ -47,19 +47,19 @@
 #define MAXSAPENTRIES		7
 #define SAP_WILDCARD		0xFFFF
 #define SERVNAMELEN		48
-typedef struct sap_info {
+typedef struct __attribute__ ((packed)) sap_info {
 	u_short ServType;
 	char    ServName[SERVNAMELEN];
 	struct ipx_addr ipx;
 	u_short hops;
-	}sap_info;  
+	}sap_info;
 
-typedef struct sap_packet {
+typedef struct __attribute__ ((packed)) sap_packet {
 	u_short sap_cmd;
 	sap_info sap[0]; /* Variable length. */
 	}sap_packet;
 
-typedef struct sap_entry {
+typedef struct __attribute__ ((packed)) sap_entry {
 	struct sap_entry *forw;
 	struct sap_entry *back;
 	struct sap_entry *clone;
@@ -73,7 +73,7 @@
 
 #define SAPHASHSIZ		256		/* Should be a power of 2 */
 #define SAPHASHMASK		(SAPHASHSIZ-1)
-typedef struct sap_hash {
+typedef struct __attribute__ ((packed)) sap_hash {
 	struct sap_entry *forw;
 	struct sap_entry *back;
 	}sap_hash;
--- usr/src/usr.sbin/IPXrouted/trace.c	Sat Nov 15 12:10:56 2003
+++ /usr/src/usr.sbin/IPXrouted/trace.c	Thu Apr 21 12:45:04 2005
@@ -500,7 +500,7 @@
 {
 	static char buf[100];
 	net.net_e = val;
-	(void)sprintf(buf, "%u", ntohl(net.long_e));
+	(void)sprintf(buf, "%x", ntohl(net.long_e));
 	return (buf);
 }
 
--- usr/src/usr.sbin/IPXrouted/main.c	Sat Nov 15 12:10:56 2003
+++ /usr/src/usr.sbin/IPXrouted/main.c	Thu Apr 21 15:09:52 2005
@@ -77,7 +77,7 @@
 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 */
+struct	__attribute__ ((packed)) sockaddr_ipx ipx_netmask;	/* Used in installing routes */
 
 char	packet[MAXRXPACKETSIZE+1];
 
--- usr/src/lib/libncp/ipxsap.h	Tue Oct 12 07:56:37 1999
+++ /usr/src/lib/libncp/ipxsap.h	Fri Apr 22 10:23:45 2005
@@ -58,7 +58,7 @@
 	u_char		server_name[IPX_SAP_SERVER_NAME_LEN];
 	struct ipx_addr	ipx;
 	u_short		hops;
-};
+} __packed;
 
 struct sap_packet {
 	u_short		operation;
--- usr/src/sys/netipx/ipx.h	Mon Jan 31 18:26:42 2005
+++ /usr/src/sys/netipx/ipx.h	Fri Apr 22 14:13:51 2005
@@ -130,7 +130,7 @@
 	u_char		sipx_family;
 	struct ipx_addr	sipx_addr;
 	char		sipx_zero[2];
-};
+} __packed;
 #define sipx_port sipx_addr.x_port
 #define sipx_network sipx_addr.x_net.u_net
 #define sipx_node sipx_addr.x_host.c_host


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list