mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-14 18:51:34 +03:00
Pull request: dhcpd: assume static ip on eperm
Merge in DNS/adguard-home from 2667-eperm-dhcp to master Updates #2667. Squashed commit of the following: commit 7fad607ae0ae75419005707ee58312bc64fe78c5 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Feb 12 16:27:59 2021 +0300 dhcpd: assume static ip on eperm
This commit is contained in:
parent
0d44822c43
commit
10f03b7527
@ -19,6 +19,8 @@ and this project adheres to
|
||||
|
||||
### Changed
|
||||
|
||||
- "Permission denied" errors when checking if the machine has a static IP no
|
||||
longer prevent the DHCP server from starting ([#2667]).
|
||||
- The server name sent by clients of TLS APIs is not only checked when
|
||||
`strict_sni_check` is enabled ([#2664]).
|
||||
- HTTP API request body size limit for the `/control/access/set` API is
|
||||
@ -40,6 +42,7 @@ and this project adheres to
|
||||
[#2663]: https://github.com/AdguardTeam/AdGuardHome/issues/2663
|
||||
[#2664]: https://github.com/AdguardTeam/AdGuardHome/issues/2664
|
||||
[#2666]: https://github.com/AdguardTeam/AdGuardHome/issues/2666
|
||||
[#2667]: https://github.com/AdguardTeam/AdGuardHome/issues/2667
|
||||
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ package dhcpd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
@ -94,7 +95,20 @@ func (s *Server) enableDHCP(ifaceName string) (code int, err error) {
|
||||
var hasStaticIP bool
|
||||
hasStaticIP, err = sysutil.IfaceHasStaticIP(ifaceName)
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, fmt.Errorf("checking static ip: %w", err)
|
||||
// ErrPermission may happen here on Linux systems where AdGuard
|
||||
// Home is installed using Snap. That doesn't necessarily mean
|
||||
// that the machine doesn't have a static IP, so we can assume
|
||||
// that it has and go on. If the machine doesn't, we'll get an
|
||||
// error later.
|
||||
//
|
||||
// See https://github.com/AdguardTeam/AdGuardHome/issues/2667.
|
||||
if errors.Is(err, os.ErrPermission) {
|
||||
log.Info("error while checking static ip: %s; "+
|
||||
"assuming machine has static ip and going on", err)
|
||||
hasStaticIP = true
|
||||
} else {
|
||||
return http.StatusInternalServerError, fmt.Errorf("checking static ip: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if !hasStaticIP {
|
Loading…
Reference in New Issue
Block a user