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

Tom Gundersen teg at jklm.no
Thu Dec 4 09:53:51 PST 2014


On Thu, Dec 4, 2014 at 4:11 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Thu, 04.12.14 11:20, Tom Gundersen (teg at jklm.no) wrote:
>
>> > I mean, most of the times .link files are
>> > used to choose the name depending on other fields, but I think in all
>> > cases where the name is chosen at creation time of an interface (like
>> > for example for veth links), it should be Ok to match links based on
>> > the name they already have?
>>
>> So this we could do (i.e., allow name matches if and only if the name
>> is set at creation time). Though, if the name is set at creation time,
>> shouldn't also all the other properties have been?
>
> In nspawn we create veth links, and I *really* *really* don't want to
> add tons of options there to set the MTU or suchlike. Setting these
> properties really should be done within networkd I think.
>
> I think it would be really useful if we could match on the container's
> veth links by name, so that a .link file for it could be equally
> expressive as the .network file already is.
>
>> 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)...

Testing and feedback welcome. Does this solve your problem William?

Cheers,

Tom


More information about the systemd-devel mailing list