summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2000-01-11 19:31:57 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2000-01-11 19:31:57 +0000
commitc7e33d842b4b7e4f80ff8574243639aec5857463 (patch)
tree07ef2db92b5020287ffaeb0025b733d59a561dd2
parent7ad2a85b26b2ddd0b111487c985db5e62aef02d1 (diff)
Remove references to ipx_thishost; instead find the address from
ipx_ifaddr.
-rw-r--r--sys/netipx/ipx.c40
-rw-r--r--sys/netipx/ipx.h3
-rw-r--r--sys/netipx/ipx_input.c36
-rw-r--r--sys/netipx/ipx_ip.c11
-rw-r--r--sys/netipx/ipx_pcb.c10
5 files changed, 49 insertions, 51 deletions
diff --git a/sys/netipx/ipx.c b/sys/netipx/ipx.c
index 3fe40fd2816..bc349417140 100644
--- a/sys/netipx/ipx.c
+++ b/sys/netipx/ipx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipx.c,v 1.5 2000/01/11 02:15:37 fgsch Exp $ */
+/* $OpenBSD: ipx.c,v 1.6 2000/01/11 19:31:53 fgsch Exp $ */
/*-
*
@@ -240,7 +240,6 @@ ipx_ifinit(ifp, ia, sipx, scrub)
int scrub;
{
struct sockaddr_ipx oldaddr;
- register union ipx_host *h = &ia->ia_addr.sipx_addr.ipx_host;
int s = splimp(), error;
/*
@@ -252,41 +251,19 @@ ipx_ifinit(ifp, ia, sipx, scrub)
/*
* The convention we shall adopt for naming is that
* a supplied address of zero means that "we don't care".
- * if there is a single interface, use the address of that
- * interface as our 6 byte host address.
- * if there are multiple interfaces, use any address already
- * used.
+ * 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 (ipx_hosteqnh(ipx_thishost, ipx_zerohost)) {
- if (ifp->if_ioctl &&
- (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (void *)ia))) {
- ia->ia_addr = oldaddr;
- splx(s);
- return (error);
- }
- ipx_thishost = *h;
- } else if (ipx_hosteqnh(sipx->sipx_addr.ipx_host, ipx_zerohost)
- || ipx_hosteqnh(sipx->sipx_addr.ipx_host, ipx_thishost)) {
- *h = ipx_thishost;
- if (ifp->if_ioctl &&
- (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (void *)ia))) {
- ia->ia_addr = oldaddr;
- splx(s);
- return (error);
- }
- if (!ipx_hosteqnh(ipx_thishost,*h)) {
- ia->ia_addr = oldaddr;
- splx(s);
- return (EINVAL);
- }
- } else {
+ if (ifp->if_ioctl != NULL &&
+ (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (void *)ia))) {
ia->ia_addr = oldaddr;
splx(s);
- return (EINVAL);
+ return (error);
}
ia->ia_ifa.ifa_metric = ifp->if_metric;
/*
@@ -300,7 +277,8 @@ ipx_ifinit(ifp, ia, sipx, scrub)
if (ifp->if_flags & IFF_POINTOPOINT)
rtinit(&(ia->ia_ifa), (int)RTM_ADD, RTF_HOST|RTF_UP);
else {
- ia->ia_broadaddr.sipx_addr.ipx_net = ia->ia_addr.sipx_addr.ipx_net;
+ ia->ia_broadaddr.sipx_addr.ipx_net =
+ ia->ia_addr.sipx_addr.ipx_net;
rtinit(&(ia->ia_ifa), (int)RTM_ADD, RTF_UP);
}
ia->ia_flags |= IFA_ROUTE;
diff --git a/sys/netipx/ipx.h b/sys/netipx/ipx.h
index 8a11c075b9d..5d8ff139161 100644
--- a/sys/netipx/ipx.h
+++ b/sys/netipx/ipx.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipx.h,v 1.6 2000/01/11 01:26:20 fgsch Exp $ */
+/* $OpenBSD: ipx.h,v 1.7 2000/01/11 19:31:54 fgsch Exp $ */
/*-
*
@@ -195,7 +195,6 @@ extern struct domain ipxdomain;
extern struct sockaddr_ipx ipx_netmask;
extern struct sockaddr_ipx ipx_hostmask;
-extern union ipx_host ipx_thishost;
extern union ipx_net ipx_zeronet;
extern union ipx_host ipx_zerohost;
extern union ipx_net ipx_broadnet;
diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c
index 7880ec82e4c..b8559ba0973 100644
--- a/sys/netipx/ipx_input.c
+++ b/sys/netipx/ipx_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipx_input.c,v 1.5 2000/01/11 01:26:21 fgsch Exp $ */
+/* $OpenBSD: ipx_input.c,v 1.6 2000/01/11 19:31:55 fgsch Exp $ */
/*-
*
@@ -75,7 +75,6 @@ int ipxcksum = 0;
int ipxdonosocks = 0;
int ipxforwarding = 0;
-union ipx_host ipx_thishost;
union ipx_net ipx_zeronet;
union ipx_host ipx_zerohost;
@@ -136,6 +135,7 @@ ipxintr()
register struct ipx *ipx;
register struct mbuf *m;
register struct ipxpcb *ipxp;
+ struct ipx_ifaddr *ia;
register int i;
int len, s;
@@ -245,17 +245,27 @@ next:
/*
* Is this our packet? If not, forward.
*/
- } else if (!ipx_hosteqnh(ipx_thishost,ipx->ipx_dna.ipx_host)) {
+ } else {
+ for (ia = ipx_ifaddr.tqh_first; ia; ia = ia->ia_list.tqe_next)
+ 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.ipx_net, ipx_zeronet)))
+ break;
+
+ if (ia == NULL) {
#ifdef IPXDEBUG
- printf("ipxintr: forwarding to %s\n", ipx_ntoa(ipx->ipx_dna));
+ printf("ipxintr: forwarding to %s\n",
+ ipx_ntoa(ipx->ipx_dna));
#endif
- ipx_forward(m);
- goto next;
+ ipx_forward(m);
+ goto next;
+ }
}
/*
* Locate pcb for datagram.
*/
- ipxp = ipx_pcblookup(&ipx->ipx_sna, ipx->ipx_dna.ipx_port, IPX_WILDCARD);
+ ipxp = ipx_pcblookup(&ipx->ipx_sna, ipx->ipx_dna.ipx_port,
+ IPX_WILDCARD);
/*
* Switch out to protocol's input routine.
*/
@@ -471,6 +481,7 @@ struct ifnet *ifp;
{
register struct ipxpcb *ipxp;
register struct ifaddr *ifa;
+ register struct ipx_ifaddr *ia;
/*
* Give any raw listeners a crack at the packet
*/
@@ -486,7 +497,16 @@ struct ifnet *ifp;
continue;
ipx = mtod(m0, struct ipx *);
ipx->ipx_sna.ipx_net = ipx_zeronet;
- ipx->ipx_sna.ipx_host = ipx_thishost;
+ for (ia = ipx_ifaddr.tqh_first; ia;
+ ia = ia->ia_list.tqe_next)
+ if (ifp == ia->ia_ifp)
+ break;
+ if (ia == NULL)
+ ipx->ipx_sna.ipx_host = ipx_zerohost;
+ else
+ ipx->ipx_sna.ipx_host =
+ ia->ia_addr.sipx_addr.ipx_host;
+
if (ifp && (ifp->if_flags & IFF_POINTOPOINT))
for(ifa = ifp->if_addrlist.tqh_first; ifa;
ifa = ifa->ifa_list.tqe_next) {
diff --git a/sys/netipx/ipx_ip.c b/sys/netipx/ipx_ip.c
index bbe46003209..415a6d9aea0 100644
--- a/sys/netipx/ipx_ip.c
+++ b/sys/netipx/ipx_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipx_ip.c,v 1.4 1999/01/11 05:12:33 millert Exp $ */
+/* $OpenBSD: ipx_ip.c,v 1.5 2000/01/11 19:31:56 fgsch Exp $ */
/*-
*
@@ -327,9 +327,9 @@ ipxip_route(m)
struct sockaddr_in *src;
/*
- * First, make sure we already have an IPX address:
+ * First, make sure we already have an IPX address.
*/
- if (ipx_hosteqnh(ipx_thishost, ipx_zerohost))
+ if (ipx_ifaddr.tqh_first == NULL)
return (EADDRNOTAVAIL);
/*
* Now, determine if we can get to the destination
@@ -384,7 +384,10 @@ ipxip_route(m)
ifr_ipxip.ifr_dstaddr = * (struct sockaddr *) ipx_dst;
ipx_control((struct socket *)0, (int)SIOCSIFDSTADDR,
(caddr_t)&ifr_ipxip, (struct ifnet *)ifn);
- satoipx_addr(ifr_ipxip.ifr_addr).ipx_host = ipx_thishost;
+
+ satoipx_addr(ifr_ipxip.ifr_addr).ipx_host =
+ ipx_ifaddr->ia_addr.sipx_addr.x_host;
+
return (ipx_control((struct socket *)0, (int)SIOCSIFADDR,
(caddr_t)&ifr_ipxip, (struct ifnet *)ifn));
}
diff --git a/sys/netipx/ipx_pcb.c b/sys/netipx/ipx_pcb.c
index dfebd7c0779..106cb5faa8c 100644
--- a/sys/netipx/ipx_pcb.c
+++ b/sys/netipx/ipx_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipx_pcb.c,v 1.4 2000/01/11 01:25:01 fgsch Exp $ */
+/* $OpenBSD: ipx_pcb.c,v 1.5 2000/01/11 19:31:56 fgsch Exp $ */
/*-
*
@@ -242,11 +242,9 @@ ipx_pcbconnect(ipxp, nam)
}
if (ipx_pcblookup(&sipx->sipx_addr, ipxp->ipxp_lport, 0))
return (EADDRINUSE);
- if (ipx_nullhost(ipxp->ipxp_laddr)) {
- if (ipxp->ipxp_lport == 0)
- (void) ipx_pcbbind(ipxp, (struct mbuf *)0);
- ipxp->ipxp_laddr.ipx_host = ipx_thishost;
- }
+ if (ipxp->ipxp_lport == 0)
+ (void) ipx_pcbbind(ipxp, (struct mbuf *)0);
+
ipxp->ipxp_faddr = sipx->sipx_addr;
/* Includes ipxp->ipxp_fport = sipx->sipx_port; */
return (0);