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

gateway reappears after reconfiguring dhcp #1860

Closed
webteam-app opened this issue Nov 10, 2020 · 3 comments · Fixed by #2009
Closed

gateway reappears after reconfiguring dhcp #1860

webteam-app opened this issue Nov 10, 2020 · 3 comments · Fixed by #2009
Assignees
Labels

Comments

@webteam-app
Copy link

Bug originally filed by arif-ali at https://bugs.launchpad.net/bugs/1903586

MAAS version: 2.8.2
Package: snap and deb

If we have MAAS running with any subnet where we are providing dhcp, MAAS will automatically add a gateway IP address if the subnet is reconfigured and the Reconfigure DHCP button is pressed.

Steps to re-produce:

  1. Click Subnets
  2. Add a new subnet, name "test" -> CIDR "10.0.6.0/24" -> "Add subnet"
  3. Click on the vlan associated with the new subnet
  4. Click on "Reconfigure DHCP"
  5. Choose the subnet and Start IP Address: 10.0.6.101, End IP Address: 10.0.6.199, blank out the Gateway IP. Click "Reconfigure DHCP"
  6. On the new page, click 10.0.6.0/25 under the "Subnets on this VLAN". We will see that the Gateway IP has not been set
  7. Go back click on "Reconfigure DHCP" and on the new page click "Reconfigure DHCP"
  8. On the new page, click 10.0.6.0/25 under the "Subnets on this VLAN". We will see that the Gateway IP has now been set to 10.0.6.1

If we set the Start IP address to 10.0.6.1, then the Gateway IP is also set, but now to 10.0.6.254 instead of 10.0.6.1, as that is now being used.

We are also able to see the same updates in /var/lib/maas/dhcpd.conf where the parameter "option routers 10.0.6.1;" will exist.

We should not expect the gateway to be set, if the gateway is blank in the UI.

@vtapia
Copy link
Contributor

vtapia commented Nov 30, 2020

I believe the issue comes from line 345 in legacy/src/app/controllers/vlan_details.js:

340 if (angular.isString(suggested_gateway)) {
341 if (forRelay) {
342 dhcp.gatewayIP = "";
343 dhcp.gatewayPlaceholder = suggested_gateway + " (optional)";
344 } else {
345 dhcp.gatewayIP = suggested_gateway;
346 dhcp.gatewayPlaceholder = suggested_gateway;
347 }

Is there a reason why the gateway has to be generated/populated based on subnet.statistics?

@Caleb-Ellis
Copy link
Contributor

Hi @vtapia! Thanks for looking into this.

I've got no idea why the gateway is being set based on subnet.statistics - we haven't yet reached the Subnets tab in our efforts to modernise the codebase so can't answer any "why" questions just yet. My guess it it's just for convenience so a user doesnt have to enter the IP manually, but at some point a bug has been introduced where in certain cases dhcp.gatewayIP is not surfaced in the UI and is therefore both sent unknowingly and completely unchangeable.

I think your fix in vtapia@a7808e1 is sound. If you create a pull request on this repo I'll be happy to approve it.

@vtapia
Copy link
Contributor

vtapia commented Dec 15, 2020

Done, thanks @Caleb-Ellis !

@Caleb-Ellis Caleb-Ellis added Backport 2.7 ◀️ Backport fix to 2.7 Backport 2.8 ◀️ Backport fix to 2.8 labels Dec 17, 2020
Caleb-Ellis pushed a commit that referenced this issue Dec 17, 2020
)

* fix(legacy): stop setting gateway on gateway-less subnets (#1860)

Co-authored-by: Caleb Ellis <[email protected]>
Caleb-Ellis pushed a commit that referenced this issue Dec 17, 2020
)

* fix(legacy): stop setting gateway on gateway-less subnets (#1860)

Co-authored-by: Caleb Ellis <[email protected]>
Caleb-Ellis pushed a commit that referenced this issue Dec 17, 2020
)

* fix(legacy): stop setting gateway on gateway-less subnets (#1860)

Co-authored-by: Caleb Ellis <[email protected]>
Caleb-Ellis pushed a commit that referenced this issue Dec 17, 2020
)

* fix(legacy): stop setting gateway on gateway-less subnets (#1860)

Co-authored-by: Caleb Ellis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants