Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - strange behavior when starting qconn from bsh script: (3 Items)
   
strange behavior when starting qconn from bsh script  
Hi,

I'm starting qconn from the bsh script upon boot, but the target does not appear as active/connected on the host until I
 do a "ping <host>" from the target serial shell. Board is MPC8313.

I do the following:

io-pkt-v4 -dmpc85xx mac=000012345678 -ptcpip &
waitfor /dev/io-net/en0
waitfor /dev/socket 4
ifconfig en1 192.168.80.2
[other stuff]
qconn port=8000

But, as I wrote, Momentics only connects once I ping.

I tried to mechanize this and added this as the last command:
ping -c 5 192.168.80.1

Behavior of the five ping packets:
- ping
- ping
- ping
- no reply
- no reply

From the command line, ping always succeeds when called as soon as the shell prompt appears. How can this be?

After this, the target appears in Momentics, but i wonder nevertheless:
- how can I make it connect automatically without pinging
- why are the first three automated  pings succeeding, the two last automated pings not, and from the shell it's always 
successful?

Greetings,
 Marc
RE: strange behavior when starting qconn from bsh script  
Hi Marc:
   I've seen this before and I THINK that what it means is that the the MAC that was used by UBOOT is different from the
 MAC that you're assigning on the command line (and you're using the same IP address for both UBOOT and the stack).  If 
you get things up and running and do an "arp -a" on the host side before the ping, you'll probably see that the MAC for 
192.168.80.2 ISN'T 000012345678.  Now WHY this happens I'm not so sure.  When the stack starts up, it sends out a 
gratuitous ARP (see http://wiki.wireshark.org/Gratuitous_ARP) to advertise the MAC / IP mapping.  Why the host isn't 
picking it up and modifying it's arp table, I'm not sure.  The ping fixes the ARP table so that everything falls in line
 again.

I'm not sure why the pings fail when called from within the startup script....  I'll try and take a look see.

  Robert.


-----Original Message-----
From: Marc Roessler [mailto:community-noreply@qnx.com]
Sent: Fri 11/14/2008 7:34 AM
To: technology-networking
Subject: strange behavior when starting qconn from bsh script
 
Hi,

I'm starting qconn from the bsh script upon boot, but the target does not appear as active/connected on the host until I
 do a "ping <host>" from the target serial shell. Board is MPC8313.

I do the following:

io-pkt-v4 -dmpc85xx mac=000012345678 -ptcpip &
waitfor /dev/io-net/en0
waitfor /dev/socket 4
ifconfig en1 192.168.80.2
[other stuff]
qconn port=8000

But, as I wrote, Momentics only connects once I ping.

I tried to mechanize this and added this as the last command:
ping -c 5 192.168.80.1

Behavior of the five ping packets:
- ping
- ping
- ping
- no reply
- no reply

From the command line, ping always succeeds when called as soon as the shell prompt appears. How can this be?

After this, the target appears in Momentics, but i wonder nevertheless:
- how can I make it connect automatically without pinging
- why are the first three automated  pings succeeding, the two last automated pings not, and from the shell it's always 
successful?

Greetings,
 Marc

_______________________________________________
Technology
http://community.qnx.com/sf/go/post16568


Attachment: Text winmail.dat 3.66 KB
RE: strange behavior when starting qconn from bsh script  
Hi Marc:
	I've confirmed a couple of things:

1) For whatever reason, Windows doesn't process gratuitous ARPs.  This
seems to be a well known ummm... feature.  Windows won't refresh the ARP
cache with new info until the entry times out (which is something like 3
minutes by default).  So when you change the MAC / IP mapping underneath
it, it will reply to the old MAC and you lose communications.

However, this probably doesn't matter because:

2) We send out our gratuitous ARP before the interface has negotiated a
link, so it doesn't make the wire (!)  This is only a problem when the
interface first comes up.  You can kind of get around it by doing an
ifconfig up and waiting a few seconds for the link to be established
before assigning the IP address.  I've raised a PR for it internally,
but it will likely be a tricky one to fix (since you either have to
"wait" for the link to come up before issuing the ARP or queue the
packet in the driver until the link comes up.

So the easiest way to workaround this is to make sure that either a)
your UBOOT MAC is the same as your io-pkt MAC or b) use a different IP
address for io-pkt than you do for UBOOT.

I can't reproduce your ping issue with my install.  In my case, I lose
the first 3 packets or so (which makes sense since the interface hasn't
negotiated a link) and then everything works fine thereafter....

	Robert.


Just as a side note to this...

If you're using the io-pkt native devnp-m8c85xx driver (rather than
devn-mpc85xx.so), then the waitfor /dev/io-net/en0 isn't relevant since
the driver doesn't register itself with the /dev/io-net namespace
anymore.

 

-----Original Message-----
From: Marc Roessler [mailto:community-noreply@qnx.com] 
Sent: Friday, November 14, 2008 7:34 AM
To: technology-networking
Subject: strange behavior when starting qconn from bsh script

Hi,

I'm starting qconn from the bsh script upon boot, but the target does
not appear as active/connected on the host until I do a "ping <host>"
from the target serial shell. Board is MPC8313.

I do the following:

io-pkt-v4 -dmpc85xx mac=000012345678 -ptcpip & waitfor /dev/io-net/en0
waitfor /dev/socket 4 ifconfig en1 192.168.80.2 [other stuff] qconn
port=8000

But, as I wrote, Momentics only connects once I ping.

I tried to mechanize this and added this as the last command:
ping -c 5 192.168.80.1

Behavior of the five ping packets:
- ping
- ping
- ping
- no reply
- no reply

From the command line, ping always succeeds when called as soon as the
shell prompt appears. How can this be?

After this, the target appears in Momentics, but i wonder nevertheless:
- how can I make it connect automatically without pinging
- why are the first three automated  pings succeeding, the two last
automated pings not, and from the shell it's always successful?

Greetings,
 Marc

_______________________________________________
Technology
http://community.qnx.com/sf/go/post16568