[Spread-users] Trouble binding to specific interface
Jonathan Stanton
jonathan at cnds.jhu.edu
Thu Nov 15 23:02:07 EST 2001
Ah Ha. A special case where you do not need a broadcast bind because there
is only one daemon running, so if you try to do the broadcast bind you end
up binding to 0.0.0.0 instead of 127.0.0.255. I've attached a patch to this
email that fixes the problem for me.
Tell me if you find any more quirks like this.
Thanks,
Jonathan
On Thu, Nov 15, 2001 at 07:32:33PM -0800, Dave Parker wrote:
> I'm trying to set up a spread daemon such that it only listens on the
> loopback interface, thus:
>
> DebugFlags = { PRINT EXIT }
> EventLogFile = /var/log/spread.log
> EventTimeStamp
> DangerousMonitor = true
> Spread_Segment 127.0.0.255:4803 {
> localhost 127.0.0.1 {
> D 127.0.0.1
> C 127.0.0.1
> }
> }
>
> It is however consistently failing to start:
>
> [Fri 16 Nov 2001 03:17:25] DL_init_channel: bind error for port 4803,
> already running
>
> An strace reveals:
>
> socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
> bind(3, {sin_family=AF_INET, sin_port=htons(4803),
> sin_addr=inet_addr("0.0.0.0")}}, 16) = 0
> setsockopt(3, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0
> socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5
> bind(5, {sin_family=AF_INET, sin_port=htons(4803),
> sin_addr=inet_addr("127.0.0.1")}}, 16) = -1 EADDRINUSE (Address already
> in use)
>
> Any ideas?
>
>
> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users
--
-------------------------------------------------------
Jonathan R. Stanton jonathan at cs.jhu.edu
Dept. of Computer Science
Johns Hopkins University
-------------------------------------------------------
-------------- next part --------------
--- network.c.orig Thu Nov 15 21:57:27 2001
+++ network.c Thu Nov 15 21:58:05 2001
@@ -124,7 +124,8 @@
interface_addr = 0;
else {
interface_addr = My.ifc[i].ip;
- Bcast_channel[Num_bcast_channels++] = DL_init_channel( RECV_CHANNEL, My.port, Bcast_address, Bcast_address );
+ if (Bcast_needed)
+ Bcast_channel[Num_bcast_channels++] = DL_init_channel( RECV_CHANNEL, My.port, Bcast_address, Bcast_address );
}
Bcast_channel[Num_bcast_channels++] = DL_init_channel( RECV_CHANNEL, My.port, Bcast_address, interface_addr );
Token_channel[Num_token_channels++] = DL_init_channel( RECV_CHANNEL, My.port+1, 0, interface_addr );
More information about the Spread-users
mailing list