[systemd-devel] [PATCH] Kernel mac address assignment to VLAN NETDEV
Lennart Poettering
lennart at poettering.net
Mon Oct 12 14:38:58 PDT 2015
On Thu, 08.10.15 09:15, O Neill, David M (david.m.oneill at intel.com) wrote:
> The creation of a VLAN netdev device, as seen in the 'ip link' command, is
> done without specifying a mac address.
> The kernel determines the mac address for the VLAN NETDEV, which should be
> the parent mac address.
>
> This patch fixes this behavior and the resulting delivery of DHCP Offers to
> the VLAN NETDEV.
Hmm, so the patch is line broken, which makes it hard to apply it.
Also, we prefer patch submissions via github these days. Any chance
you could resubmit this as github PR?
https://github.com/systemd/systemd
> Technical Contributors
> Rami Rosen <rami.rosen at intel.com>
> Szczerbik, PrzemyslawX <przemyslawx.szczerbik at intel.com>
>
> Signed-off-by: David O Neill <david.m.oneill at intel.com>
We don't use "Signed-off-by" in the systemd project. That's a kernel
thing.
>
> ---
> src/network/networkd-netdev.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
> index 6949b40..2c1dd9e 100644
> --- a/src/network/networkd-netdev.c
> +++ b/src/network/networkd-netdev.c
> @@ -647,9 +647,14 @@ static int netdev_load_one(Manager *manager, const char
> *filename) {
> return log_oom();
>
> if (!netdev->mac) {
> - r = netdev_get_mac(netdev->ifname, &netdev->mac);
> - if (r < 0)
> - return log_error_errno(r, "Failed to generate
> predictable MAC address for %s: %m", netdev->ifname);
> + /* do not generate mac for VLAN netdev, allow kernel to
> assign mac (parent mac) */
> + if(netdev->kind != NETDEV_KIND_VLAN) {
> + r = netdev_get_mac(netdev->ifname, &netdev->mac);
> + if (r < 0)
> + return log_error_errno(r, "Failed to
> generate predictable MAC address for %s: %m", netdev->ifname);
> + } else {
> + log_debug_netdev(netdev, "Skipping generating MAC
> address for vlan netdev");
> + }
No {} round single-line if blocks please, see CODING_STYLE on this.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list