/[pxelator]/t/dhcp.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /t/dhcp.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 529 - (show annotations)
Fri Sep 17 18:10:47 2010 UTC (12 years ago) by dpavlin
File MIME type: application/x-troff
File size: 603 byte(s)
send bootp broadcast to dhcp server

1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4
5 use Test::More tests => 4;
6
7 use_ok 'IO::Socket::INET';
8 use Data::Dump qw(dump);
9
10 our $sock = IO::Socket::INET->new(
11 Proto => 'udp',
12 Broadcast => 1,
13 PeerPort => 67,
14 LocalPort => 68,
15 PeerAddr => '255.255.255.255',
16 ReuseAddr => 1,
17 ) or die "need root priviledges to run: $!";
18
19 foreach my $hex_dump ( glob 't/dhcp/*' ) {
20 ok( open(my $fh, '<', $hex_dump), "open $hex_dump" );
21 local $/ = undef;
22 ok( my $hex = <$fh>, 'slurp' );
23
24 diag "hex: ",dump $hex;
25 my $packet = pack 'H*', $hex;
26 diag "packet: ", dump $packet;
27
28 ok( $sock->send($packet), 'send' );
29
30 }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26