Skip to content

Commit

Permalink
Merge pull request #1244 from pmoranga/fix/dns-search-on-ipv4-only
Browse files Browse the repository at this point in the history
Allow to use `dns.search` when only IPv4 is enabled
  • Loading branch information
stgraber authored Sep 23, 2024
2 parents e7a7a94 + 6d2653c commit 9c7cc76
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
15 changes: 8 additions & 7 deletions internal/server/network/driver_ovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -2449,13 +2449,14 @@ func (n *ovn) setup(update bool) error {
}

opts := &networkOVN.OVNDHCPv4Opts{
ServerID: routerIntPortIPv4,
ServerMAC: routerMAC,
Router: routerIntPortIPv4,
DomainName: n.getDomainName(),
LeaseTime: time.Duration(time.Hour * 1),
MTU: bridgeMTU,
Netmask: dhcpV4Netmask,
ServerID: routerIntPortIPv4,
ServerMAC: routerMAC,
Router: routerIntPortIPv4,
DomainName: n.getDomainName(),
LeaseTime: time.Duration(time.Hour * 1),
MTU: bridgeMTU,
Netmask: dhcpV4Netmask,
DNSSearchList: n.getDNSSearchList(),
}

if uplinkNet != nil {
Expand Down
6 changes: 6 additions & 0 deletions internal/server/network/ovn/ovn_nb_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ type OVNDHCPv4Opts struct {
LeaseTime time.Duration
MTU uint32
Netmask string
DNSSearchList []string
}

// OVNDHCPv6Opts IPv6 DHCP option set that can be created (and then applied to a switch port by resulting ID).
Expand Down Expand Up @@ -1254,6 +1255,11 @@ func (o *NB) UpdateLogicalSwitchDHCPv4Options(ctx context.Context, switchName OV
dhcpOption.Options["router"] = opts.Router.String()
}

if len(opts.DNSSearchList) > 0 {
// Special quoting to allow domain names.
dhcpOption.Options["domain_search_list"] = fmt.Sprintf(`"%s"`, strings.Join(opts.DNSSearchList, ","))
}

if opts.RecursiveDNSServer != nil {
nsIPs := make([]string, 0, len(opts.RecursiveDNSServer))
for _, nsIP := range opts.RecursiveDNSServer {
Expand Down

0 comments on commit 9c7cc76

Please sign in to comment.