Re: Bug in the RTM_SETLINK kernel API for setting MAC address

From: Pavlin Radoslavov
Date: Tue Aug 08 2006 - 14:24:52 EST


David Miller <davem@xxxxxxxxxxxxx> wrote:

> > The real mismatch is that ida[IFLA_ADDRESS - 1] is (as you say)
> > suppose to be a MAC address, but the set_mac_address() functions
> > for each device assume that the RTA_DATA(ida[IFLA_ADDRESS - 1])
> > payload is a sockaddr.
>
> That's because ->set_mac_address() is usually invoked via
> dev_set_mac_address() which in turn is invoked from places
> SIOCSIFHWADDR ioctl() processing which does want the sockaddr
> wrapped around the MAC address.
>
> So the netlink code is definitely doing the wrong thing if
> it wants merely the MAC address in the attribute.
>
> Since changing all the drivers is a pain, what we probably
> should do is have the netlink code allocate a sockaddr,
> place the MAC address attribute in to that allocated sockaddr,
> and pass it into ->set_mac_address().
>
> This patch should do the trick, can you test it out?

Yes, it works.

Can I presume that the fix will be in the next kernel release
(2.6.17.8 or 2.6.18), so we will know to reverse our userland
work-around changes when the kernel is out.

Thanks,
Pavlin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/