From: Hugo Tyson <hmt@cygnus.co.uk>
To: ecos-discuss@sourceware.cygnus.com
Subject: Re: [ECOS] Loopback patch adopted OK
Date: Wed, 21 Jun 2000 11:00:00 -0000 [thread overview]
Message-ID: <ptya3zgc69.fsf_-_@masala.cygnus.co.uk> (raw)
In-Reply-To: <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;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WARNING: multiple messages have this Message-ID
From: Hugo Tyson <hmt@cygnus.co.uk>
To: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] Loopback patch adopted OK
Date: Wed, 05 Sep 2001 00:10:00 -0000 [thread overview]
Message-ID: <ptya3zgc69.fsf_-_@masala.cygnus.co.uk> (raw)
Message-ID: <20010905001000.CwxSt7hCKYKgqrPFl8c-8gORmBDn0XhpN3xNyMMUgm0@z> (raw)
In-Reply-To: <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;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
next prev parent reply other threads:[~2000-06-21 11:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-06-16 4:37 [ECOS] Loopback patch Sorin Babeanu
2000-06-21 4:15 ` Hugo Tyson
2000-06-21 11:00 ` Hugo Tyson [this message]
2001-09-05 0:10 ` [ECOS] Loopback patch adopted OK Hugo Tyson
2001-09-05 0:10 ` [ECOS] Loopback patch Hugo Tyson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ptya3zgc69.fsf_-_@masala.cygnus.co.uk \
--to=hmt@cygnus.co.uk \
--cc=ecos-discuss@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).