summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/net/if_ethersubr.c4
-rw-r--r--sys/net/if_fddisubr.c4
-rw-r--r--sys/net/if_iso88025subr.c6
-rw-r--r--sys/net/if_loop.c22
-rw-r--r--sys/net/if_var.h3
-rw-r--r--sys/netatalk/ddp_output.c4
-rw-r--r--sys/netatm/ipatm/ipatm_output.c2
-rw-r--r--sys/netinet/ip_output.c2
-rw-r--r--sys/netinet6/ip6_mroute.c2
-rw-r--r--sys/netinet6/ip6_output.c2
10 files changed, 28 insertions, 23 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 1a5b0c9..8507d90 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -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 */
}
}
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index b9c431a..21c10fc 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -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 */
}
}
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c
index bbd10d8..3dd47b8 100644
--- a/sys/net/if_iso88025subr.c
+++ b/sys/net/if_iso88025subr.c
@@ -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 */
}
}
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 3efef6d..5f6e91b 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -186,7 +186,7 @@ contiguousfail:
return (EAFNOSUPPORT);
}
#endif
- return(if_simloop(ifp, m, dst, 0));
+ return(if_simloop(ifp, m, dst->sa_family, 0));
}
/*
@@ -201,29 +201,30 @@ contiguousfail:
*/
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);
}
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 66b117c..a7060cd 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -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 */
diff --git a/sys/netatalk/ddp_output.c b/sys/netatalk/ddp_output.c
index 2344e70..66e20df 100644
--- a/sys/netatalk/ddp_output.c
+++ b/sys/netatalk/ddp_output.c
@@ -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,
diff --git a/sys/netatm/ipatm/ipatm_output.c b/sys/netatm/ipatm/ipatm_output.c
index cdbe2a8..1ca94f3 100644
--- a/sys/netatm/ipatm/ipatm_output.c
+++ b/sys/netatm/ipatm/ipatm_output.c
@@ -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;
}
}
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 47b2c37..52db099 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -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
}
}
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 1f6b5f2..5d5c065 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -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;
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index c7d0499..eb0474f 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -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);
}
}
OpenPOWER on IntegriCloud