Date: Tue, 2 Feb 1999 09:16:30 +0600 From: bp@butya.kz To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: kern/9871: IPX stack patch to fix two bugs and add internal net support Message-ID: <E107WKE-0002Sf-00@lion.butya.kz>
next in thread | raw e-mail | index | archive | help
>Number: 9871 >Category: kern >Synopsis: IPX stack patch to fix two bugs and add internal net support >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Feb 1 19:20:01 PST 1999 >Closed-Date: >Last-Modified: >Originator: Boris Popov >Release: FreeBSD 3.0-STABLE i386 >Organization: at home >Environment: FreeBSD 3.0-STABLE i386, FreeBSD 4.0-CURRENT i386 >Description: IPX output routine does not set M_BCAST flag, therefore broadcast packets not delivered to local host. In ipx_pcb.c: zeroing net in local addr lead to fail applications that explicitly specify local interface, primarily local net. In ipx_usrreq.c: not restoring local net in ipx_pcb. This valid when no net was assigned, but wrong for other cases. In spx_usrreq.c: using pointer returned by MALLOC(..,M_NOWAIT) before checking on NULL value. In usr.sbin/IPXrouted: little changes to take care about local net. These patches has been tested with multiple interfaces and even with IPTUNNEL link. No problems was detected. >How-To-Repeat: Try to do something useful with mars_nwe server and nwfs for FreeBSD. >Fix: First patch for /sys/netipx directory and second for usr.sbin/IPXrouted. Patches separted by '----------' line. Index: netipx/ipx_outputfl.c =================================================================== RCS file: /usr/local/cvsrp/netipx/ipx_outputfl.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ipx_outputfl.c 1999/01/30 04:37:17 1.1.1.1 +++ ipx_outputfl.c 1999/01/30 04:40:17 1.2 @@ -118,7 +118,7 @@ * such a packet. */ if (dst->sipx_addr.x_host.c_host[0]&1) { - if ((ifp->if_flags & IFF_BROADCAST) == 0) { + if ((ifp->if_flags & (IFF_BROADCAST | IFF_LOOPBACK)) == 0) { error = EADDRNOTAVAIL; goto bad; } @@ -126,6 +126,7 @@ error = EACCES; goto bad; } + m0->m_flags |= M_BCAST; } if (htons(ipx->ipx_len) <= ifp->if_mtu) { Index: netipx/ipx_pcb.c =================================================================== RCS file: /usr/local/cvsrp/netipx/ipx_pcb.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ipx_pcb.c 1999/01/30 04:37:17 1.1.1.1 +++ ipx_pcb.c 1999/02/01 10:08:46 1.2 @@ -169,7 +169,7 @@ if (ro->ro_rt != NULL) RTFREE(ro->ro_rt); ro->ro_rt = NULL; - ipxp->ipxp_laddr.x_net = ipx_zeronet; +/* ipxp->ipxp_laddr.x_net = ipx_zeronet;*/ } }/* else cached route is ok; do nothing */ ipxp->ipxp_lastdst = sipx->sipx_addr; Index: netipx/ipx_usrreq.c =================================================================== RCS file: /usr/local/cvsrp/netipx/ipx_usrreq.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ipx_usrreq.c 1999/01/30 04:37:17 1.1.1.1 +++ ipx_usrreq.c 1999/02/01 10:08:46 1.2 @@ -562,6 +562,8 @@ splx(s); ipxp->ipxp_laddr.x_host = laddr.x_host; ipxp->ipxp_laddr.x_port = laddr.x_port; + if (!ipx_nullnet(laddr)) + ipxp->ipxp_laddr.x_net = laddr.x_net; } send_release: Index: netipx/spx_usrreq.c =================================================================== RCS file: /usr/local/cvsrp/netipx/spx_usrreq.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- spx_usrreq.c 1999/01/30 04:37:17 1.1.1.1 +++ spx_usrreq.c 1999/01/30 04:40:17 1.2 @@ -1335,13 +1335,13 @@ ipxp = sotoipxpcb(so); MALLOC(cb, struct spxpcb *, sizeof *cb, M_PCB, M_NOWAIT); - bzero(cb, sizeof *cb); - sb = &so->so_snd; if (cb == NULL) { error = ENOBUFS; goto spx_attach_end; } + bzero(cb, sizeof *cb); + sb = &so->so_snd; mm = m_getclr(M_DONTWAIT, MT_HEADER); if (mm == NULL) { ------------------ Index: ipxrtd/sap_tables.c =================================================================== RCS file: /usr/local/cvsrp/ipxrtd/sap_tables.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sap_tables.c 1999/02/01 10:11:13 1.1.1.1 +++ sap_tables.c 1999/02/01 10:17:02 1.2 @@ -134,6 +134,7 @@ for(sap = sh->forw; sap != (sap_entry *)sh; sap = sap->forw) { if (ServType != sap->sap.ServType) continue; +#if 0 if (ifp == sap->ifp) continue; @@ -147,6 +148,7 @@ goto next; csap = csap->clone; } +#endif if (ntohs(sap->sap.hops) < besthops) { best = sap; Index: ipxrtd/startup.c =================================================================== RCS file: /usr/local/cvsrp/ipxrtd/startup.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- startup.c 1999/02/01 10:11:13 1.1.1.1 +++ startup.c 1999/02/01 10:17:02 1.2 @@ -183,6 +183,9 @@ } 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, @@ -192,9 +195,6 @@ if_ifwithdstaddr(&ifs.int_dstaddr)) || ( ((ifs.int_flags & IFF_POINTOPOINT) == 0) && if_ifwithaddr(&ifs.int_addr))) - continue; - /* no one cares about software loopback interfaces */ - if (ifs.int_flags & IFF_LOOPBACK) continue; ifp = (struct interface *) malloc(sdl->sdl_nlen + 1 + sizeof(ifs)); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E107WKE-0002Sf-00>