From 7e20c7add6fbd44b2164c1501d1c47f6258b5251 Mon Sep 17 00:00:00 2001 From: julian Date: Sun, 14 Jun 1998 20:58:17 +0000 Subject: Try narrow down the culprit sending undefined packet types through the loopback --- sys/net/if_ethersubr.c | 9 ++++----- sys/net/if_fddisubr.c | 6 ++++-- sys/net/if_loop.c | 15 ++++++++++++++- sys/netinet/ip_output.c | 10 +++++++++- 4 files changed, 31 insertions(+), 9 deletions(-) (limited to 'sys') diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 97b9847..e523232 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 - * $Id: if_ethersubr.c,v 1.49 1998/06/12 03:48:07 julian Exp $ + * $Id: if_ethersubr.c,v 1.50 1998/06/13 02:27:10 julian Exp $ */ #include "opt_atalk.h" @@ -357,16 +357,15 @@ ether_output(ifp, m0, dst, rt0) * on the wire). However, we don't do that here for security * reasons and compatibility with the original behavior. */ - if (ifp->if_flags & IFF_SIMPLEX) { + if ((ifp->if_flags & IFF_SIMPLEX) && + (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, ETHER_HDR_LEN); } else if (bcmp(eh->ether_dhost, eh->ether_shost, ETHER_ADDR_LEN) == 0) { - if (loop_copy != -1) - (void) if_simloop(ifp, m, dst, - ETHER_HDR_LEN); + (void) if_simloop(ifp, m, dst, ETHER_HDR_LEN); return(0); /* XXX */ } } diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index ee4e847..823bf4d 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * from: if_ethersubr.c,v 1.5 1994/12/13 22:31:45 wollman Exp - * $Id: if_fddisubr.c,v 1.30 1998/05/21 00:33:16 dg Exp $ + * $Id: if_fddisubr.c,v 1.31 1998/06/12 03:48:08 julian Exp $ */ #include "opt_atalk.h" @@ -301,6 +301,7 @@ fddi_output(ifp, m0, dst, rt0) case AF_UNSPEC: { struct ether_header *eh; + loop_copy = -1; eh = (struct ether_header *)dst->sa_data; (void)memcpy((caddr_t)edst, (caddr_t)eh->ether_dhost, sizeof (edst)); if (*edst & 1) @@ -386,7 +387,8 @@ fddi_output(ifp, m0, dst, rt0) * on the wire). However, we don't do that here for security * reasons and compatibility with the original behavior. */ - if (ifp->if_flags & IFF_SIMPLEX) { + if ((ifp->if_flags & IFF_SIMPLEX) && + (loop_copy != -1)) { if ((m->m_flags & M_BCAST) || loop_copy) { struct mbuf *n = m_copy(m, 0, (int)M_COPYALL); diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index ee77758..9153923 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_loop.c 8.1 (Berkeley) 6/10/93 - * $Id: if_loop.c,v 1.33 1998/06/12 03:48:09 julian Exp $ + * $Id: if_loop.c,v 1.34 1998/06/12 20:03:26 julian Exp $ */ /* @@ -144,6 +144,19 @@ looutput(ifp, m, dst, rt) } ifp->if_opackets++; ifp->if_obytes += m->m_pkthdr.len; +#if 1 /* XXX */ + switch (dst->sa_family) { + case AF_INET: + case AF_IPX: + case AF_NS: + case AF_ISO: + case AF_APPLETALK: + default: + printf("looutput: af=%d unexpected", dst->sa_family); + m_freem(m); + return (EAFNOSUPPORT); + } +#endif return(if_simloop(ifp, m, dst, 0)); } diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 0ffc630..03aa4b6 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 - * $Id: ip_output.c,v 1.71 1998/06/06 21:49:17 julian Exp $ + * $Id: ip_output.c,v 1.72 1998/06/12 03:48:19 julian Exp $ */ #define _IP_VHL @@ -1322,6 +1322,14 @@ ip_mloopback(ifp, m, dst, hlen) * packet. For the moment, we'll err on the side * of safety by using if_simloop(). */ +#if 1 /* XXX */ + if (dst->sin_family != AF_INET) { + printf("ip_mloopback: bad address family %d\n"); + dst->sin_family); + dst->sin_family = AF_INET; + } +#endif + #ifdef notdef copym->m_pkthdr.rcvif = ifp; ip_input(copym); -- cgit v1.1