[systemd-devel] networkd: Support setting mtu / mac address by interface name

Tom Gundersen teg at jklm.no
Fri Dec 5 07:09:17 PST 2014


On Fri, Dec 5, 2014 at 2:21 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Fri, 05.12.14 10:07, Marcel Holtmann (marcel at holtmann.org) wrote:
>
>> Hi Lennart,
>>
>> >>>> Moreover, if we
>> >>>> give people this feature I'm pretty sure we'll get lots of people
>> >>>> expecting it to work also for any other sort of name and getting
>> >>>> confused when it doesn't.
>> >>>
>> >>> Well, this is something we can fix by documentation, no?
>> >>>
>> >>> Or maybe name the match option differently, maybe OriginalName= or
>> >>> KernelName= or so, and then only matching interfaces where you know
>> >>> that the name was selected by userspace in the first place?
>> >>
>> >> I like the idea of OriginalName, much less likely to get people
>> >> confused. I now implemented that, with the restriction that we cannot
>> >> match on renamed names. For now I left it open to match on ethX style
>> >> names, as people in principle could do sensible things like
>> >> "OriginalName=eth*" or even "OriginalName=eth0" when we know there is
>> >> only one interface.
>> >>
>> >> One thing to consider would be to disallow renaming from a .link file
>> >> where the OriginalName was used to match. That way we don't have the
>> >> somewhat odd situation that a .link file can only be applied once (we
>> >> do not remember the original name, so cannot match on that the second
>> >> time around, as that would be a mess)...
>> >
>> > Maybe we should even store the original name in a udev property, so
>> > that we can make this fully idempotent simply because we can always
>> > check this new property for the original name passed down from the
>> > kernel?
>>
>> you do realize that once the kernel renamed the name, it is free to
>> reuse that name again. So eth0 as OriginalName can then be present
>> multiple times.
>>
>> I think that you can only have OriginalName matching if a renaming
>> has never occurred. Otherwise this is really not
>> deterministic. Since foo0 (renamed from eth0) and and bar0 (renamed
>> from eth0) will both match OriginalName=eth0. The difference is only
>> timing and that is inhering racy of course.
>
> Well, sure, if you use OriginalName= for such names, it's your own
> fault. I think using OriginalName= is primarily useful for things like
> veth links where the names are chosen by userspace anyway.
>
> Hmm, now that the naming policy is exposed by the kernel, can we
> detect the cases where naming happens like "eth0", "eth1", and print a
> nice warning or so, if people then match against that?

I added some warnings to git now. Still need to push some more kernel
patches to get more stuff tagged correctly, but at least the systemd
side is now good.

Cheers,

Tom


More information about the systemd-devel mailing list