Subject: Re: Sending Broadcast UDP packet
To: None <amitg@hss.hns.com>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: netbsd-help
Date: 12/26/2003 17:54:55
On Thu, Dec 25, 2003 at 01:08:01PM +0530, amitg@hss.hns.com wrote:
> 
> 
> 
> 
> Hi All,
> 
> I need some help in sending IPv4 broadcast packet UDP packet from a netbsd
> machine 1.6.1 version.
> My requirement is that i want to send out broadcast packet from a specific
> interface and it should have the sopurce address
> as the primary address of that interface.
> 
> FOr this i am taking the following stepos:
> 1. Opening a socket
> 2. binding the socket with IP address INETADDR_ANY
> 3. enabling SO_BRODCAST by calling the respective socket option.
> 4. Setting the outgoing interface with setsockopt to specify outgoing
> interface for multicast apcket
> 5. Setting the destination address 0xffffffff.
> 
> Unfortunately  i am not getting the desired output. What is happening is
> 
> 1. Destination address is changed to the interface brodcast address. This
> too also not of the interface i have specified using socket option but of
> the
>     first interface created in the system.
> 2. Source address is choosen as the primary address of the interface whose
> broadcast address is assigned to the packet.
> 
> I need some help to resolve this. Do i need to make some changes in the
> netbsd kernel to support this or i am missing some steps in the socket
> application
> to take care of this.
> 
> Pls let me know if you have some useful pointers regarding this.  I need it
> urgently.

You either need to send you packet to the broadcast address of the interface,
or possibly bind the socket to the primary address of the interface.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 23 ans d'experience feront toujours la difference
--