[NETFRAME] Problems with packing an IP packet
Matthew Topper
topperm9 at gmail.com
Thu Jul 12 05:50:59 CEST 2007
I'm having some strange things happen with Net::Frame::Layer::IPv4 and pack.
What I'm doing is creating a dhcp request from scratch ( my $dhcp = "\x01"
etc etc ). Then, I create a UDP message with Net::Frame::Layer::UDP,
including $dhcp as the payload. Then, I create an IP packet with
Net::Frame::Layer::IPv4 with the results of $udp->pack as its payload.
If I do the following, the results look right:
my $data = $udp->pack;
my $whole = unpack 'H*', $data;
print "The whole UDP part: $whole\n";
What prints out looks like it's supposed to. However, when I do the same
thing with the IP part, strange things happen. I get this:
The whole thing: 4500015ca91d00008011907400000000ffffffff
Here's the diagnostics that I put into the program:
UDP Headers:
4e65743a3a4672616d653a3a4c617965723a3a5544503d41525241592830783832376438333029
UDP Payload:
01010600a99b02f50000800000000000000000000000000000000000000c6eb78dca00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000638253633501013709011c02030f060c2c2fff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
UDP Fields: UDP: src:68 dst:67 length:328 checksum:0x87a4
UDP WHOLE:
00440043014887a401010600a99b02f50000800000000000000000000000000000000000000c6eb78dca00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000638253633501013709011c02030f060c2c2fff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
IP Headers:
4e65743a3a4672616d653a3a4c617965723a3a495076343d41525241592830783834373534353029
IP Payload:
00440043014887a401010600a99b02f50000800000000000000000000000000000000000000c6eb78dca00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000638253633501013709011c02030f060c2c2fff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
IP Fields: IPv4: version:4 hlen:5 tos:0x00 length:348 id:43293
IPv4: flags:0x00 offset:0 ttl:128 protocol:0x11 checksum:0x9074
IPv4: src:0.0.0.0 dst:255.255.255.255
The whole thing: 4500015ca91d00008011907400000000ffffffff
The lines that say headers are generated by doing this:
my $string = unpack "H*", $udp;
print "UDP Headers: $string\n";
Would parts of the source be useful in helping to diagnose this? Am I going
about this in the wrong way? Thank you for any help.
Matthew Topper
SUNY Geneseo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gomor.org/pipermail/netframe/attachments/20070711/74ab33bf/attachment.htm
More information about the netframe
mailing list