On Wed, Apr 18, 2001 at 04:26:56AM -0700, Paul Makepeace wrote:
> On Wed, Apr 18, 2001 at 12:11:45PM +0100, Dominic Mitchell wrote:
> > You're probably going to have to grep through the kernel source to see
> > why it's being returned in that case.  And I have a sneaky suspicion
> > that the networking stuff is quite changed from the "normal" BSDs...
> 
> I've been using Rich Stevens's bible and stuff compiles copy/pasted.
> 
> OK, I can't even ping 255.255.255.255 (when PPP is down, but when it's up
> it's OK):
> 
> # ping 255.255.255.255
> PING broadcasthost (255.255.255.255): 56 data bytes
> ping: sendto: No route to host
> ping: wrote broadcasthost 64 chars, ret=-1
> ^C
> 
> [ppp up]
> # ping 255.255.255.255
> PING broadcasthost (255.255.255.255): 56 data bytes
> 64 bytes from 209.232.142.2: icmp_seq=0 ttl=255 time=163.571 ms
> 64 bytes from 209.232.142.2: icmp_seq=1 ttl=255 time=2954.65 ms
> 64 bytes from 209.232.142.2: icmp_seq=2 ttl=255 time=1968.95 ms
> 
> # netstat -nr
> Routing tables
> 
> Internet:
> Destination        Gateway            Flags     Refs     Use     Netif
> Expire
> default            209.232.142.2      UGSc        3        0     ppp0
> 127.0.0.1          127.0.0.1          UH          9     2099      lo0
> 192.168            link#2             UC          0        0      en0
> 192.168.0.1        0:30:65:7e:d1:96   UHLW        0       14      lo0
> 192.168.0.255      ff:ff:ff:ff:ff:ff  UHLWb       0        8      en0
> 
> So for whatever reason it's not being recognized and turned into an
> Ethernet 48bit broadcast.

Don't forget that there are 4 different kinds of broadcast.  :-)

You're using a "limited broadcast address", which is not being
interpreted specially by the kernel and is going down the default route.
Which probably doesn't exist when you're not dialled up.  Hint:  "route
-n get" is a useful tool for finding out what the kernel would do when
presented with an IP address.

You'd probably be better off using a subnet-directed broadcast, which
does have a route set up for you: 192.168.0.255.

According to the book in front of me (UNP2v1, P472):

    "Another question is: what does a multi-homed host do when the
    application sends a UDP datagram to 255.255.255.255?  Some systems
    send a single broadcast on the primary interface (the first
    interface that was configured) with the destination IP address
    set to the subnet-directed broadcast address of that interface.
    Other systems send one copy of the datagram from each broadcast
    capable interface.  Section 3.3.6 of RFC 1122 ``takes no stand''
    on this issue.  For portability, however, if an application needs
    to send a broadcast out from all broadcast capable interfaces,
    it should obtain the interface configuration and do one sendto for
    each broadcast capable interface with the destination set to that
    interface's broadcast address."

In short, what happens is very system dependent.  :-(

-Dom

Reply via email to