8 if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
9 print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
11 $INC{'Socket.pm'} = 1;
19 *{ $pkg . '::inet_aton' } = \&inet_aton;
20 *{ $pkg . '::inet_ntoa' } = \&inet_ntoa;
32 my $num = unpack('N', pack('C*', split(/\./, $_[0])));
45 (my $libnet_t = __FILE__) =~ s/config.t/libnet_t.pl/;
51 ok( exists $INC{'Net/Config.pm'}, 'Net::Config should have been used' );
52 ok( keys %NetConfig, '%NetConfig should be imported' );
55 undef $NetConfig{'ftp_firewall'};
56 is( Net::Config->requires_firewall(), 0,
57 'requires_firewall() should return 0 without ftp_firewall defined' );
59 $NetConfig{'ftp_firewall'} = 1;
60 is( Net::Config->requires_firewall('a.host.not.there'), -1,
61 '... should return -1 without a valid hostname' );
64 delete $NetConfig{'local_netmask'};
65 is( Net::Config->requires_firewall('127.0.0.1'), 0,
66 '... should return 0 without local_netmask defined' );
68 $NetConfig{'local_netmask'} = '127.0.0.1/24';
69 is( Net::Config->requires_firewall('127.0.0.1'), 0,
70 '... should return false if host is within netmask' );
71 is( Net::Config->requires_firewall('192.168.10.0'), 1,
72 '... should return true if host is outside netmask' );
74 # now try more netmasks
75 $NetConfig{'local_netmask'} = [ '127.0.0.1/24', '10.0.0.0/8' ];
76 is( Net::Config->requires_firewall('10.10.255.254'), 0,
77 '... should find success with mutiple local netmasks' );
78 is( Net::Config->requires_firewall('192.168.10.0'), 1,
79 '... should handle failure with multiple local netmasks' );
81 is( \&Net::Config::is_external, \&Net::Config::requires_firewall,
82 'is_external() should be an alias for requires_firewall()' );