summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1998-06-12 03:48:19 +0000
committerjulian <julian@FreeBSD.org>1998-06-12 03:48:19 +0000
commit1ee51dd89f8fa0c587541ec9a5d0e0a307a1319e (patch)
tree3dce44767d7ec68b96b40dff02a52db6b71dbeb0 /sys/netinet
parenteaeb937aa0099bbc5920c2a03369e096418c7518 (diff)
downloadFreeBSD-src-1ee51dd89f8fa0c587541ec9a5d0e0a307a1319e.zip
FreeBSD-src-1ee51dd89f8fa0c587541ec9a5d0e0a307a1319e.tar.gz
Go through the loopback code with a broom..
Remove lots'o'hacks. looutput is now static. Other callers who want to use loopback to allow shortcutting should call the special entrypoint for this, if_simloop(), which is specifically designed for this purpose. Using looutput for this purpose was problematic, particularly with bpf and trying to keep track of whether one should be using the charateristics of the loopback interface or the interface (e.g. if_ethersubr.c) that was requesting the loopback. There was a whole class of errors due to this mis-use each of which had hacks to cover them up. Consists largly of hack removal :-)
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/if_ether.c20
-rw-r--r--sys/netinet/ip_input.c9
-rw-r--r--sys/netinet/ip_output.c8
3 files changed, 16 insertions, 21 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index c744e7f..c3115ed 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_ether.c 8.1 (Berkeley) 6/10/93
- * $Id: if_ether.c,v 1.45 1998/05/23 08:03:40 phk Exp $
+ * $Id: if_ether.c,v 1.46 1998/06/07 17:12:12 dfr Exp $
*/
/*
@@ -104,7 +104,8 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUTO, proxyall, CTLFLAG_RW,
&arp_proxyall, 0, "");
static void arp_rtrequest __P((int, struct rtentry *, struct sockaddr *));
-static void arprequest __P((struct arpcom *, u_int32_t *, u_int32_t *, u_char *));
+static void arprequest __P((struct arpcom *,
+ struct in_addr *, struct in_addr *, u_char *));
static void arpintr __P((void));
static void arptfree __P((struct llinfo_arp *));
static void arptimer __P((void *));
@@ -183,8 +184,8 @@ arp_rtrequest(req, rt, sa)
/* Announce a new entry if requested. */
if (rt->rt_flags & RTF_ANNOUNCE)
arprequest((struct arpcom *)rt->rt_ifp,
- &SIN(rt_key(rt))->sin_addr.s_addr,
- &SIN(rt_key(rt))->sin_addr.s_addr,
+ &SIN(rt_key(rt))->sin_addr,
+ &SIN(rt_key(rt))->sin_addr,
(u_char *)LLADDR(SDL(gate)));
/*FALLTHROUGH*/
case RTM_RESOLVE:
@@ -275,7 +276,7 @@ arp_rtrequest(req, rt, sa)
static void
arprequest(ac, sip, tip, enaddr)
register struct arpcom *ac;
- register u_int32_t *sip, *tip;
+ register struct in_addr *sip, *tip;
register u_char *enaddr;
{
register struct mbuf *m;
@@ -374,9 +375,8 @@ arpresolve(ac, rt, m, dst, desten, rt0)
rt->rt_expire = time_second;
if (la->la_asked++ < arp_maxtries)
arprequest(ac,
- &(SIN(rt->rt_ifa->ifa_addr)->sin_addr.s_addr),
- &(SIN(dst)->sin_addr.s_addr),
- ac->ac_enaddr);
+ &SIN(rt->rt_ifa->ifa_addr)->sin_addr,
+ &SIN(dst)->sin_addr, ac->ac_enaddr);
else {
rt->rt_flags |= RTF_REJECT;
rt->rt_expire += arpt_down;
@@ -642,8 +642,8 @@ arp_ifinit(ac, ifa)
struct ifaddr *ifa;
{
if (ntohl(IA_SIN(ifa)->sin_addr.s_addr) != INADDR_ANY)
- arprequest(ac, &(IA_SIN(ifa)->sin_addr.s_addr),
- &(IA_SIN(ifa)->sin_addr.s_addr), ac->ac_enaddr);
+ arprequest(ac, &IA_SIN(ifa)->sin_addr,
+ &IA_SIN(ifa)->sin_addr, ac->ac_enaddr);
ifa->ifa_rtrequest = arp_rtrequest;
ifa->ifa_flags |= RTF_CLONING;
}
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 19ceef1..3020a58 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_input.c 8.2 (Berkeley) 1/4/94
- * $Id: ip_input.c,v 1.88 1998/06/06 20:45:27 julian Exp $
+ * $Id: ip_input.c,v 1.89 1998/06/06 21:49:16 julian Exp $
* $ANA: ip_input.c,v 1.5 1996/09/18 14:34:59 wollman Exp $
*/
@@ -250,7 +250,7 @@ ip_input(struct mbuf *m)
u_short sum;
#ifdef DIAGNOSTIC
- if ((m->m_flags & M_PKTHDR) == 0)
+ if (m == NULL || (m->m_flags & M_PKTHDR) == 0)
panic("ip_input no HDR");
#endif
/*
@@ -266,11 +266,6 @@ ip_input(struct mbuf *m)
if (m->m_pkthdr.len < sizeof(struct ip))
goto tooshort;
-#ifdef DIAGNOSTIC
- if (m->m_len < sizeof(struct ip))
- panic("ipintr mbuf too short");
-#endif
-
if (m->m_len < sizeof (struct ip) &&
(m = m_pullup(m, sizeof (struct ip))) == 0) {
ipstat.ips_toosmall++;
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 59a4416..0ffc630 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.70 1998/06/06 20:45:28 julian Exp $
+ * $Id: ip_output.c,v 1.71 1998/06/06 21:49:17 julian Exp $
*/
#define _IP_VHL
@@ -1320,13 +1320,13 @@ ip_mloopback(ifp, m, dst, hlen)
* in-place). Yet another option is using the
* protosw directly to deliver the looped back
* packet. For the moment, we'll err on the side
- * of safety by continuing to abuse looutput().
+ * of safety by using if_simloop().
*/
#ifdef notdef
copym->m_pkthdr.rcvif = ifp;
- ip_input(copym)
+ ip_input(copym);
#else
- (void) looutput(ifp, copym, (struct sockaddr *)dst, NULL);
+ if_simloop(ifp, copym, (struct sockaddr *)dst, 0);
#endif
}
}
OpenPOWER on IntegriCloud