Changeset 197
- Timestamp:
- Jan 5, 2017, 12:01:27 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r196 r197 233 233 return %ret if not defined $packed_ip; 234 234 $ret{ipv4_address} = inet_ntoa($packed_ip); 235 #if ($ret{ipv4_address} !~ m/$RE_IPv4_ADDRESS/) { 236 # print "Error: for computer $param_ip_or_host on interface $interface, IP $ret{ipv4_address} is not valide\n"; 237 # return %ret; 238 # } 235 239 236 240 # perl -MSocket -E 'say scalar gethostbyaddr(inet_aton("194.254.66.240"), AF_INET)' … … 265 269 # LANG=C ip neigh show to 194.254.66.62 dev eth331 266 270 # 194.254.66.62 lladdr 00:08:7c:bb:0f:c0 REACHABLE 271 # LANG=C ip neigh show to 194.254.66.62 272 # 194.254.66.62 dev eth331 lladdr 00:08:7c:bb:0f:c0 REACHABLE 267 273 # my $cmd_arp = shell_command "arp -a $param_ip_or_host -i $ret{interface}"; 268 274 # if ( $cmd_arp =~ m{ (\S*) \s \( ( $RE_IPv4_ADDRESS ) \) \s at \s ( $RE_MAC_ADDRESS ) }xms ) { … … 271 277 if ($ret{mac_address} eq 'unknow') { 272 278 # Last chance to have the mac_address 273 my $cmd_arp = shell_command "ip neigh show to $ret{ipv4_address} dev $ret{interface}"; 274 if ( $cmd_arp =~ m{ ^$RE_IPv4_ADDRESS \s lladdr \s ( $RE_MAC_ADDRESS ) \s }xms ) { 275 $ret{mac_address} = $1; 279 if ($ret{interface} eq '*') { 280 my $cmd_arp = shell_command "ip neigh show to $ret{ipv4_address}"; 281 if ( $cmd_arp =~ m{ ^$RE_IPv4_ADDRESS \s dev \s ([\w\d\.\:]+) \s lladdr \s ( $RE_MAC_ADDRESS ) \s }xms ) { 282 ($ret{interface}, $ret{mac_address}) = ($1, $2); 283 } 284 } 285 else { 286 my $cmd_arp = shell_command "ip neigh show to $ret{ipv4_address} dev $ret{interface}"; 287 if ( $cmd_arp =~ m{ ^$RE_IPv4_ADDRESS \s lladdr \s ( $RE_MAC_ADDRESS ) \s }xms ) { 288 $ret{mac_address} = $1; 289 } 276 290 } 277 291 } … … 369 383 # Ligne à virer car on récupère maintenant le modèle du switch 370 384 #my ($desc, $type) = split m/ : /xms, $sw->{description}, 2; 371 printf "%-26s 0--------->>>> %-25s %s\n", $sw->{hostname}, $ desc, $sw->{model} if $verbose;385 printf "%-26s 0--------->>>> %-25s %s\n", $sw->{hostname}, $sw->{description}, $sw->{model} if $verbose; 372 386 } 373 387
Note: See TracChangeset
for help on using the changeset viewer.