Hi,

I've got a program that wants to broadcast a packet and accept a unicast
reply.  I can see with wireshark that the broadcast is made and a node
on the network does respond with it's source set to it's unicast
address, however my perl process never seems to get the response.

If I change the target from 255.255.255.255 to a unicasted address, my
perl process does get the response.

Here's how I'm creating my socket and sending and receiving:

$handle = IO::Socket::INET->new(Proto => 'udp',
                                Broadcast => 1,
                                ReuseAddr => 1,
                                PeerPort => '67',
                                LocalPort => '68',
                                LocalAddr => "10.10.1.1",
                                PeerAddr => "255.255.255.255")
              or die "socket: $@";     # yes, it uses $@ here

# create DHCP Packet
$inform = Net::DHCP::Packet->new(
                    op => BOOTREQUEST(),
                    Htype  => '0',
                    Hlen   => '0',
                    Ciaddr => $ARGV[1],
                    Giaddr => $handle->sockhost(),
                    Xid => int(rand(0xFFFFFFFF)),     # random xid
                    DHO_DHCP_MESSAGE_TYPE() => DHCPINFORM,
                    DHO_DHCP_PARAMETER_REQUEST_LIST() => '1 6 15 121',
                    );

# send request
$handle->send($inform->serialize()) or die "Error sending Inform: $!\n";

#receive response
$handle->recv($newmsg, 1024) or die;
$packet = Net::DHCP::Packet->new($newmsg);

Any ideas why my process doesn't get the packet that is unicasted back
to my machine?  FWIW, this is being done on a PPP interface.

Cheers,
b.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to