Hi,
I'm trying to build a SYSBIOS 6+NDK 2.20 application which will replace 3 existing boards. Ideally I would like to have a "drop in" replacement that can pretend to be all three. Say they have IP addresses 192.168.5.16, 192.168.5.17, 192.168.5.18 - I'd like to be able to listen on all three addresses using the same physical interface, and bind separate sockets to listen on each.
In principle, the NDK seems to support having multiple addresses per interface. In practice, it regards them as duplicate if they have the same subnet modulo the subnet mask, except for PPP interfaces. The relevant test is in bind.c:
// Search for duplicate bindings
if( (pbtmp = (BIND *)BindFindByHost(0, IPHost) ) ||
((IPNet!=0xffffffff) && (pbtmp = (BIND *)BindFindByNet(0, IPNet))) )
{
// Duplicate bindings allowed on PPP links
if( type != HTYPE_PPP && IFGetType(pbtmp->hIF) != HTYPE_PPP )
{
DbgPrintf(DBG_WARN,"BindNew: Duplicate bindings ignored");
return(0);
}
}
I realise there is a potential routing ambiguity if the subnet is the same, but Windows is quite happy to bind to 3 addresses in this way so I had hoped there would be a way to do it. I do need the packets outbound from the device to appear to come from the address matching the socket, but I would have thought binding the socket to the address would do that.
Is there any way to do what I'm after? Or do I need to change the client code, which I'd prefer to avoid?
Thanks in advance,
Gordon