Re: OpenTransport behaviour under X
Re: OpenTransport behaviour under X
- Subject: Re: OpenTransport behaviour under X
- From: Marc Stibane <email@hidden>
- Date: Fri, 31 Oct 2003 00:51:21 +0100
>
> Well, my code did also send out packets to 255.255.255.255. But the
>
> server on the other end didn't think it should accept the packets,
>
> since
>
> the Ethernet Address in the packet header wasn't set to the correct
>
> local
>
> subnet broadcast address. Funny, OT on 9 native and on Classic do set
>
> this automagically.
>
>
I'm curious about this. There is no "local subnet broadcast address"
>
in the Ethernet spec. There is broadcast and multicast. Both the
>
broadcast IP address and the subnet broadcast IP address should
>
translate to the ethernet broadcast address. Can you be more specific
>
about the reason the remote host ignored/rejected the packet?
the code looks like this:
#define INADDR_BROADCAST (UInt32)0xffffffff
struct sockaddr_in server, host;
// First get my own IP address
InetInterfaceInfo OTInetInfo;
if (OTInetGetInterfaceInfo(&OTInetInfo,kDefaultInetInterface)==noErr)
host.sin_addr.s_addr = OTInetInfo.fAddress;
else
return -1;
host.sin_family = AF_INET;
host.sin_port = htons(HOST_UDP_PORT);
// host.sin_addr.s_addr = IP;
server.sin_family = AF_INET;
server.sin_port = htons(SERV_UDP_PORT);
server.sin_addr.s_addr = INADDR_BROADCAST;
and then opens an endpoint, binds it to "host" and sends the packet to
"server". The packet data looks similar under 9 and under X, but in the
packet header 9 replaces the broadcast address INADDR_BROADCAST
(255.255.255.255) with the local subnet broadcast address, while X
doesn't change it.
When I did this myself by changing the last line of code to read:
server.sin_addr.s_addr = OTInetInfo.fBroadcastAddr;
then the packet header carries my local subnet broadcast address
192.168.102.255 and now the RIP will accept the packet (and answer it).
I wouldn't have found that Gotcha (since the packet data I captured with
tcpdump looked OK) myself, our network specialist did examine the headers
also...
Marc Stibane
Fesh! email@hidden
Kurf|rstenstr. 154 tel +49-30-3990 2690
10785 Berlin, Germany mobil +49-173-6522 422
In a world without walls and fences,
who needs windows and gates?
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.