Skip Menu |
 

This queue is for tickets about the Net-ARP CPAN distribution.

Report information
The Basics
Id: 45126
Status: deleted
Priority: 0/
Queue: Net-ARP

People
Owner: Nobody in particular
Requestors: franck.mail [...] dthconnex.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.0.3
Fixed in: (no value)



Subject: The get_mac function always returns unknown
Download (untitled) / with headers
text/plain 773b
Hi, The get_mac function always returns "unknown" whatever interface is looked for. 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 The bug has been reported on Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524559 The patch only fixes ARP.xs, but I think it would also be good to make sure the device name can fit into the destination buffer. [quote=get_mac_linux.c] strcpy(iface.ifr_name,dev); [/quote] could be replaced by: strncpy(iface.ifr_name, dev, IFNAMSIZ); iface.ifr_name[IFNAMSIZ-1] = '\0'; I have not checked in the other files. Regards,
Subject: get_mac.diff
Download get_mac.diff
text/x-diff 834b
From: Franck Joncourt <franck.mail@dthconnex.com> 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 <franck.mail@dthconnex.com> --- 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)


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.