Package: libnet-arp-perl
Version: 1.0.3-1
Severity: normal

The get_mac function always returns "unknown" whatever interface is
looked for.

The device argument of the get_mac function must be defined out of the
CODE scope in ARP.xs. The current behavior creates an undefined string
which is passed to the get_mac_linux function.

I have enclosed a patch.

Before the patch:
$ LC_ALL=C perl -MNet::ARP -e '$mac = Net::ARP::get_mac("eth2"); print
"$mac\n"'
ioctl SIOCGIFHWADDR: No such device
unknown

After the patch:
$ perl -MNet::ARP -e '$mac = Net::ARP::get_mac("eth2"); print "$mac\n"'
00:08:a1:96:82:35

I also noticed that the debian package does not fail to build despite of
the test on get_mac. The Debian test does not handle multiple interfaces
neither. I have an update in my current working copy, I will check that
tomorrow.

Regards,

-- 
Franck Joncourt
http://debian.org - http://smhteam.info/wiki/
From: Franck Joncourt <[email protected]>
Subject: [PATCH] fixes/get_mac

The get_mac function always returns "unknown" whatever interface is looked
for.

The device argument of the get_mac function must be defined out of the
CODE scope in ARP.xs. The current behavior creates an undefined string which
is passed to the get_mac_linux function.

Signed-off-by: Franck Joncourt <[email protected]>

---
 ARP.xs |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ARP.xs b/ARP.xs
index ae925b3..6ee1aff 100644
--- a/ARP.xs
+++ b/ARP.xs
@@ -185,8 +185,8 @@ send_packet(dev, sip, dip, smac, dmac, type)
 
 char *
 get_mac(dev)
+	unsigned char *dev;
 	CODE:
-	  char dev[16];
           char tmp[20] = "unknown";
 
 	  if(SOCK_TYPE == SOCK_RAW)
-- 
tg: (7ee8ac6..) fixes/get_mac (depends on: upstream)

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to