ts-7000
[Top] [All Lists]

Re: [ts-7000] RE: ts-7800 how do I make 4 (at least 2) identical network

To:
Subject: Re: [ts-7000] RE: ts-7800 how do I make 4 (at least 2) identical network stacks?
From: Jonathan Leslie <>
Date: Mon, 4 Nov 2013 10:34:54 -0800 (PST)


I don't know if this is relative or not, but to do what I wanted with 2 devices with the QNX OS, I boot setup was this:

# start network driver
display_msg "---> Starting network"
io-pkt-v4-hc -d e1000 did=0x1501 -ptcpip -v
waitfor /dev/socket 3
ifconfig wm0 192.168.1.127/24
#dhcp.client -u -i wm0 
io-pkt-v4-hc -d e1000 did=0x10d3 -ptcpip prefix=/alt -v
waitfor /alt/dev/socket 6

...

SOCK=/alt
ifconfig wm0 192.168.1.27/24
sleep 1
SOCK=/


So I had two SOCK element which were the 2 different IP STACKS.


In a C program all I had to do was set which SOCK I was using to determine what network I was on:

//////////////////////////////////////////////////////////////////////////////
int sockReceiveThread() {
struct sockaddr_in sa;
struct sockaddr_in sb;
unsigned char buffer[128];
int recPort = -1;
ssize_t recsize;
socklen_t fromlen;
CIMConfigReq_t requestOut;
char addrBuff[INET_ADDRSTRLEN];

setenv("SOCK", "/alt", 1);
//same as boomcom, but lower than correlator and console
setprio(getpid(), 21);

requestOut.requestID = CIMRECPORTREQUEST;
MsgSend(configCoid, &requestOut, sizeof(CIMConfigReq_t), &cimRecPort,
sizeof(int));

//printf("Crows receive port = %d\n", cimRecPort);

cimRecSocket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (cimRecSocket == -1) {
sprintf(lmsg.buff, "INIT->ERROR: CROWSCOM could not open socket\n");
MsgSend(loggerCoid, &lmsg, sizeof(logMessage_t), NULL, 0);
}

memset(&sa, 0x0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = htonl(INADDR_ANY);
sa.sin_port = htons(cimRecPort);

if (-1 == bind(cimRecSocket, (struct sockaddr*) &sa, sizeof(sa))) {
sprintf(lmsg.buff, "INIT->ERROR: CROWSCOM could not bind to socket\n");
MsgSend(loggerCoid, &lmsg, sizeof(logMessage_t), NULL, 0);
close(cimRecSocket);
return -1;
        }

fromlen = sizeof(sb);

while (1) {
recsize = recvfrom(cimRecSocket, (void*) buffer, sizeof(buffer), 0,
(struct sockaddr*) &sb, &fromlen);
                // process buffer...

                }// end while 
  }// end function sockReceiveThread
////////////////////////////////////////////////////////////////////


I could make 2 threads, and by changing the one line:

setenv("SOCK", "/alt", 1);

to

setenv("SOCK", "/", 1);

I was on the alternate network, I was still node 1.1.1.200, but talking on a completely different network and the other program(thread) new nothing of this process.   
I'm in touch with the folks at QNX to see if I can add a pc104 network card and have 

SOCK=/
SOCK=/alt
SOCK=/alt2
SOCK=/alt3

but I really want to do this with the TS-8700 board.  So can I do it or not with a Ts-8700?

Can I do it with a TS-7500 and 2 usb-ethernet dongles?












From: Jonathan Leslie <>
To: "" <>
Sent: Monday, November 4, 2013 1:13 PM
Subject: Re: [ts-7000] RE: ts-7800 how do I make 4 (at least 2) identical network stacks?

 
" The four interfaces can be given four different addresses"   I'm not sure what you mean by this and I don't expect the kernel to do route anything.   
I want 4 interfaces (networks) that I can address individually  so as I am talking to right legacy device .101 that I want to.




From: "" <>
To:
Sent: Monday, November 4, 2013 11:04 AM
Subject: [ts-7000] RE: ts-7800 how do I make 4 (at least 2) identical network stacks?

 
 I think the salient issue is that the four legacy boxes need to be on separate networks. Each of the ethernet interfaces can be a separate network. The four interfaces can be given four different addresses. The custom application (or any application at all; the magic will be done in the kernel with the iptables rules) talks to IP addresses which get trapped by rules which NAT/route the destination addresses to a specific interface. Any application can then talk to a specific IP address, but the kernel will route the traffic to a 10.1.1.xxx address on the correct interface. This is conceptually similar to using Linux to create a LAN-WAN router with port forwarding, except in this case, the WAN side is internal to the Linux host, and there are multiple LAN interfaces.
Totally do-able, but will take some fiddling to get the right rules.



---In <> wrote:

You can be a pro in some areas but not others. The guy admits his experience is only at the socket level. That's not enough for what he wants to do. Its not silly to be ignorant, it is silly to stay that way. BTW he's been given a lot of bad advice on this forum.
He will either have to hire help, or do a lot of work.
--------------------------------------------
On Mon, 11/4/13, Petr Štetiar <m("...","ynezz");" target="_blank" href="">> wrote:

Subject: Re: [ts-7000] RE: ts-7800 how do I make 4 (at least 2) identical network stacks?
To: m("yahoogroups.com","ts-7000");" target="_blank" href="">
Date: Monday, November 4, 2013, 2:14 AM

Jonathan Leslie <m("...","jleslie48");" target="_blank" href="">>
[2013-11-03 06:30:51]:

> I'm confused,  I have to send messages to  two
different devices, both have
> address 1.1.1.101. The way I've done it in the past was
to set up two
> different IP stacks, with different SOCK.  I want to
repeat this on a
> TS-7800 only this time I need 4 different IP stacks as
I have 4 different
> devices 1.1.1.101.

What's so confusing in "Buy TCP/IP book and read it" ?

I don't know what a SOCK is neither I know what you've done
in the past.

What I know is, that you're kind of a silly guy, which is
calling himself a
Pro, but don't know even basic networking stuff. And as a
bonus point, you're
going to use USB ethernet in production...

Pro would buy OpenWrt capable 4-5 port router and would do
NAT with iptables.

-- ynezz


------------------------------------

Yahoo Groups Links


    m("yahoogroups.com","ts-7000-fullfeatured");" target="_blank" href="">






__._,_.___


Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe

__,_._,___
<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU