From 8c74f983d1c08c03a9f131abdea8e712a5cf7505 Mon Sep 17 00:00:00 2001 From: ArtemBaskal Date: Mon, 6 Apr 2020 18:37:06 +0300 Subject: [PATCH 1/3] - client: Enabling or disabling a filter list triggers a "loading" screen --- client/src/components/Filters/CustomRules.js | 2 +- client/src/components/Filters/DnsAllowlist.js | 3 ++- client/src/components/Filters/DnsBlocklist.js | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/components/Filters/CustomRules.js b/client/src/components/Filters/CustomRules.js index 8628d7d2..ed10d978 100644 --- a/client/src/components/Filters/CustomRules.js +++ b/client/src/components/Filters/CustomRules.js @@ -32,7 +32,7 @@ class CustomRules extends Component { handleCheck = (values) => { this.props.checkHost(values); - } + }; render() { const { diff --git a/client/src/components/Filters/DnsAllowlist.js b/client/src/components/Filters/DnsAllowlist.js index da397af5..2ea37778 100644 --- a/client/src/components/Filters/DnsAllowlist.js +++ b/client/src/components/Filters/DnsAllowlist.js @@ -64,7 +64,8 @@ class DnsAllowlist extends Component { }, } = this.props; const currentFilterData = getCurrentFilter(modalFilterUrl, whitelistFilters); - const loading = processingFilters + const loading = processingConfigFilter + || processingFilters || processingAddFilter || processingRemoveFilter || processingRefreshFilters; diff --git a/client/src/components/Filters/DnsBlocklist.js b/client/src/components/Filters/DnsBlocklist.js index e5d182e7..4b67a73b 100644 --- a/client/src/components/Filters/DnsBlocklist.js +++ b/client/src/components/Filters/DnsBlocklist.js @@ -60,7 +60,8 @@ class DnsBlocklist extends Component { }, } = this.props; const currentFilterData = getCurrentFilter(modalFilterUrl, filters); - const loading = processingFilters + const loading = processingConfigFilter + || processingFilters || processingAddFilter || processingRemoveFilter || processingRefreshFilters; From 43704901384fe35785383b27a1ad0bd7d430830c Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 7 Apr 2020 11:48:03 +0300 Subject: [PATCH 2/3] - dhcp: web handlers were not registered when DHCP server is disabled So there was no way to enable DHCP from UI --- dhcpd/dhcpd.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dhcpd/dhcpd.go b/dhcpd/dhcpd.go index b40a8ae8..2a4cf959 100644 --- a/dhcpd/dhcpd.go +++ b/dhcpd/dhcpd.go @@ -124,6 +124,11 @@ func Create(config ServerConfig) *Server { } } + if !webHandlersRegistered && s.conf.HTTPRegister != nil { + webHandlersRegistered = true + s.registerHandlers() + } + // we can't delay database loading until DHCP server is started, // because we need static leases functionality available beforehand s.dbLoad() @@ -219,12 +224,6 @@ func (s *Server) setConfig(config ServerConfig) error { // Start will listen on port 67 and serve DHCP requests. func (s *Server) Start() error { - - if !webHandlersRegistered && s.conf.HTTPRegister != nil { - webHandlersRegistered = true - s.registerHandlers() - } - // TODO: don't close if interface and addresses are the same if s.conn != nil { s.closeConn() From 2b1919137d88902d0cfc0cc8f480274e18b2d109 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 7 Apr 2020 12:00:04 +0300 Subject: [PATCH 3/3] * GetValidNetInterfaces: don't skip PointToPoint interfaces --- util/network_utils.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/util/network_utils.go b/util/network_utils.go index a0e482bc..c4c61594 100644 --- a/util/network_utils.go +++ b/util/network_utils.go @@ -36,11 +36,6 @@ func GetValidNetInterfaces() ([]net.Interface, error) { netIfaces := []net.Interface{} for i := range ifaces { - if ifaces[i].Flags&net.FlagPointToPoint != 0 { - // this interface is ppp, we're not interested in this one - continue - } - iface := ifaces[i] netIfaces = append(netIfaces, iface) } @@ -48,7 +43,7 @@ func GetValidNetInterfaces() ([]net.Interface, error) { return netIfaces, nil } -// getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only +// GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only // we do not return link-local addresses here func GetValidNetInterfacesForWeb() ([]NetInterface, error) { ifaces, err := GetValidNetInterfaces() @@ -101,7 +96,7 @@ func GetValidNetInterfacesForWeb() ([]NetInterface, error) { return netInterfaces, nil } -// Get interface name by its IP address. +// GetInterfaceByIP - Get interface name by its IP address. func GetInterfaceByIP(ip string) string { ifaces, err := GetValidNetInterfacesForWeb() if err != nil { @@ -119,7 +114,7 @@ func GetInterfaceByIP(ip string) string { return "" } -// Get IP address with netmask for the specified interface +// GetSubnet - Get IP address with netmask for the specified interface // Returns an empty string if it fails to find it func GetSubnet(ifaceName string) string { netIfaces, err := GetValidNetInterfacesForWeb() @@ -137,7 +132,7 @@ func GetSubnet(ifaceName string) string { return "" } -// checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily +// CheckPortAvailable - check if TCP port is available func CheckPortAvailable(host string, port int) error { ln, err := net.Listen("tcp", net.JoinHostPort(host, strconv.Itoa(port))) if err != nil { @@ -151,6 +146,7 @@ func CheckPortAvailable(host string, port int) error { return nil } +// CheckPacketPortAvailable - check if UDP port is available func CheckPacketPortAvailable(host string, port int) error { ln, err := net.ListenPacket("udp", net.JoinHostPort(host, strconv.Itoa(port))) if err != nil { @@ -164,7 +160,7 @@ func CheckPacketPortAvailable(host string, port int) error { return err } -// check if error is "address already in use" +// ErrorIsAddrInUse - check if error is "address already in use" func ErrorIsAddrInUse(err error) bool { errOpError, ok := err.(*net.OpError) if !ok {