Add IPv6 and VLAN devices to the web UI and router-setup
The web UI lists physical and VLAN interfaces and takes a VLAN uplink as a device name (enp2s0.1001); it has IPv6 checkboxes for the WAN and each LAN. router-setup asks whether to create VLANs before WAN and LAN are picked, and whether to enable IPv6. --config-only writes the configuration without installing, which the setup test uses for a PPPoE uplink on a VLAN. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV9dZrK6nipHkPfyM4F
This commit is contained in:
@@ -63,7 +63,7 @@ func TestApplyPPPoE(t *testing.T) {
|
||||
f := s.form()
|
||||
f.WAN.Type = "pppoe"
|
||||
f.WAN.PPPoEUser = "user@isp"
|
||||
f.WAN.PPPoEVLAN = "7"
|
||||
f.WAN.Interface += ".7"
|
||||
if _, err := s.apply(f, "/pw"); err == nil {
|
||||
t.Fatal("PPPoE without any password was accepted")
|
||||
}
|
||||
@@ -128,3 +128,49 @@ func TestApplyAddsAndRemovesLANs(t *testing.T) {
|
||||
t.Fatal("removing the last LAN was accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestVLANUplinkAndIPv6(t *testing.T) {
|
||||
s := mustParse(t)
|
||||
f := s.form()
|
||||
f.WAN.Type = "pppoe"
|
||||
f.WAN.PPPoEUser = "user@isp"
|
||||
f.WAN.PPPoEPassword = "secret"
|
||||
f.WAN.Interface = "enp2s0.1001"
|
||||
f.WAN.IPv6 = true
|
||||
f.LANs[0].IPv6PD = true
|
||||
if _, err := s.apply(f, "/pw"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := str(s, "router", "wan", "interface"); got != "enp2s0" {
|
||||
t.Errorf("interface = %q", got)
|
||||
}
|
||||
if got := str(s, "router", "wan", "ipv4", "pppoe", "vlan"); got != "1001" {
|
||||
t.Errorf("vlan = %q", got)
|
||||
}
|
||||
if got := str(s, "router", "wan", "ipv6", "transport"); got != "ppp" {
|
||||
t.Errorf("transport = %q", got)
|
||||
}
|
||||
if !s.form().LANs[0].IPv6PD || s.form().WAN.Interface != "enp2s0.1001" {
|
||||
t.Errorf("form does not round-trip: %+v", s.form())
|
||||
}
|
||||
devs := s.form().devices([]string{"enp2s0", "wlp3s0"})
|
||||
if len(devs) != 3 || devs[1].Name != "enp2s0.1001" || devs[1].Role != "WAN" {
|
||||
t.Errorf("devices = %+v", devs)
|
||||
}
|
||||
|
||||
// Without PPPoE a VLAN uplink is not possible; turning IPv6 off keeps the rest.
|
||||
g := s.form()
|
||||
g.WAN.Type = "dhcp"
|
||||
if _, err := s.apply(g, "/pw"); err == nil {
|
||||
t.Error("a DHCP uplink on a VLAN was accepted")
|
||||
}
|
||||
g = s.form()
|
||||
g.WAN.IPv6 = false
|
||||
g.LANs[0].IPv6PD = false
|
||||
if _, err := s.apply(g, "/pw"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if boolean(s, true, "router", "wan", "ipv6", "enable") || s.form().LANs[0].IPv6PD {
|
||||
t.Error("IPv6 still on")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user