SCCS-vsn: sys/netns/ns_input.c 6.10
SCCS-vsn: sys/netns/idp_usrreq.c 6.8
SCCS-vsn: sys/netns/spp_usrreq.c 6.11
* 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.7 (Berkeley) %G%
+ * @(#)idp_usrreq.c 6.8 (Berkeley) %G%
#include "ns.h"
#include "ns_pcb.h"
#include "ns.h"
#include "ns_pcb.h"
#include "idp.h"
#include "idp_var.h"
#include "ns_error.h"
#include "idp.h"
#include "idp_var.h"
#include "ns_error.h"
/*
* This may also be called for raw listeners.
*/
/*
* This may also be called for raw listeners.
*/
struct mbuf *m;
register struct nspcb *nsp;
struct mbuf *m;
register struct nspcb *nsp;
{
register struct idp *idp = mtod(m, struct idp *);
{
register struct idp *idp = mtod(m, struct idp *);
/*
* Construct sockaddr format source address.
* Stuff source address and datagram in user buffer.
*/
idp_ns.sns_addr = idp->idp_sna;
/*
* Construct sockaddr format source address.
* Stuff source address and datagram in user buffer.
*/
idp_ns.sns_addr = idp->idp_sna;
+ if (ns_netof(idp->idp_sna)==0) {
+ register struct ifaddr *ia;
+
+ for (ia = ifp->if_addrlist; ia; ia->ifa_next) {
+ if (ia->ifa_addr.sa_family == AF_NS) {
+ idp_ns.sns_addr.x_net =
+ IA_SNS(ia)->sns_addr.x_net;
+ break;
+ }
+ }
+ }
nsp->nsp_rpt = idp->idp_pt;
if ( ! (nsp->nsp_flags & NSP_RAWIN) ) {
m->m_len -= sizeof (struct idp);
nsp->nsp_rpt = idp->idp_pt;
if ( ! (nsp->nsp_flags & NSP_RAWIN) ) {
m->m_len -= sizeof (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_input.c 6.9 (Berkeley) %G%
+ * @(#)ns_input.c 6.10 (Berkeley) %G%
*/
for (nsp = nsrawpcb.nsp_next; nsp != &nsrawpcb; nsp = nsp->nsp_next) {
struct mbuf *m1 = m_copy(m, 0, (int)M_COPYALL);
*/
for (nsp = nsrawpcb.nsp_next; nsp != &nsrawpcb; nsp = nsp->nsp_next) {
struct mbuf *m1 = m_copy(m, 0, (int)M_COPYALL);
- if (m1) idp_input(m1, nsp);
+ if (m1) idp_input(m1, nsp, ifp);
}
idp = mtod(m, struct idp *);
}
idp = mtod(m, struct idp *);
switch (idp->idp_pt) {
case NSPROTO_SPP:
switch (idp->idp_pt) {
case NSPROTO_SPP:
+ spp_input(m, nsp, ifp);
goto next;
case NSPROTO_ERROR:
ns_err_input(m);
goto next;
}
goto next;
case NSPROTO_ERROR:
ns_err_input(m);
goto next;
}
+ idp_input(m, nsp, ifp);
} else {
ns_error(m, NS_ERR_NOSOCK, 0);
}
} else {
ns_error(m, NS_ERR_NOSOCK, 0);
}
if (nsctlerrmap[cmd] == 0)
return; /* XXX */
type = NS_ERR_UNREACH_HOST;
if (nsctlerrmap[cmd] == 0)
return; /* XXX */
type = NS_ERR_UNREACH_HOST;
- if (cmd == PRC_IFDOWN)
- ns = &((struct sockaddr_ns *)arg)->sns_addr;
- else if (cmd == PRC_HOSTDEAD || cmd == PRC_HOSTUNREACH)
- ns = (struct ns_addr *)arg;
- else {
+ switch (cmd) {
+ struct sockaddr_ns *sns;
+
+ case PRC_IFDOWN:
+ case PRC_HOSTDEAD:
+ case PRC_HOSTUNREACH:
+ sns = (struct sockaddr_ns *)arg;
+ if (sns->sns_family != AF_INET)
+ return;
+ ns = &sns->sns_addr;
+ break;
+
+ default:
errp = (struct ns_errp *)arg;
ns = &errp->ns_err_idp.idp_dna;
type = errp->ns_err_num;
errp = (struct ns_errp *)arg;
ns = &errp->ns_err_idp.idp_dna;
type = errp->ns_err_num;
* 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.
*
- * @(#)spp_usrreq.c 6.10 (Berkeley) %G%
+ * @(#)spp_usrreq.c 6.11 (Berkeley) %G%