mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-29 10:28:53 +03:00
- windows: install: fix crash due to empty DHCP server pointer
#2036 Squashed commit of the following: commit 5c70d28b241d1a98e034f6798dade073b1b42511 Author: Simon Zolin <s.zolin@adguard.com> Date: Mon Aug 24 18:42:21 2020 +0300 - windows: install: fix crash due to empty DHCP server pointer We should not assign a Go interface value, otherwise `==nil` check doesn't work.
This commit is contained in:
parent
eb3999a261
commit
cb6ca3b0c4
2 changed files with 8 additions and 6 deletions
|
@ -82,9 +82,9 @@ func NewServer(p DNSCreateParams) *Server {
|
||||||
s.dnsFilter = p.DNSFilter
|
s.dnsFilter = p.DNSFilter
|
||||||
s.stats = p.Stats
|
s.stats = p.Stats
|
||||||
s.queryLog = p.QueryLog
|
s.queryLog = p.QueryLog
|
||||||
s.dhcpServer = p.DHCPServer
|
|
||||||
|
|
||||||
if s.dhcpServer != nil {
|
if p.DHCPServer != nil {
|
||||||
|
s.dhcpServer = p.DHCPServer
|
||||||
s.dhcpServer.SetOnLeaseChanged(s.onDHCPLeaseChanged)
|
s.dhcpServer.SetOnLeaseChanged(s.onDHCPLeaseChanged)
|
||||||
s.onDHCPLeaseChanged(dhcpd.LeaseChangedAdded)
|
s.onDHCPLeaseChanged(dhcpd.LeaseChangedAdded)
|
||||||
}
|
}
|
||||||
|
|
10
home/dns.go
10
home/dns.go
|
@ -62,10 +62,12 @@ func initDNSServer() error {
|
||||||
Context.dnsFilter = dnsfilter.New(&filterConf, nil)
|
Context.dnsFilter = dnsfilter.New(&filterConf, nil)
|
||||||
|
|
||||||
p := dnsforward.DNSCreateParams{
|
p := dnsforward.DNSCreateParams{
|
||||||
DNSFilter: Context.dnsFilter,
|
DNSFilter: Context.dnsFilter,
|
||||||
Stats: Context.stats,
|
Stats: Context.stats,
|
||||||
QueryLog: Context.queryLog,
|
QueryLog: Context.queryLog,
|
||||||
DHCPServer: Context.dhcpServer,
|
}
|
||||||
|
if Context.dhcpServer != nil {
|
||||||
|
p.DHCPServer = Context.dhcpServer
|
||||||
}
|
}
|
||||||
Context.dnsServer = dnsforward.NewServer(p)
|
Context.dnsServer = dnsforward.NewServer(p)
|
||||||
dnsConfig := generateServerConfig()
|
dnsConfig := generateServerConfig()
|
||||||
|
|
Loading…
Reference in a new issue