Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 260032 - Net::DHCP::Constants provides incorrect DHCP option value for DHCPLEASEQUERY
Summary: Net::DHCP::Constants provides incorrect DHCP option value for DHCPLEASEQUERY
Status: VERIFIED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Perl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-23 17:55 UTC by Dan Thorson
Modified: 2009-02-25 13:25 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Thorson 2009-02-23 17:55:11 UTC
DHCPLEASEQUERY is assigned a value of 10, per RFC4388, however Net::DHCP::Contstants (installed with Net::DHCP::Packet) has the pre-standard value of 13.

Reproducible: Always

Steps to Reproduce:
1. Attempt to use Net::DHCP::Packet with a DHCP_MESSAGE set to DHCPLEASEQUERY
2. Since value of DHCPLEASEQUERY is incorrect (13) the packet is ignored by the DHCP server.
3. The following example is from the documentation for Net::DHCP::Packet.  Substituting the value 10 for DHCPLEASEQUERY will change this from a non-working to working script.

http://search.cpan.org/~shadinger/Net-DHCP-0.66/lib/Net/DHCP/Packet.pm

#!/usr/bin/perl
# Simple DHCP client - send a LeaseQuery (by IP) and receive the response

use IO::Socket::INET;
use Net::DHCP::Packet;
use Net::DHCP::Constants;

$usage = "usage: $0 DHCP_SERVER_IP DHCP_CLIENT_IP\n"; $ARGV[1] || die $usage;

# create a socket
$handle = IO::Socket::INET->new(Proto => 'udp',
                                Broadcast => 1,
                                PeerPort => '67',
                                LocalPort => '67',
                                timeout => 5,
                                PeerAddr => $ARGV[0])
        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() => DHCPLEASEQUERY
                );

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

#receive response
$handle->recv($newmsg, 1024) or die;

$packet = Net::DHCP::Packet->new($newmsg);
print $packet->toString();

Actual Results:  
DHCP query is ignored

Expected Results:  
DHCP server responds with LEASEQUERY data (or at least logs a failed message in the DHCP daemon's log file)

http://search.cpan.org/~shadinger/Net-DHCP-0.66/lib/Net/DHCP/Packet.pm

A message has been sent to the package's author shadinger at cpan (dot org)
Comment 1 Krzysztof Pawlik (RETIRED) gentoo-dev 2009-02-25 00:27:07 UTC
From what portage package this module comes from?
Comment 2 Torsten Veller (RETIRED) gentoo-dev 2009-02-25 07:25:44 UTC
Do we have Net-DHCP in the tree?

There is a bug report at http://rt.cpan.org/Public/Bug/Display.html?id=32962 too

Thanks
Comment 3 Dan Thorson 2009-02-25 13:25:46 UTC
My bad... I installed this using CPAN, not portage.  Apologies for the mistake.