SCCS-vsn: sys/netns/ns.h 6.9
SCCS-vsn: sys/netns/ns.c 6.7
SCCS-vsn: sys/netns/idp_usrreq.c 6.12
SCCS-vsn: sys/netns/ns_input.c 6.12
- * Copyright (c) 1984,1985 Regents of the University of California.
+ * Copyright (c) 1984, 1985 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)idp_usrreq.c 6.11 (Berkeley) %G%
+ * @(#)idp_usrreq.c 6.12 (Berkeley) %G%
* Stuff source address and datagram in user buffer.
*/
idp_ns.sns_addr = idp->idp_sna;
* Stuff source address and datagram in user buffer.
*/
idp_ns.sns_addr = idp->idp_sna;
- if (ns_netof(idp->idp_sna)==0 && ifp) {
+ if (ns_neteqnn(idp->idp_sna.x_net, ns_zeronet) && ifp) {
register struct ifaddr *ia;
for (ia = ifp->if_addrlist; ia; ia = ia->ifa_next) {
register struct ifaddr *ia;
for (ia = ifp->if_addrlist; ia; ia = ia->ifa_next) {
m_freem(m0);
return (ENOBUFS);
}
m_freem(m0);
return (ENOBUFS);
}
- m->m_off = MMAXOFF - sizeof (struct idp);
+ m->m_off = MMAXOFF - sizeof (struct idp) - 2;
+ /* adjust to start on longword bdry
+ for NSIP on gould */
m->m_len = sizeof (struct idp);
m->m_next = m0;
idp = mtod(m, struct idp *);
m->m_len = sizeof (struct idp);
m->m_next = m0;
idp = mtod(m, struct idp *);
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)ns.c 6.6 (Berkeley) %G%
+ * @(#)ns.c 6.7 (Berkeley) %G%
{
register long hash = 0;
register u_short *s = sns->sns_addr.x_host.s_host;
{
register long hash = 0;
register u_short *s = sns->sns_addr.x_host.s_host;
+ union {
+ union ns_net net_e;
+ long long_e;
+ } net;
- hp->afh_nethash = ns_netof(sns->sns_addr);
+ net.net_e = sns->sns_addr.x_net;
+ hp->afh_nethash = net.long_e;
hash = *s++; hash <<= 8; hash += *s++; hash <<= 8; hash += *s;
hp->afh_hosthash = hash;
}
hash = *s++; hash <<= 8; hash += *s++; hash <<= 8; hash += *s;
hp->afh_hosthash = hash;
}
struct sockaddr_ns *sns1, *sns2;
{
struct sockaddr_ns *sns1, *sns2;
{
- return (ns_netof(sns1->sns_addr) == ns_netof(sns2->sns_addr));
+ return (ns_neteq(sns1->sns_addr, sns2->sns_addr));
register struct ns_addr *compare;
register struct ifnet *ifp;
struct ns_ifaddr *ia_maybe = 0;
register struct ns_addr *compare;
register struct ifnet *ifp;
struct ns_ifaddr *ia_maybe = 0;
- long net = ns_netof(*dst);
- static struct ns_addr laddr;
+ union ns_net net = dst->x_net;
for (ia = ns_ifaddr; ia; ia = ia->ia_next) {
if (ifp = ia->ia_ifp) {
for (ia = ns_ifaddr; ia; ia = ia->ia_next) {
if (ifp = ia->ia_ifp) {
compare = &satons_addr(ia->ia_dstaddr);
if (ns_hosteq(*dst, *compare))
return (ia);
compare = &satons_addr(ia->ia_dstaddr);
if (ns_hosteq(*dst, *compare))
return (ia);
- laddr.x_net = ia->ia_net;
- if (ns_netof(laddr) == net)
+ if (ns_neteqnn(net, ia->ia_net))
- laddr.x_net = ia->ia_net;
- if (ns_netof(laddr) == net)
+ if (ns_neteqnn(net, ia->ia_net))
- * Copyright (c) 1982 Regents of the University of California.
+ * Copyright (c) 1984, 1985, 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)ns.h 6.8 (Berkeley) %G%
+ * @(#)ns.h 6.9 (Berkeley) %G%
};
#define sns_port sns_addr.x_port
};
#define sns_port sns_addr.x_port
-#define ns_netof(a) (*(long *) & ((a).x_net))
-#define ns_neteq(a,b) (ns_netof(a) == ns_netof(b))
+#ifdef vax
+#define ns_netof(a) (*(long *) & ((a).x_net)) /* XXX - not needed */
+#endif
+#define ns_neteqnn(a,b) (((a).s_net[0]==(b).s_net[0]) && \
+ ((a).s_net[0]==(b).s_net[0]))
+#define ns_neteq(a,b) ns_neteqnn((a).x_net, (b).x_net)
#define satons_addr(sa) (((struct sockaddr_ns *)&(sa))->sns_addr)
#define ns_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 satons_addr(sa) (((struct sockaddr_ns *)&(sa))->sns_addr)
#define ns_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])
extern union ns_host ns_thishost;
extern union ns_host ns_zerohost;
extern union ns_host ns_broadhost;
extern union ns_host ns_thishost;
extern union ns_host ns_zerohost;
extern union ns_host ns_broadhost;
+extern union ns_net ns_zeronet;
+extern union ns_net ns_broadnet;
u_short ns_cksum();
#endif
u_short ns_cksum();
#endif
- * Copyright (c) 1982 Regents of the University of California.
+ * Copyright (c) 1984, 1985 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)ns_input.c 6.11 (Berkeley) %G%
+ * @(#)ns_input.c 6.12 (Berkeley) %G%
union ns_host ns_thishost;
union ns_host ns_zerohost;
union ns_host ns_broadhost;
union ns_host ns_thishost;
union ns_host ns_zerohost;
union ns_host ns_broadhost;
+union ns_net ns_zeronet;
+union ns_net ns_broadnet;
-static char allones[] = {-1, -1, -1, -1, -1, -1};
+static u_short allones[] = {-1, -1, -1};
struct nspcb nspcb;
struct nspcb nsrawpcb;
struct nspcb nspcb;
struct nspcb nsrawpcb;
extern struct timeval time;
ns_broadhost = * (union ns_host *) allones;
extern struct timeval time;
ns_broadhost = * (union ns_host *) allones;
+ ns_broadnet = * (union ns_net *) allones;
nspcb.nsp_next = nspcb.nsp_prev = &nspcb;
nsrawpcb.nsp_next = nsrawpcb.nsp_prev = &nsrawpcb;
nsintrq.ifq_maxlen = nsqmaxlen;
nspcb.nsp_next = nspcb.nsp_prev = &nspcb;
nsrawpcb.nsp_next = nsrawpcb.nsp_prev = &nsrawpcb;
nsintrq.ifq_maxlen = nsqmaxlen;
* Is this a directed broadcast?
*/
if (ns_hosteqnh(ns_broadhost,idp->idp_dna.x_host)) {
* Is this a directed broadcast?
*/
if (ns_hosteqnh(ns_broadhost,idp->idp_dna.x_host)) {
- if ((ns_netof(idp->idp_dna)!=ns_netof(idp->idp_sna)) &&
- (ns_netof(idp->idp_dna)!=-1) && (ns_netof(idp->idp_sna)!=0)
- && (ns_netof(idp->idp_dna)!=0)) {
+ if ((!ns_neteq(idp->idp_dna, idp->idp_sna)) &&
+ (!ns_neteqnn(idp->idp_dna.x_net, ns_broadnet)) &&
+ (!ns_neteqnn(idp->idp_sna.x_net, ns_zeronet)) &&
+ (!ns_neteqnn(idp->idp_dna.x_net, ns_zeronet)) ) {
/*
* Look to see if I need to eat this packet.
* Algorithm is to forward all young packets
/*
* Look to see if I need to eat this packet.
* Algorithm is to forward all young packets