[systemd-devel] systemd-networkd: setting the MAC address for a .netdev unit?

poma pomidorabelisima at gmail.com
Mon May 12 10:44:25 PDT 2014


On 05/12/2014 05:45 PM, Tom Gundersen wrote:
> On Mon, May 12, 2014 at 5:27 PM, poma <pomidorabelisima at gmail.com> wrote:
>> On 12.05.2014 12:22, Tom Gundersen wrote:
>>> On Mon, May 12, 2014 at 10:43 AM, Matthias Schiffer
>>> <mschiffer at universe-factory.net> wrote:
>>>>>>> This should really be added as AFAICT there is currently no way to match
>>>>>>> on virtual devices like briges, TAP devices, batman-adv devices, etc...
>>>>>>> which have neither a persistent MAC address nor an ID_PATH to match on.
>>>>>>
>>>>>> So I think what we should do here is to allow MAC address (and other
>>>>>> things) to be set when creating the netdevs. I made an attempt at this
>>>>>> by generating a "predictable" one based on the interface name and the
>>>>>> machine-id. Would that do it for you, or are you after a _specific_
>>>>>> mac address, rather than just one that is always the same? I had to
>>>>>> revert the code doing this for now as there was a kernel bug, however
>>>>>> we'll hopefully get that sorted soon and then get back to this.
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Tom
>>>>>>
>>>>>
>>>>> For my usecase, a predictable, but otherwise random MAC address would
>>>>> do. But I also see that setting an arbitrary MAC address (or any other
>>>>> link parameter) for a specific virtual device is useful as well
>>>>> (especially as it is possible to do so with real devices). As virtual
>>>>> devices are almost always created with specific names, a Name= match for
>>>>> .link units would make the most sense in my opinion.
>>>>>
>>>>> As a workaround, I've added the following udev rule to
>>>>> 80-net-setup-link.rules for now to allow matching for virtual devices
>>>>> with Path= matches:
>>>>>
>>>>> ENV{DEVPATH}=="/devices/virtual/net/*", ENV{ID_PATH}=="",
>>>>> ENV{ID_PATH}="virtual-$kernel"
>>>>>
>>>>> Thanks,
>>>>> Matthias
>>>>>
>>>>
>>>> Ping. There is still no way to match for virtual devices in .link units
>>>> without my workaround. Is it planned to add something similar? Would a
>>>> facility allowing to configure the MAC address of a virtual device be in
>>>> the scope of the TODO point "add reduced [Link] support to .network files"?
>>>
>>> Yes. What we will do is that by default we will generate a MAC address
>>> that will be stable between reboots and use that, but we will also
>>> allow the MAC address to be set manually in the [NetDev] section (in
>>> the same way as in the .link files).
>>>
>>> The kernel interface for doing this is currently broken, but a patch
>>> has been submitted to fix it, and once that hits the stable kernels I
>>> guess we can start using it (otherwise we are just going to get heaps
>>> of weird bug reports).
>>>
>>> Cheers,
>>>
>>> Tom
>>
>> Ping.
>> Care to paste link to a patch?
> 
> Sure: <http://www.spinics.net/lists/netdev/msg280477.html>
> 
> Cheers,
> 
> Tom
> 

Thanks!
Why am I seeing this commit on git/stable, 
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/net/bridge/br_netlink.c?id=30313a3
but not in stable complete tarball, 
https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.14.3.tar.xz


poma




More information about the systemd-devel mailing list