Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

networkd: make sure VXLAN is in the right section (LP: #2000713) #310

Merged
merged 2 commits into from
Jan 19, 2023

Conversation

daniloegea
Copy link
Collaborator

@daniloegea daniloegea commented Jan 10, 2023

If an interface has a list of routes and is linked to a vxlan, the VXLAN keyword is added to the [Route] section in the resulting networkd configuration file.

This change makes the vxlan handling to happen before routes so VXLAN= will be added to the [Network] section.

It fixes LP#2000713

Description

Can be reproduced with:

network:
  renderer: networkd
  ethernets:
    eth0:
      routes:
        - to: 10.20.30.40/32
          via: 10.20.30.1
  tunnels:
    vxlan1:
      mode: vxlan
      id: 1
      link: eth0

This is the current output. The VXLAN= keyword was added to the [Route] section.

$ cat fakeroot/run/systemd/network/10-netplan-eth0.network
[Match]
Name=eth0

[Network]
LinkLocalAddressing=ipv6

[Route]
Destination=10.20.30.40/32
Gateway=10.20.30.1
VXLAN=vxlan1

This is the result with this patch:

[Match]
Name=eth0

[Network]
LinkLocalAddressing=ipv6
VXLAN=vxlan1

[Route]
Destination=10.20.30.40/32
Gateway=10.20.30.1

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad.

If an interface has a list of routes and is linked to a vxlan, the
VXLAN keyword is added to the [Route] section in the resulting networkd
configuration file.

This change makes the vxlan handling to happen before routes so VXLAN=
will be added to the [Network] section.

It fixes LP#2000713
@slyon slyon changed the title networkd: make sure VXLAN is in the right section networkd: make sure VXLAN is in the right section (LP: #2000713) Jan 10, 2023
@daniloegea daniloegea requested a review from slyon January 11, 2023 16:27
Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, lgtm.
I've added some bits to make use of the ND_EMPTY and ND_VXLAN matching templates in your test case, in order to reduce the code/diff size a bit.

@slyon
Copy link
Collaborator

slyon commented Jan 19, 2023

Just as a note to self: In the future, we want to switch to using GLib's g_key_file_set_* function to build that networkd ini files (similar to how we're doing it in nm.c nowadays). This should avoid errors such as this one.

@slyon slyon merged commit 81fc9ea into canonical:main Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants