16 *{ $pkg . '::inet_aton' } = \&inet_aton;
17 *{ $pkg . '::inet_ntoa' } = \&inet_ntoa;
29 my $num = unpack('N', pack('C*', split(/\./, $_[0])));
42 (my $libnet_t = __FILE__) =~ s/config.t/libnet_t.pl/;
48 ok( exists $INC{'Net/Config.pm'}, 'Net::Config should have been used' );
49 ok( keys %NetConfig, '%NetConfig should be imported' );
52 undef $NetConfig{'ftp_firewall'};
53 is( Net::Config->requires_firewall(), 0,
54 'requires_firewall() should return 0 without ftp_firewall defined' );
56 $NetConfig{'ftp_firewall'} = 1;
57 is( Net::Config->requires_firewall('a.host.not.there'), -1,
58 '... should return -1 without a valid hostname' );
61 delete $NetConfig{'local_netmask'};
62 is( Net::Config->requires_firewall('127.0.0.1'), 0,
63 '... should return 0 without local_netmask defined' );
65 $NetConfig{'local_netmask'} = '127.0.0.1/24';
66 is( Net::Config->requires_firewall('127.0.0.1'), 0,
67 '... should return false if host is within netmask' );
68 is( Net::Config->requires_firewall('192.168.10.0'), 1,
69 '... should return true if host is outside netmask' );
71 # now try more netmasks
72 $NetConfig{'local_netmask'} = [ '127.0.0.1/24', '10.0.0.0/8' ];
73 is( Net::Config->requires_firewall('10.10.255.254'), 0,
74 '... should find success with mutiple local netmasks' );
75 is( Net::Config->requires_firewall('192.168.10.0'), 1,
76 '... should handle failure with multiple local netmasks' );
78 is( \&Net::Config::is_external, \&Net::Config::requires_firewall,
79 'is_external() should be an alias for requires_firewall()' );