Compare commits
No commits in common. "ea9559c78449270d7c8bdf5d38fdf548ce12b028" and "57448d758f235534f4ac03c4416abea72576498b" have entirely different histories.
ea9559c784
...
57448d758f
3 changed files with 1 additions and 29 deletions
|
|
@ -109,32 +109,6 @@ func TestGenerateConfig_NoDefaultGateway(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGenerateConfig_NoDefaultGatewaySuppressesRouterOption(t *testing.T) {
|
||||
conf := newConf(t, "192.168.1.0/29")
|
||||
conf.DefaultGateway = nil
|
||||
path, _, _ := GenerateConfig(conf)
|
||||
content, _ := os.ReadFile(path)
|
||||
|
||||
if !strings.Contains(string(content), "\ndhcp-option=3\n") {
|
||||
t.Errorf("dhcp-option=3 nue absente : sans elle dnsmasq annonce sa propre adresse comme routeur\n%s", content)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateConfig_VxlanEmitsNoRouterOption(t *testing.T) {
|
||||
conf := newConf(t, "192.168.1.0/29")
|
||||
conf.DefaultGateway = nil
|
||||
|
||||
path, _, _ := GenerateConfig(conf)
|
||||
content, _ := os.ReadFile(path)
|
||||
|
||||
if !strings.Contains(string(content), "dhcp-option=121,") {
|
||||
t.Fatalf("dhcp-option=121 attendue pour un subnet vxlan :\n%s", content)
|
||||
}
|
||||
if strings.Contains(string(content), "dhcp-option=3,") {
|
||||
t.Errorf("un subnet vxlan est privé : aucune route par défaut ne doit être émise\n%s", content)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateConfig_ContainsVPCRoute(t *testing.T) {
|
||||
conf := newConf(t, "192.168.1.0/29")
|
||||
path, _, _ := GenerateConfig(conf)
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ func GenerateConfig(c Config) (string, map[string]string, error) {
|
|||
}
|
||||
if c.DefaultGateway != nil {
|
||||
fmt.Fprintf(&sb, "dhcp-option=3,%s\n", c.DefaultGateway.String())
|
||||
} else {
|
||||
fmt.Fprintf(&sb, "dhcp-option=3\n")
|
||||
}
|
||||
fmt.Fprintf(&sb, "dhcp-option=6,1.1.1.1,8.8.8.8\n\n")
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ type Config struct {
|
|||
Network *net.IPNet
|
||||
VPCGateway net.IP // next-hop for VPCRoute (option 121)
|
||||
VPCRoute *net.IPNet // if non-nil, emit dhcp-option=121,VPCRoute,VPCGateway
|
||||
DefaultGateway net.IP // if non-nil, emit dhcp-option=3,DefaultGateway; if nil, emit a bare dhcp-option=3 to suppress the dnsmasq default
|
||||
DefaultGateway net.IP // if non-nil, emit dhcp-option=3,DefaultGateway
|
||||
Name string
|
||||
ConfDir string
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue