Server IP : 103.119.228.120 / Your IP : 18.222.163.134 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/share/perl5/Net/SNMP/Transport/ |
Upload File : |
# -*- mode: perl -*- # ============================================================================ package Net::SNMP::Transport::IPv6; # $Id: IPv6.pm,v 1.1 2009/09/09 15:08:31 dtown Rel $ # Base object for the IPv6 Transport Domains. # Copyright (c) 2008-2009 David M. Town <dtown@cpan.org> # All rights reserved. # This program is free software; you may redistribute it and/or modify it # under the same terms as the Perl 5 programming language system itself. # ============================================================================ use strict; use Net::SNMP::Transport qw( DEBUG_INFO ); use Socket6 0.23 qw( PF_INET6 AF_INET6 in6addr_any in6addr_loopback getaddrinfo pack_sockaddr_in6_all unpack_sockaddr_in6_all inet_pton inet_ntop ); ## Version of the Net::SNMP::Transport::IPv6 module our $VERSION = v1.0.0; # [public methods] ----------------------------------------------------------- sub agent_addr { return '0.0.0.0'; } sub sock_flowinfo { return $_[0]->_flowinfo($_[0]->sock_name()); } sub sock_scope_id { return $_[0]->_scope_id($_[0]->sock_name()); } sub sock_tzone { goto &sock_scope_id; } sub dest_flowinfo { return $_[0]->_flowinfo($_[0]->dest_name()); } sub dest_scope_id { return $_[0]->_scope_id($_[0]->dest_name()); } sub dest_tzone { goto &dest_scope_id; } sub peer_flowinfo { return $_[0]->_flowinfo($_[0]->peer_name()); } sub peer_scope_id { return $_[0]->_scope_id($_[0]->peer_name()); } sub peer_tzone { goto &peer_scope_id; } # [private methods] ---------------------------------------------------------- sub _protocol_family { return PF_INET6; } sub _addr_any { return in6addr_any; } sub _addr_loopback { return in6addr_loopback; } sub _hostname_resolve { my ($this, $host, $nh) = @_; $nh->{addr} = undef; # See if the service/port was included in the address. my $serv = ($host =~ s/^\[(.+)\]:([\w\(\)\/]+)$/$1/) ? $2 : undef; if (defined($serv) && (!defined $this->_service_resolve($serv, $nh))) { return $this->_error('Failed to resolve the %s service', $this->type()); } # See if the scope zone index was included in the address. $nh->{scope_id} = ($host =~ s/%(\d+)$//) ? $1 : 0; # <address>%<index> # Resolve the address. my @info = getaddrinfo(($_[1] = $host), q{}, PF_INET6); if (@info >= 5) { if ($host =~ s/(.*)%.*$/$1/) { # <address>%<ifName> $_[1] = $1; } while (@info >= 5) { if ($info[0] == PF_INET6) { $nh->{flowinfo} = $this->_flowinfo($info[3]); $nh->{scope_id} ||= $this->_scope_id($info[3]); return $nh->{addr} = $this->_addr($info[3]); } DEBUG_INFO('family = %d, sin = %s', $info[0], unpack 'H*', $info[3]); splice @info, 0, 5; } } else { DEBUG_INFO('getaddrinfo(): %s', $info[0]); if ((my @host = split /:/, $host) == 2) { # <hostname>:<service> $_[1] = sprintf '[%s]:%s', @host; return $this->_hostname_resolve($_[1], $nh); } } # Last attempt to resolve the address. if (!defined $nh->{addr}) { $nh->{addr} = inet_pton(AF_INET6, $host); } if (!defined $nh->{addr}) { return $this->_error( q{Unable to resolve the %s address "%s"}, $this->type(), $host ); } return $nh->{addr}; } sub _name_pack { return pack_sockaddr_in6_all( $_[1]->{port}, $_[1]->{flowinfo} || 0, $_[1]->{addr}, $_[1]->{scope_id} || 0 ); } sub _address { return inet_ntop(AF_INET6, $_[0]->_addr($_[1])); } sub _addr { return (unpack_sockaddr_in6_all($_[1]))[2]; } sub _port { return (unpack_sockaddr_in6_all($_[1]))[0]; } sub _taddress { my $s = $_[0]->_scope_id($_[1]); $s = $s ? sprintf('%%%u', $s) : q{}; return sprintf '[%s%s]:%u', $_[0]->_address($_[1]), $s, $_[0]->_port($_[1]); } sub _taddr { my $s = $_[0]->_scope_id($_[1]); $s = $s ? pack('N', $s) : q{}; return $_[0]->_addr($_[1]) . $s . pack 'n', $_[0]->_port($_[1]); } sub _scope_id { return (unpack_sockaddr_in6_all($_[1]))[3]; } sub _flowinfo { return (unpack_sockaddr_in6_all($_[1]))[1]; } # ============================================================================ 1; # [end Net::SNMP::Transport::IPv6]