mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-05-15 00:50:25 +02:00
cmd/cli: ensure extra split rule is always written
Otherwise, the rule may not be added if ctrld does not run in cd mode.
This commit is contained in:
committed by
Cuong Manh Le
parent
c654398981
commit
da91aabc35
+4
-1
@@ -1387,7 +1387,6 @@ func run(appCallback *AppCallback, stopCh chan struct{}) {
|
||||
}
|
||||
|
||||
func writeConfigFile(cfg *ctrld.Config) error {
|
||||
addExtraSplitDnsRule(cfg)
|
||||
if cfu := v.ConfigFileUsed(); cfu != "" {
|
||||
defaultConfigFile = cfu
|
||||
} else if configPath != "" {
|
||||
@@ -1440,6 +1439,7 @@ func readConfigFile(writeDefaultConfig, notice bool) bool {
|
||||
}
|
||||
nop := zerolog.Nop()
|
||||
_, _ = tryUpdateListenerConfig(&cfg, &nop, true)
|
||||
addExtraSplitDnsRule(&cfg)
|
||||
if err := writeConfigFile(&cfg); err != nil {
|
||||
mainLog.Load().Fatal().Msgf("failed to write default config file: %v", err)
|
||||
} else {
|
||||
@@ -2092,6 +2092,9 @@ func mobileListenerIp() string {
|
||||
// than 127.0.0.1 with systemd-resolved.
|
||||
func updateListenerConfig(cfg *ctrld.Config) bool {
|
||||
updated, _ := tryUpdateListenerConfig(cfg, nil, true)
|
||||
if addExtraSplitDnsRule(cfg) {
|
||||
updated = true
|
||||
}
|
||||
return updated
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user