Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1069332 - NPalert /usr/bin/monitor-queue uses ifconfig
Summary: NPalert /usr/bin/monitor-queue uses ifconfig
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 2.0
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space22
TreeView+ depends on / blocked
 
Reported: 2014-02-24 18:24 UTC by nateboyce
Modified: 2014-07-17 08:41 UTC (History)
1 user (show)

Fixed In Version: perl-NOCpulse-Gritch-2.2.1-1 MessageQueue-3.26.10-1 SatConfig-cluster-2.2.2-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-17 08:41:25 UTC
Embargoed:


Attachments (Terms of Use)

Description nateboyce 2014-02-24 18:24:11 UTC
Description of problem:
ON systems with infiniband ifconfig gives the following error. 

Ifconfig uses the ioctl access method to get the full address information, which limits hardware addresses to 8 bytes.
Because Infiniband address has 20 bytes, only the first 8 bytes are displayed correctly.
Ifconfig is obsolete! For replacement check ip.

Version-Release number of selected component (if applicable):
NPalert-1.127.12-1.el6.noarch

How reproducible:
On systems with infiniband 
/usr/bin/monitor-queue ALERTS 50 100


Additional info:
Not sure if this is the best way to fix it but it should be switched to use /sbin/ip command. 



$ diff -u /usr/share/perl5/vendor_perl/NOCpulse/SMONQueue.pm.old /usr/share/perl5/vendor_perl/NOCpulse/SMONQueue.pm
--- /usr/share/perl5/vendor_perl/NOCpulse/SMONQueue.pm.old	2014-02-24 11:06:16.532523638 -0700
+++ /usr/share/perl5/vendor_perl/NOCpulse/SMONQueue.pm	2014-02-24 11:07:32.001971328 -0700
@@ -60,8 +60,8 @@
 {
     my $self = shift;
 
-    my $mac = `/sbin/ifconfig`;
-    $mac =~ s/.*?HWaddr (\S*).*/$1/s;
+    my $mac = `/sbin/ip -o link`;
+    $mac =~ s/.*?ether (\S*).*/$1/s;
     my @nodes = split(/:/, $mac);
     $mac = sprintf("%02X:%02X:%02X:%02X:%02X:%02X",
 		   hex($nodes[0]), hex($nodes[1]), hex($nodes[2]),


$ diff -u /usr/share/perl5/vendor_perl/NOCpulse/Gritch.pm.old /usr/share/perl5/vendor_perl/NOCpulse/Gritch.pm
--- /usr/share/perl5/vendor_perl/NOCpulse/Gritch.pm.old	2014-02-24 11:04:45.193745385 -0700
+++ /usr/share/perl5/vendor_perl/NOCpulse/Gritch.pm	2014-02-24 11:14:59.589552051 -0700
@@ -430,8 +430,8 @@
 sub get_mac {
 #############
 
-  my $ifconfig = `/sbin/ifconfig`;
-  if ($ifconfig =~ /.*?HWaddr (\S*).*/) {
+  my $ifconfig = `/sbin/ip -o link`;
+  if ($ifconfig =~ /.*?ether (\S*).*/) {
     return $1;
   } else {
     return undef;

Comment 1 Jan Pazdziora 2014-02-25 08:40:52 UTC
One more occurence of ifconfig in the Perl stack:

From c7c6681588ff1f93ae92eea89e74ac3c631fa81a Mon Sep 17 00:00:00 2001
From: Jan Pazdziora <jpazdziora>
Date: Tue, 25 Feb 2014 09:39:42 +0100
Subject: [PATCH] 1069332 - Use /sbin/ip instead of /sbin/ifconfig.

---
 monitoring/SatConfig/cluster/IpAddr.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/monitoring/SatConfig/cluster/IpAddr.pm b/monitoring/SatConfig/cluster/IpAddr.pm
index 4912b9c..074d68e 100644
--- a/monitoring/SatConfig/cluster/IpAddr.pm
+++ b/monitoring/SatConfig/cluster/IpAddr.pm
@@ -96,8 +96,8 @@ sub macAddress
 {
 	my $self = shift();
 	my $dev = $self->get_dev;
-	my $mac = `/sbin/ifconfig $dev`;
-	if ($mac =~ /HWaddr (\S+)/) {
+	my $mac = `/sbin/ip -o link`;
+	if ($mac =~ /^\d+:\s*\Q$dev\E:.*?ether (\S*).*/m) {
 		return $1;
 	} else {
 		# NOTE: Kludge for ethernet issue - should be undef
-- 
1.8.3.1

Comment 2 Michael Mráka 2014-02-25 10:13:31 UTC
Fixed in spacewalk master by
commit f2162b0c3a2ff73eb56af26d9e7c0281e5ae1f11
    1069332 - simplify regexp
commit d732736216de3eda42f635a1245069aecbf0530f
    1069332 - ifconfig without agrs showed only UP intefaces
commit 1405955ff835c9ea4d8667963b36d85140ca8096
    1069332 - Use /sbin/ip instead of /sbin/ifconfig.
commit 2cbce5622affa1b91ea851a5990482d6e6428862
    1069332 - ifconfig don't show Infiniband addresses properly

Comment 3 Michael Mráka 2014-02-25 10:50:53 UTC
One more fix
commit 449db5258269a6a6fc0e205af44d7f36c382db60
    1069332 - fixing ip syntax

Comment 4 Milan Zázrivec 2014-07-17 08:41:25 UTC
Spacewalk 2.2 has been released:

    https://fedorahosted.org/spacewalk/wiki/ReleaseNotes22


Note You need to log in before you can comment on or make changes to this bug.