Re: [PATCH 2.6] dev.c: clear SIOCGIFHWADDR buffer if !dev->addr_len
From: Matt Domsch <hidden>
Date: 2004-10-30 03:09:36
From: Matt Domsch <hidden>
Date: 2004-10-30 03:09:36
On Sat, Oct 30, 2004 at 11:51:01AM +1000, Herbert Xu wrote:
quoted
s/dev_addr/addr_len in the comments above, that's the field we care about being non-zero.This still doesn't make sense. What if dev->addr_len is less than the size of the buffer? The caller has to know what the length is anyway.
Ahh, indeed. net-snmp has hard-coded the number 6 or uses the definition of IFHWADDRLEN (from include/linux/if.h, a copy of which is in /usr/include/linux/if.h of course) in several places for this.
BTW, the ioctl interface is obsolete. Please use the rtnetlink interface where dev->addr_len can be read properly.
More than I wanted to do tonight, but will investigate. Thanks, Matt -- Matt Domsch Sr. Software Engineer, Lead Engineer Dell Linux Solutions linux.dell.com & www.dell.com/linux Linux on Dell mailing lists @ http://lists.us.dell.com