This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Loopback patch adopted OK
- To: ecos-discuss at sources dot redhat dot com
- Subject: Re: [ECOS] Loopback patch adopted OK
- From: Hugo Tyson <hmt at cygnus dot co dot uk>
- Date: 21 Jun 2000 18:46:06 +0100
- Newsgroups: cygnus.sourceware.ecos.d
- Organization: Cygnus Solutions, a Red Hat company (Cambridge, UK)
- References: <000401bfd787$80e39ae0$d30110ac@netappi.com> <pt7lbjjnru.fsf@masala.cygnus.co.uk>
Hugo Tyson <hmt@cygnus.co.uk> writes:
> "Sorin Babeanu" <sorin@netappi.com> 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;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%