From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hugo Tyson To: ecos-discuss@sources.redhat.com Subject: Re: [ECOS] Loopback patch adopted OK Date: Wed, 05 Sep 2001 00:10:00 -0000 Message-ID: References: <000401bfd787$80e39ae0$d30110ac@netappi.com> X-SW-Source: 2001-09/msg00087.html Message-ID: <20010905001000.CwxSt7hCKYKgqrPFl8c-8gORmBDn0XhpN3xNyMMUgm0@z> Hugo Tyson writes: > "Sorin Babeanu" writes: > > The attached patch contains a few modifications I have made in order to make > > the loopback interface work on eCos without a real network device. > > It also contains tests for ping, udp and tcp. > > Just to keep folks up to date: Sorin, thanks for that. I'm in the process > of adopting it into the trunk - actually a variation on your patch which > sets up the loopback dev in init_all_network_interfaces(), and is more > configurable for 0,1,N loopback devs. > > The tests are great, thanks, we can start to run meaningful network tests > on all platforms with those in place, I'll just be adding PASS/FAIL > messages so we can automate those in our test farm. > > It'll all show up in anoncvs by the end of this week. > > Is there any call for me to supply an alternative patch on this forum? > I won't do so unless people ask. Any replies to the list please, not me. Phew, done that... ;-) Sorin, I didn't see what the change in if_loop.c (pasted below) achieved, so I didn't adopt it. Can you explain more, convince me? (I have got the location it patches right haven't I, ie. looutput()?) It seems to just do a load of checking twice, in a different order; I mean the original looutput() checks for RTF_REJECT|RTF_BLACKHOLE &c, and returns EAFNOSUPPORT with a bad AF. Was this just experimentation while you were testing the startup code, that leaked out? Anyway, thanks again for the contribution; keep up the good work! Watch anoncvs for our updates to emerge... end of the week sometime. - Huge %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% int looutput(ifp, m, dst, rt) struct ifnet *ifp; register struct mbuf *m; struct sockaddr *dst; register struct rtentry *rt; { + if ((m->m_flags & M_PKTHDR) == 0) + panic("looutput no HDR"); + + if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) { + m_freem(m); + return (rt->rt_flags & RTF_BLACKHOLE ? 0 : + rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH); + } + 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: + break; + default: + printf("looutput: af=%d unexpected", dst->sa_family); + m_freem(m); + return (EAFNOSUPPORT); + } +#endif + return(if_simloop(ifp, m, dst, 0)); +} + + +int +if_simloop(ifp, m, dst, rt) + struct ifnet *ifp; + register struct mbuf *m; + struct sockaddr *dst; + register struct rtentry *rt; +{ int s, isr; register struct ifqueue *ifq = 0; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%