diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-01-10 15:09:07 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-01-10 15:09:07 +0000 |
commit | 3ed3657f6b25720167d7640e4a1c6c6eef504596 (patch) | |
tree | da55188df12730ff7bd80d2e61a564da3e6ecfc2 /ext/Sys | |
parent | 18fd236b74f8374016eb16e779d1122c897d2f4a (diff) | |
download | perl-3ed3657f6b25720167d7640e4a1c6c6eef504596.tar.gz |
Why should Syslog jump through hoops to look up the hostname so it can
immediately convert it to an IP address, when all it really wants is
a connection to the loopback device?
p4raw-id: //depot/perl@26769
Diffstat (limited to 'ext/Sys')
-rw-r--r-- | ext/Sys/Syslog/Syslog.pm | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/ext/Sys/Syslog/Syslog.pm b/ext/Sys/Syslog/Syslog.pm index edcea04692..bdc1e0e335 100644 --- a/ext/Sys/Syslog/Syslog.pm +++ b/ext/Sys/Syslog/Syslog.pm @@ -4,7 +4,7 @@ use Carp; require 5.006; require Exporter; -our $VERSION = '0.12'; +our $VERSION = '0.13'; our @ISA = qw(Exporter); our %EXPORT_TAGS = ( @@ -42,7 +42,7 @@ my $transmit_ok = 0; my $current_proto = undef; my $failed = undef; my $fail_time = undef; -our ($connected, @fallbackMethods, $syslog_send, $host); +our ($connected, @fallbackMethods, $syslog_send); use Socket ':all'; use POSIX qw(strftime setlocale LC_TIME); @@ -808,11 +808,6 @@ sub connect { sub connect_tcp { my ($errs) = @_; - unless ($host) { - require Sys::Hostname; - my($host_uniq) = Sys::Hostname::hostname(); - ($host) = $host_uniq =~ /([A-Za-z0-9_.-]+)/; # allow FQDN (inc _) - } my $tcp = getprotobyname('tcp'); if (!defined $tcp) { push(@{$errs}, "getprotobyname failed for tcp"); @@ -826,11 +821,7 @@ sub connect_tcp { } my $this = sockaddr_in($syslog, INADDR_ANY); - my $that = sockaddr_in($syslog, inet_aton($host)); - if (!$that) { - push(@{$errs}, "can't lookup $host"); - return 0; - } + my $that = sockaddr_in($syslog, INADDR_LOOPBACK); if (!socket(SYSLOG,AF_INET,SOCK_STREAM,$tcp)) { push(@{$errs}, "tcp socket: $!"); return 0; @@ -847,11 +838,6 @@ sub connect_tcp { sub connect_udp { my ($errs) = @_; - unless ($host) { - require Sys::Hostname; - my($host_uniq) = Sys::Hostname::hostname(); - ($host) = $host_uniq =~ /([A-Za-z0-9_.-]+)/; # allow FQDN (inc _) - } my $udp = getprotobyname('udp'); if (!defined $udp) { push(@{$errs}, "getprotobyname failed for udp"); @@ -863,11 +849,7 @@ sub connect_udp { return 0; } my $this = sockaddr_in($syslog, INADDR_ANY); - my $that = sockaddr_in($syslog, inet_aton($host)); - if (!$that) { - push(@{$errs}, "can't lookup $host"); - return 0; - } + my $that = sockaddr_in($syslog, INADDR_LOOPBACK); if (!socket(SYSLOG,AF_INET,SOCK_DGRAM,$udp)) { push(@{$errs}, "udp socket: $!"); return 0; |