Thread (18 messages) 18 messages, 4 authors, 2004-11-04

Re: [PATCH 2.6] dev.c: clear SIOCGIFHWADDR buffer if !dev->addr_len

From: jamal <hidden>
Date: 2004-10-30 19:10:19

On Fri, 2004-10-29 at 23:09, Matt Domsch wrote:
On Sat, Oct 30, 2004 at 11:51:01AM +1000, Herbert Xu wrote:
quoted
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.
fix the net-snmp code. The addr_len is dependent on the device type.
6 is good for ethernet but may not equate for others.

Having said that i think we should somehow signal that info to user
space. perhaps returning -EINVAL in the case the L2 address is 0?
EINVAL will break a few apps and make them puke as opposed to silently
returning something wrong.

cheers,
jamal
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help