Just need to pass the address family to if_simloop(), not the whole sockaddr.

This commit is contained in:
Archie Cobbs 2000-05-24 21:16:56 +00:00
parent d4c74446f7
commit 06a429a3c8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=60889
10 changed files with 28 additions and 23 deletions

View File

@ -359,10 +359,10 @@ ether_output(ifp, m, dst, rt0)
if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
(void) if_simloop(ifp, n, dst, hlen);
(void) if_simloop(ifp, n, dst->sa_family, hlen);
} else if (bcmp(eh->ether_dhost,
eh->ether_shost, ETHER_ADDR_LEN) == 0) {
(void) if_simloop(ifp, m, dst, hlen);
(void) if_simloop(ifp, m, dst->sa_family, hlen);
return (0); /* XXX */
}
}

View File

@ -337,11 +337,11 @@ fddi_output(ifp, m, dst, rt0)
struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
(void) if_simloop(ifp,
n, dst, sizeof(struct fddi_header));
n, dst->sa_family, sizeof(struct fddi_header));
} else if (bcmp(fh->fddi_dhost,
fh->fddi_shost, sizeof(fh->fddi_shost)) == 0) {
(void) if_simloop(ifp,
m, dst, sizeof(struct fddi_header));
m, dst->sa_family, sizeof(struct fddi_header));
return(0); /* XXX */
}
}

View File

@ -285,10 +285,12 @@ iso88025_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct
(loop_copy != -1)) {
if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
(void) if_simloop(ifp, n, dst, ISO88025_HDR_LEN);
(void) if_simloop(ifp,
n, dst->sa_family, ISO88025_HDR_LEN);
} else if (bcmp(th->iso88025_dhost,
th->iso88025_shost, ETHER_ADDR_LEN) == 0) {
(void) if_simloop(ifp, m, dst, ISO88025_HDR_LEN);
(void) if_simloop(ifp,
m, dst->sa_family, ISO88025_HDR_LEN);
return(0); /* XXX */
}
}

View File

@ -186,7 +186,7 @@ looutput(ifp, m, dst, rt)
return (EAFNOSUPPORT);
}
#endif
return(if_simloop(ifp, m, dst, 0));
return(if_simloop(ifp, m, dst->sa_family, 0));
}
/*
@ -201,29 +201,30 @@ looutput(ifp, m, dst, rt)
*/
int
if_simloop(ifp, m, dst, hlen)
if_simloop(ifp, m, af, hlen)
struct ifnet *ifp;
register struct mbuf *m;
struct sockaddr *dst;
int af;
int hlen;
{
int s, isr;
register struct ifqueue *ifq = 0;
if ((m->m_flags & M_PKTHDR) == 0)
panic("if_simloop: no HDR");
KASSERT((m->m_flags & M_PKTHDR) != 0, ("if_simloop: no HDR"));
m->m_pkthdr.rcvif = ifp;
/* BPF write needs to be handled specially */
if (dst->sa_family == AF_UNSPEC) {
dst->sa_family = *(mtod(m, int *));
if (af == AF_UNSPEC) {
KASSERT(m->m_len >= sizeof(int), ("if_simloop: m_len"));
af = *(mtod(m, int *));
m->m_len -= sizeof(int);
m->m_pkthdr.len -= sizeof(int);
m->m_data += sizeof(int);
}
/* Let BPF see incoming packet */
if (ifp->if_bpf) {
struct mbuf m0, *n = m;
u_int af = dst->sa_family;
/*
* We need to prepend the address family as
@ -254,7 +255,8 @@ if_simloop(ifp, m, dst, hlen)
m_adj(m, hlen);
}
switch (dst->sa_family) {
/* Deliver to upper layer protocol */
switch (af) {
#ifdef INET
case AF_INET:
ifq = &ipintrq;
@ -287,7 +289,7 @@ if_simloop(ifp, m, dst, hlen)
break;
#endif NETATALK
default:
printf("if_simloop: can't handle af=%d\n", dst->sa_family);
printf("if_simloop: can't handle af=%d\n", af);
m_freem(m);
return (EAFNOSUPPORT);
}

View File

@ -362,8 +362,7 @@ void ifafree __P((struct ifaddr *));
struct ifmultiaddr *ifmaof_ifpforaddr __P((struct sockaddr *,
struct ifnet *));
int if_simloop __P((struct ifnet *ifp, struct mbuf *m,
struct sockaddr *dst, int hlen));
int if_simloop __P((struct ifnet *ifp, struct mbuf *m, int af, int hlen));
#endif /* _KERNEL */

View File

@ -21,6 +21,8 @@
* netatalk@itd.umich.edu
*/
/* $FreeBSD$ */
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
@ -220,7 +222,7 @@ ddp_route( struct mbuf *m, struct route *ro)
if ((satosat(&aa->aa_addr)->sat_addr.s_net == satosat(&ro->ro_dst)->sat_addr.s_net) &&
(satosat(&aa->aa_addr)->sat_addr.s_node == satosat(&ro->ro_dst)->sat_addr.s_node))
{
return (if_simloop(ifp, m, (struct sockaddr *)&gate, 0));
return (if_simloop(ifp, m, gate.sat_family, 0));
}
return((*ifp->if_output)( ifp,

View File

@ -139,7 +139,7 @@ ipatm_ifoutput(ifp, m, dst)
/*
* It's for us - hand packet to loopback driver
*/
(void) if_simloop(ifp, m, dst, 0);
(void) if_simloop(ifp, m, dst->sa_family, 0);
goto done;
}
}

View File

@ -1868,7 +1868,7 @@ ip_mloopback(ifp, m, dst, hlen)
copym->m_pkthdr.rcvif = ifp;
ip_input(copym);
#else
if_simloop(ifp, copym, (struct sockaddr *)dst, 0);
if_simloop(ifp, copym, dst->sin_family, 0);
#endif
}
}

View File

@ -1643,7 +1643,7 @@ pim6_input(mp, offp, proto)
#endif
rc = if_simloop(mif6table[reg_mif_num].m6_ifp, m,
(struct sockaddr *) &dst, NULL);
dst.sin6_family, NULL);
/* prepare the register head to send to the mrouting daemon */
m = mcp;

View File

@ -2124,7 +2124,7 @@ ip6_mloopback(ifp, m, dst)
copym = m_copy(m, 0, M_COPYALL);
if (copym != NULL) {
(void)if_simloop(ifp, copym, (struct sockaddr *)dst, 0);
(void)if_simloop(ifp, copym, dst->sin6_family, 0);
}
}