docstring_tokens
stringlengths 0
76.5k
| code_tokens
stringlengths 75
1.81M
| label_window
sequencelengths 4
2.12k
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|---|
func TestInterfaceByIP(t *testing.T) { | <mask> })
<mask> }
<mask> }
<mask>
<mask> func TestGetInterfaceByIP(t *testing.T) {
<mask> ifaces, err := GetValidNetInterfacesForWeb()
<mask> require.NoError(t, err)
<mask> require.NotEmpty(t, ifaces)
<mask>
<mask> for _, iface := range ifaces {
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove ifaceName := GetInterfaceByIP(ip)
</s> add ifaceName := InterfaceByIP(ip) </s> remove // GetInterfaceByIP returns the name of interface containing provided ip.
</s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb.
func GetInterfaceByIP(ip net.IP) string {
</s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one
// IP address can be shared by multiple interfaces in some configurations.
//
// TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
func InterfaceByIP(ip net.IP) (ifaceName string) { </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb.
</s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. </s> remove TLS: nil,
Addresses: []*netutil.IPPort{{
IP: net.IP{127, 0, 0, 1},
Port: 0,
}},
</s> add TLS: nil,
Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:0")}, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/aghnet/net_test.go |
ifaceName := InterfaceByIP(ip) | <mask> t.Run(iface.Name, func(t *testing.T) {
<mask> require.NotEmpty(t, iface.Addresses)
<mask>
<mask> for _, ip := range iface.Addresses {
<mask> ifaceName := GetInterfaceByIP(ip)
<mask> require.Equal(t, iface.Name, ifaceName)
<mask> }
<mask> })
<mask> }
<mask> }
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove func TestGetInterfaceByIP(t *testing.T) {
</s> add func TestInterfaceByIP(t *testing.T) { </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb.
func GetInterfaceByIP(ip net.IP) string {
</s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one
// IP address can be shared by multiple interfaces in some configurations.
//
// TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
func InterfaceByIP(ip net.IP) (ifaceName string) { </s> remove TLS: nil,
Addresses: []*netutil.IPPort{{
IP: net.IP{127, 0, 0, 1},
Port: 0,
}},
</s> add TLS: nil,
Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:0")}, </s> remove // GetInterfaceByIP returns the name of interface containing provided ip.
</s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove interfaceName := aghnet.GetInterfaceByIP(ip)
</s> add interfaceName := aghnet.InterfaceByIP(ip) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/aghnet/net_test.go |
interfaceName := aghnet.InterfaceByIP(ip) | <mask> // Or if set=true, it tries to set it
<mask> func handleStaticIP(ip net.IP, set bool) staticIPJSON {
<mask> resp := staticIPJSON{}
<mask>
<mask> interfaceName := aghnet.GetInterfaceByIP(ip)
<mask> resp.Static = "no"
<mask>
<mask> if len(interfaceName) == 0 {
<mask> resp.Static = "error"
<mask> resp.Error = fmt.Sprintf("Couldn't find network interface by IP %s", ip)
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb.
</s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb.
func GetInterfaceByIP(ip net.IP) string {
</s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one
// IP address can be shared by multiple interfaces in some configurations.
//
// TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
func InterfaceByIP(ip net.IP) (ifaceName string) { </s> remove // GetInterfaceByIP returns the name of interface containing provided ip.
</s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove Addresses: []*netutil.IPPort{{
IP: net.IP{127, 0, 0, 1},
Port: 3001,
}},
Start: start,
Timeout: 60 * time.Second,
</s> add Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:3001")},
Start: start,
Timeout: 60 * time.Second, </s> remove func TestGetInterfaceByIP(t *testing.T) {
</s> add func TestInterfaceByIP(t *testing.T) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/home/controlinstall.go |
"net/netip" | <mask> import (
<mask> "context"
<mask> "io/fs"
<mask> "math/rand"
<mask> "net"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/v1/websvc"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/golibs/netutil"
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove "net"
</s> add </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/cmd/cmd.go |
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/v1/websvc"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> )
<mask>
<mask> // Main is the entry point of application.
<mask> func Main(clientBuildFS fs.FS) {
<mask> // # Initial Configuration
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove "net"
</s> add "net/netip" </s> remove // GetInterfaceByIP returns the name of interface containing provided ip.
</s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove SecureAddresses []*netutil.IPPort
</s> add SecureAddresses []netip.AddrPort | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/cmd/cmd.go |
|
Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:3001")},
Start: start,
Timeout: 60 * time.Second, | <mask> _ = clientBuildFS
<mask>
<mask> // TODO(a.garipov): Make configurable.
<mask> web := websvc.New(&websvc.Config{
<mask> Addresses: []*netutil.IPPort{{
<mask> IP: net.IP{127, 0, 0, 1},
<mask> Port: 3001,
<mask> }},
<mask> Start: start,
<mask> Timeout: 60 * time.Second,
<mask> })
<mask>
<mask> err := web.Start()
<mask> fatalOnError(err)
<mask>
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove TLS: nil,
Addresses: []*netutil.IPPort{{
IP: net.IP{127, 0, 0, 1},
Port: 0,
}},
</s> add TLS: nil,
Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:0")}, </s> remove interfaceName := aghnet.GetInterfaceByIP(ip)
</s> add interfaceName := aghnet.InterfaceByIP(ip) </s> remove func TestGetInterfaceByIP(t *testing.T) {
</s> add func TestInterfaceByIP(t *testing.T) { </s> remove ifaceName := GetInterfaceByIP(ip)
</s> add ifaceName := InterfaceByIP(ip) </s> remove // GetInterfaceByIP returns the name of interface containing provided ip.
</s> add // InterfaceByIP returns the name of the interface bound to ip. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/cmd/cmd.go |
"net/netip" | <mask> "net"
<mask> "net/http"
<mask> "sync"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/v1/agh"
<mask> "github.com/AdguardTeam/golibs/errors"
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove "net"
</s> add </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove "net"
</s> add "net/netip" </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/websvc/websvc.go |
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/v1/agh"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> httptreemux "github.com/dimfeld/httptreemux/v5"
<mask> )
<mask>
<mask> // Config is the AdGuard Home web service configuration structure.
<mask> type Config struct {
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove SecureAddresses []*netutil.IPPort
</s> add SecureAddresses []netip.AddrPort </s> remove "net"
</s> add "net/netip" | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/websvc/websvc.go |
|
Addresses []netip.AddrPort | <mask> // SecureAddresses must not be empty.
<mask> TLS *tls.Config
<mask>
<mask> // Addresses are the addresses on which to serve the plain HTTP API.
<mask> Addresses []*netutil.IPPort
<mask>
<mask> // SecureAddresses are the addresses on which to serve the HTTPS API. If
<mask> // SecureAddresses is not empty, TLS must not be nil.
<mask> SecureAddresses []*netutil.IPPort
<mask>
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove SecureAddresses []*netutil.IPPort
</s> add SecureAddresses []netip.AddrPort </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb.
</s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. </s> remove // GetInterfaceByIP returns the name of interface containing provided ip.
</s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb.
func GetInterfaceByIP(ip net.IP) string {
</s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one
// IP address can be shared by multiple interfaces in some configurations.
//
// TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
func InterfaceByIP(ip net.IP) (ifaceName string) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/websvc/websvc.go |
SecureAddresses []netip.AddrPort | <mask> Addresses []*netutil.IPPort
<mask>
<mask> // SecureAddresses are the addresses on which to serve the HTTPS API. If
<mask> // SecureAddresses is not empty, TLS must not be nil.
<mask> SecureAddresses []*netutil.IPPort
<mask>
<mask> // Start is the time of start of AdGuard Home.
<mask> Start time.Time
<mask>
<mask> // Timeout is the timeout for all server operations.
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove Addresses []*netutil.IPPort
</s> add Addresses []netip.AddrPort </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove // GetInterfaceByIP returns the name of interface containing provided ip.
</s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb.
</s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/websvc/websvc.go |
<mask>
<mask> import (
<mask> "context"
<mask> "io"
<mask> "net"
<mask> "net/http"
<mask> "net/url"
<mask> "testing"
<mask> "time"
<mask>
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove "net"
</s> add "net/netip" </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/websvc/websvc_test.go |
|
"net/netip" | <mask> "io"
<mask> "net/http"
<mask> "net/url"
<mask> "testing"
<mask> "time"
<mask>
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove "net"
</s> add </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove "net"
</s> add "net/netip" </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/websvc/websvc_test.go |
<mask> "testing"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/v1/websvc"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> "github.com/AdguardTeam/golibs/testutil"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove "net"
</s> add "net/netip" </s> remove "net"
</s> add </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/websvc/websvc_test.go |
|
TLS: nil,
Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:0")}, | <mask> func newTestServer(t testing.TB) (svc *websvc.Service, addr string) {
<mask> t.Helper()
<mask>
<mask> c := &websvc.Config{
<mask> TLS: nil,
<mask> Addresses: []*netutil.IPPort{{
<mask> IP: net.IP{127, 0, 0, 1},
<mask> Port: 0,
<mask> }},
<mask> SecureAddresses: nil,
<mask> Timeout: testTimeout,
<mask> Start: testStart,
<mask> }
<mask>
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove Addresses: []*netutil.IPPort{{
IP: net.IP{127, 0, 0, 1},
Port: 3001,
}},
Start: start,
Timeout: 60 * time.Second,
</s> add Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:3001")},
Start: start,
Timeout: 60 * time.Second, </s> remove func TestGetInterfaceByIP(t *testing.T) {
</s> add func TestInterfaceByIP(t *testing.T) { </s> remove ifaceName := GetInterfaceByIP(ip)
</s> add ifaceName := InterfaceByIP(ip) </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb.
func GetInterfaceByIP(ip net.IP) string {
</s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one
// IP address can be shared by multiple interfaces in some configurations.
//
// TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
func InterfaceByIP(ip net.IP) (ifaceName string) { </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb.
</s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | internal/v1/websvc/websvc_test.go |
'responses':
'200':
'description': >
An OK response.
'content':
'text/plain':
'example': 'OK' | <mask> '/health-check':
<mask> 'get':
<mask> 'operationId': 'HealthCheck'
<mask> 'servers':
<mask> - 'url': '/'
<mask> 'summary': 'Check if the server is up.'
<mask> 'tags':
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove SecureAddresses []*netutil.IPPort
</s> add SecureAddresses []netip.AddrPort </s> remove 'force_https':
'description': >
If `true`, enabled the HTTP-to-HTTPS redirect.
'type': 'boolean'
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
'PatchV1SettingsHttpReq':
'content':
'application/json':
'schema':
'$ref': '#/components/schemas/PatchV1SettingsHttpReq'
'required': true
| <mask> '$ref': '#/components/schemas/PatchV1SettingsDnsReq'
<mask> 'required': true
<mask>
<mask> 'PatchV1SettingsLogReq':
<mask> 'content':
<mask> 'application/json':
<mask> 'schema':
<mask> '$ref': '#/components/schemas/PatchV1SettingsLogReq'
<mask> 'required': true
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove 'force_https': true
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
'PatchV1SettingsHttpResp':
'content':
'application/json':
'schema':
'$ref': '#/components/schemas/PatchV1SettingsHttpResp'
'description': >
A successful response to a `PATCH /api/v1/settings/http` request.
| <mask> '$ref': '#/components/schemas/PatchV1SettingsDnsResp'
<mask> 'description': >
<mask> A successful response to a `PATCH /api/v1/settings/dns` request.
<mask>
<mask> 'PatchV1SettingsLogResp':
<mask> 'content':
<mask> 'application/json':
<mask> 'schema':
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
'addresses':
- '127.0.0.1:53'
- '192.168.1.1:53' | <mask> - '$ref': '#/components/schemas/DnsSettingsPatch'
<mask> - 'description': >
<mask> DNS server settings.
<mask> 'example':
<mask> 'blocking_mode': 'default'
<mask> 'bootstrap_servers':
<mask> - '9.9.9.10'
<mask> - '149.112.112.10'
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove - 'force_https'
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
'upstream_timeout': '1s' | <mask> 'upstream_mode': 'load_balancing'
<mask> 'upstream_servers':
<mask> - '1.1.1.1'
<mask> - '8.8.8.8'
<mask> 'required':
<mask> - 'addresses'
<mask> - 'blocking_mode'
<mask> - 'bootstrap_servers'
<mask> - 'cache_size'
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove - 'force_https'
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
- 'addresses' | <mask> - '8.8.8.8'
<mask> 'upstream_timeout': '1s'
<mask> 'required':
<mask> - 'blocking_mode'
<mask> - 'bootstrap_servers'
<mask> - 'cache_size'
<mask> - 'cache_ttl_max'
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove - 'force_https'
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
- 'upstream_timeout' | <mask> - 'ipv6'
<mask> - 'rate_limit'
<mask> - 'upstream_mode'
<mask> - 'upstream_servers'
<mask>
<mask> 'DnsSettingsPatch':
<mask> 'description': >
<mask> DNS server settings update object.
<mask> 'example':
<mask> 'cache_size': 4194304
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove - 'force_https'
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
'addresses':
'description': >
Addresses on which to serve plain DNS, in ip:port format. Empty
array disables plain DNS.
'items':
'type': 'string'
'type': 'array' | <mask> 'cache_size': 4194304
<mask> 'upstream_servers':
<mask> - '1.1.1.1'
<mask> 'properties':
<mask> 'blocking_ipv4':
<mask> 'description': >
<mask> IPv4 address to respond with when `blocking_mode` is `custom_ip`.
<mask> See the documentation for the `DnsBlockingMode` schema. If
<mask> `blocking_mode` is different from `custom_ip`, this property is not
<mask> included.
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove SecureAddresses []*netutil.IPPort
</s> add SecureAddresses []netip.AddrPort </s> remove Addresses []*netutil.IPPort
</s> add Addresses []netip.AddrPort </s> remove 'force_https':
'description': >
If `true`, enabled the HTTP-to-HTTPS redirect.
'type': 'boolean'
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
'upstream_timeout':
'description': >
Upstream request timeout, as a human readable duration.
'type': 'string' | <mask> 'items':
<mask> '$ref': '#/components/schemas/UpstreamServerAddr'
<mask> 'type': 'array'
<mask> 'type': 'object'
<mask>
<mask> 'DnsType':
<mask> 'description': >
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove 'force_https':
'description': >
If `true`, enabled the HTTP-to-HTTPS redirect.
'type': 'boolean'
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
'http':
'$ref': '#/components/schemas/HttpSettings' | <mask> 'dhcp':
<mask> '$ref': '#/components/schemas/DhcpSettings'
<mask> 'dns':
<mask> '$ref': '#/components/schemas/DnsSettings'
<mask> 'log':
<mask> '$ref': '#/components/schemas/LogSettings'
<mask> 'protection':
<mask> '$ref': '#/components/schemas/ProtectionSettings'
<mask> 'stats':
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
- 'http' | <mask> - 'dhcp'
<mask> - 'dns'
<mask> - 'log'
<mask> - 'protection'
<mask> - 'stats'
<mask> - 'tls'
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove - 'force_https'
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
'PatchV1SettingsHttpReq':
'$ref': '#/components/schemas/HttpSettingsPatch'
'PatchV1SettingsHttpResp':
'$ref': '#/components/schemas/HttpSettings'
| <mask>
<mask> 'PatchV1SettingsDnsResp':
<mask> '$ref': '#/components/schemas/DnsSettings'
<mask>
<mask> 'PatchV1SettingsLogReq':
<mask> '$ref': '#/components/schemas/LogSettingsPatch'
<mask>
<mask> 'PatchV1SettingsLogResp':
<mask> '$ref': '#/components/schemas/LogSettings'
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
<mask> TLS and encryption settings.
<mask> 'example':
<mask> 'certificate_path': '/etc/ssl/example.com.cert'
<mask> 'enabled': true
<mask> 'force_https': true
<mask> 'port_dns_over_quic': 784
<mask> 'port_dns_over_tls': 853
<mask> 'port_https': 443
<mask> 'private_key_path': '/etc/ssl/example.com.key'
<mask> 'server_name': 'dns.example.com'
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove - 'force_https'
</s> add </s> remove 'force_https':
'description': >
If `true`, enabled the HTTP-to-HTTPS redirect.
'type': 'boolean'
</s> add </s> remove Addresses []*netutil.IPPort
</s> add Addresses []netip.AddrPort | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
|
<mask> 'private_key_path': '/etc/ssl/example.com.key'
<mask> 'server_name': 'dns.example.com'
<mask> 'required':
<mask> - 'enabled'
<mask> - 'force_https'
<mask> - 'port_dns_over_quic'
<mask> - 'port_dns_over_tls'
<mask> - 'port_https'
<mask> - 'server_name'
<mask>
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
|
<mask> If `true`, AdGuard Home the administration interface will be served
<mask> over HTTPS, and the DNS server will listen requests over
<mask> DNS-over-TLS and other protocols.
<mask> 'type': 'boolean'
<mask> 'force_https':
<mask> 'description': >
<mask> If `true`, enabled the HTTP-to-HTTPS redirect.
<mask> 'type': 'boolean'
<mask> 'port_dns_over_quic':
<mask> 'default': 784
<mask> 'description': >
<mask> The DNS-over-QUIC port. If `0`, DNS-over-QUIC is disabled.
<mask> 'format': 'int64'
</s> Pull request: upd-websvc
Merge in DNS/adguard-home from upd-websvc to master
Squashed commit of the following:
commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94
Author: Ainar Garipov <[email protected]>
Date: Tue Aug 9 18:55:42 2022 +0300
all: upd openapi, websvc </s> remove 'force_https': true
</s> add </s> remove SecureAddresses []*netutil.IPPort
</s> add SecureAddresses []netip.AddrPort </s> remove Addresses []*netutil.IPPort
</s> add Addresses []netip.AddrPort | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593 | openapi/v1.yaml |
|
// BroadcastFromIPNet calculates the broadcast IP address for n.
func BroadcastFromIPNet(n *net.IPNet) (dc net.IP) {
dc = netutil.CloneIP(n.IP)
mask := n.Mask
if mask == nil {
mask = dc.DefaultMask()
}
for i, b := range mask {
dc[i] |= ^b
}
return dc
} | <mask> }
<mask>
<mask> return addrs, nil
<mask> }
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove // netIface is the interface for network interface methods.
type netIface interface {
Addrs() ([]net.Addr, error)
}
// ifaceIPAddrs returns the interface's IP addresses.
func ifaceIPAddrs(iface netIface, ipv ipVersion) (ips []net.IP, err error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, err
}
for _, a := range addrs {
var ip net.IP
switch a := a.(type) {
case *net.IPAddr:
ip = a.IP
case *net.IPNet:
ip = a.IP
default:
continue
}
// Assume that net.(*Interface).Addrs can only return valid IPv4
// and IPv6 addresses. Thus, if it isn't an IPv4 address, it
// must be an IPv6 one.
switch ipv {
case ipVersion4:
if ip4 := ip.To4(); ip4 != nil {
ips = append(ips, ip4)
}
case ipVersion6:
if ip6 := ip.To4(); ip6 == nil {
ips = append(ips, ip)
}
default:
return nil, fmt.Errorf("invalid ip version %d", ipv)
}
}
return ips, nil
}
</s> add </s> remove
// ifaceDNSIPAddrs returns IP addresses of the interface suitable to send to
// clients as DNS addresses. If err is nil, addrs contains either no addresses
// or at least two.
//
// It makes up to maxAttempts attempts to get the addresses if there are none,
// each time using the provided backoff. Sometimes an interface needs a few
// seconds to really ititialize.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2304.
func ifaceDNSIPAddrs(
iface netIface,
ipv ipVersion,
maxAttempts int,
backoff time.Duration,
) (addrs []net.IP, err error) {
var n int
for n = 1; n <= maxAttempts; n++ {
addrs, err = ifaceIPAddrs(iface, ipv)
if err != nil {
return nil, fmt.Errorf("getting ip addrs: %w", err)
}
if len(addrs) > 0 {
break
}
log.Debug("dhcpv%d: attempt %d: no ip addresses", ipv, n)
time.Sleep(backoff)
}
switch len(addrs) {
case 0:
// Don't return errors in case the users want to try and enable
// the DHCP server later.
t := time.Duration(n) * backoff
log.Error("dhcpv%d: no ip for iface after %d attempts and %s", ipv, n, t)
return nil, nil
case 1:
// Some Android devices use 8.8.8.8 if there is not a secondary
// DNS server. Fix that by setting the secondary DNS address to
// the same address.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/1708.
log.Debug("dhcpv%d: setting secondary dns ip to itself", ipv)
addrs = append(addrs, addrs[0])
default:
// Go on.
}
log.Debug("dhcpv%d: got addresses %s after %d attempts", ipv, addrs, n)
return addrs, nil
}
</s> add </s> remove func isTimeout(err error) bool {
operr, ok := err.(*net.OpError)
if !ok {
return false
}
return operr.Timeout()
}
</s> add </s> remove
bcastIP := netutil.CloneIP(routerIP)
for i, b := range subnetMask {
bcastIP[i] |= ^b
}
s.conf.broadcastIP = bcastIP
</s> add s.conf.broadcastIP = aghnet.BroadcastFromIPNet(s.conf.subnet) </s> remove
found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName)
if found6 {
result.V6.OtherServer.Found = "yes"
} else if err6 != nil {
</s> add if err6 != nil { | [
"keep",
"keep",
"keep",
"add"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/aghnet/net.go |
// getNetworkSetupHardwareReports parses the output of the `networksetup
// -listallhardwareports` command it returns a map where the key is the
// interface name, and the value is the "hardware port" returns nil if it fails
// to parse the output
//
// TODO(e.burkov): There should be more proper approach than parsing the
// command output. For example, see
// https://developer.apple.com/documentation/systemconfiguration. | <mask>
<mask> return getHardwarePortInfo(hardwarePort)
<mask> }
<mask>
<mask> // getNetworkSetupHardwareReports parses the output of the `networksetup -listallhardwareports` command
<mask> // it returns a map where the key is the interface name, and the value is the "hardware port"
<mask> // returns nil if it fails to parse the output
<mask> func getNetworkSetupHardwareReports() map[string]string {
<mask> _, out, err := aghos.RunCommand("networksetup", "-listallhardwareports")
<mask> if err != nil {
<mask> return nil
<mask> }
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove
// ifaceDNSIPAddrs returns IP addresses of the interface suitable to send to
// clients as DNS addresses. If err is nil, addrs contains either no addresses
// or at least two.
//
// It makes up to maxAttempts attempts to get the addresses if there are none,
// each time using the provided backoff. Sometimes an interface needs a few
// seconds to really ititialize.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2304.
func ifaceDNSIPAddrs(
iface netIface,
ipv ipVersion,
maxAttempts int,
backoff time.Duration,
) (addrs []net.IP, err error) {
var n int
for n = 1; n <= maxAttempts; n++ {
addrs, err = ifaceIPAddrs(iface, ipv)
if err != nil {
return nil, fmt.Errorf("getting ip addrs: %w", err)
}
if len(addrs) > 0 {
break
}
log.Debug("dhcpv%d: attempt %d: no ip addresses", ipv, n)
time.Sleep(backoff)
}
switch len(addrs) {
case 0:
// Don't return errors in case the users want to try and enable
// the DHCP server later.
t := time.Duration(n) * backoff
log.Error("dhcpv%d: no ip for iface after %d attempts and %s", ipv, n, t)
return nil, nil
case 1:
// Some Android devices use 8.8.8.8 if there is not a secondary
// DNS server. Fix that by setting the secondary DNS address to
// the same address.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/1708.
log.Debug("dhcpv%d: setting secondary dns ip to itself", ipv)
addrs = append(addrs, addrs[0])
default:
// Go on.
}
log.Debug("dhcpv%d: got addresses %s after %d attempts", ipv, addrs, n)
return addrs, nil
}
</s> add </s> remove // netIface is the interface for network interface methods.
type netIface interface {
Addrs() ([]net.Addr, error)
}
// ifaceIPAddrs returns the interface's IP addresses.
func ifaceIPAddrs(iface netIface, ipv ipVersion) (ips []net.IP, err error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, err
}
for _, a := range addrs {
var ip net.IP
switch a := a.(type) {
case *net.IPAddr:
ip = a.IP
case *net.IPNet:
ip = a.IP
default:
continue
}
// Assume that net.(*Interface).Addrs can only return valid IPv4
// and IPv6 addresses. Thus, if it isn't an IPv4 address, it
// must be an IPv6 one.
switch ipv {
case ipVersion4:
if ip4 := ip.To4(); ip4 != nil {
ips = append(ips, ip4)
}
case ipVersion6:
if ip6 := ip.To4(); ip6 == nil {
ips = append(ips, ip)
}
default:
return nil, fmt.Errorf("invalid ip version %d", ipv)
}
}
return ips, nil
}
</s> add </s> remove
"github.com/AdguardTeam/golibs/log"
)
// ipVersion is a documentational alias for int. Use it when the integer means
// IP version.
type ipVersion = int
// IP version constants.
const (
ipVersion4 ipVersion = 4
ipVersion6 ipVersion = 6
</s> add </s> remove defaultDiscoverTime = time.Second * 3
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/aghnet/net_darwin.go |
//go:build !(linux || darwin || freebsd || openbsd)
// +build !linux,!darwin,!freebsd,!openbsd | <mask> //go:build !(linux || darwin || freebsd)
<mask> // +build !linux,!darwin,!freebsd
<mask>
<mask> package aghnet
<mask>
<mask> import (
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos"
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove "fmt"
"net"
</s> add </s> remove
"github.com/AdguardTeam/golibs/log"
)
// ipVersion is a documentational alias for int. Use it when the integer means
// IP version.
type ipVersion = int
// IP version constants.
const (
ipVersion4 ipVersion = 4
ipVersion6 ipVersion = 6
</s> add </s> remove defaultDiscoverTime = time.Second * 3
</s> add | [
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/aghnet/net_others.go |
"net" | <mask>
<mask> import (
<mask> "testing"
<mask>
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove "fmt"
"net"
</s> add </s> remove
"github.com/AdguardTeam/golibs/log"
)
// ipVersion is a documentational alias for int. Use it when the integer means
// IP version.
type ipVersion = int
// IP version constants.
const (
ipVersion4 ipVersion = 4
ipVersion6 ipVersion = 6
</s> add </s> remove //go:build !(linux || darwin || freebsd)
// +build !linux,!darwin,!freebsd
</s> add //go:build !(linux || darwin || freebsd || openbsd)
// +build !linux,!darwin,!freebsd,!openbsd </s> remove defaultDiscoverTime = time.Second * 3
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/aghnet/net_test.go |
"github.com/stretchr/testify/assert" | <mask> import (
<mask> "net"
<mask> "testing"
<mask>
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> func TestGetValidNetInterfacesForWeb(t *testing.T) {
<mask> ifaces, err := GetValidNetInterfacesForWeb()
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove "fmt"
"net"
</s> add </s> remove func isTimeout(err error) bool {
operr, ok := err.(*net.OpError)
if !ok {
return false
}
return operr.Timeout()
}
</s> add </s> remove
"github.com/AdguardTeam/golibs/log"
)
// ipVersion is a documentational alias for int. Use it when the integer means
// IP version.
type ipVersion = int
// IP version constants.
const (
ipVersion4 ipVersion = 4
ipVersion6 ipVersion = 6
</s> add </s> remove // netIface is the interface for network interface methods.
type netIface interface {
Addrs() ([]net.Addr, error)
}
// ifaceIPAddrs returns the interface's IP addresses.
func ifaceIPAddrs(iface netIface, ipv ipVersion) (ips []net.IP, err error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, err
}
for _, a := range addrs {
var ip net.IP
switch a := a.(type) {
case *net.IPAddr:
ip = a.IP
case *net.IPNet:
ip = a.IP
default:
continue
}
// Assume that net.(*Interface).Addrs can only return valid IPv4
// and IPv6 addresses. Thus, if it isn't an IPv4 address, it
// must be an IPv6 one.
switch ipv {
case ipVersion4:
if ip4 := ip.To4(); ip4 != nil {
ips = append(ips, ip4)
}
case ipVersion6:
if ip6 := ip.To4(); ip6 == nil {
ips = append(ips, ip)
}
default:
return nil, fmt.Errorf("invalid ip version %d", ipv)
}
}
return ips, nil
}
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/aghnet/net_test.go |
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> )
<mask>
<mask> const (
<mask> defaultDiscoverTime = time.Second * 3
<mask> // leaseExpireStatic is used to define the Expiry field for static
<mask> // leases.
<mask> //
<mask> // TODO(e.burkov): Remove it when static leases determining mechanism
<mask> // will be improved.
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove
"github.com/AdguardTeam/golibs/log"
)
// ipVersion is a documentational alias for int. Use it when the integer means
// IP version.
type ipVersion = int
// IP version constants.
const (
ipVersion4 ipVersion = 4
ipVersion6 ipVersion = 6
</s> add </s> remove // getNetworkSetupHardwareReports parses the output of the `networksetup -listallhardwareports` command
// it returns a map where the key is the interface name, and the value is the "hardware port"
// returns nil if it fails to parse the output
</s> add // getNetworkSetupHardwareReports parses the output of the `networksetup
// -listallhardwareports` command it returns a map where the key is the
// interface name, and the value is the "hardware port" returns nil if it fails
// to parse the output
//
// TODO(e.burkov): There should be more proper approach than parsing the
// command output. For example, see
// https://developer.apple.com/documentation/systemconfiguration. </s> remove // netIface is the interface for network interface methods.
type netIface interface {
Addrs() ([]net.Addr, error)
}
// ifaceIPAddrs returns the interface's IP addresses.
func ifaceIPAddrs(iface netIface, ipv ipVersion) (ips []net.IP, err error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, err
}
for _, a := range addrs {
var ip net.IP
switch a := a.(type) {
case *net.IPAddr:
ip = a.IP
case *net.IPNet:
ip = a.IP
default:
continue
}
// Assume that net.(*Interface).Addrs can only return valid IPv4
// and IPv6 addresses. Thus, if it isn't an IPv4 address, it
// must be an IPv6 one.
switch ipv {
case ipVersion4:
if ip4 := ip.To4(); ip4 != nil {
ips = append(ips, ip4)
}
case ipVersion6:
if ip6 := ip.To4(); ip6 == nil {
ips = append(ips, ip)
}
default:
return nil, fmt.Errorf("invalid ip version %d", ipv)
}
}
return ips, nil
}
</s> add </s> remove
// ifaceDNSIPAddrs returns IP addresses of the interface suitable to send to
// clients as DNS addresses. If err is nil, addrs contains either no addresses
// or at least two.
//
// It makes up to maxAttempts attempts to get the addresses if there are none,
// each time using the provided backoff. Sometimes an interface needs a few
// seconds to really ititialize.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2304.
func ifaceDNSIPAddrs(
iface netIface,
ipv ipVersion,
maxAttempts int,
backoff time.Duration,
) (addrs []net.IP, err error) {
var n int
for n = 1; n <= maxAttempts; n++ {
addrs, err = ifaceIPAddrs(iface, ipv)
if err != nil {
return nil, fmt.Errorf("getting ip addrs: %w", err)
}
if len(addrs) > 0 {
break
}
log.Debug("dhcpv%d: attempt %d: no ip addresses", ipv, n)
time.Sleep(backoff)
}
switch len(addrs) {
case 0:
// Don't return errors in case the users want to try and enable
// the DHCP server later.
t := time.Duration(n) * backoff
log.Error("dhcpv%d: no ip for iface after %d attempts and %s", ipv, n, t)
return nil, nil
case 1:
// Some Android devices use 8.8.8.8 if there is not a secondary
// DNS server. Fix that by setting the secondary DNS address to
// the same address.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/1708.
log.Debug("dhcpv%d: setting secondary dns ip to itself", ipv)
addrs = append(addrs, addrs[0])
default:
// Go on.
}
log.Debug("dhcpv%d: got addresses %s after %d attempts", ipv, addrs, n)
return addrs, nil
}
</s> add </s> remove result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
</s> add // TODO(e.burkov): The returned IP should only be of version 4.
result.V4.StaticIP.IP = aghnet.GetSubnet(ifaceName).String() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/dhcpd.go |
|
<mask> "fmt"
<mask> "net"
<mask> )
<mask>
<mask> func isTimeout(err error) bool {
<mask> operr, ok := err.(*net.OpError)
<mask> if !ok {
<mask> return false
<mask> }
<mask> return operr.Timeout()
<mask> }
<mask>
<mask> func tryTo4(ip net.IP) (ip4 net.IP, err error) {
<mask> if ip == nil {
<mask> return nil, fmt.Errorf("%v is not an IP address", ip)
<mask> }
<mask>
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove // netIface is the interface for network interface methods.
type netIface interface {
Addrs() ([]net.Addr, error)
}
// ifaceIPAddrs returns the interface's IP addresses.
func ifaceIPAddrs(iface netIface, ipv ipVersion) (ips []net.IP, err error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, err
}
for _, a := range addrs {
var ip net.IP
switch a := a.(type) {
case *net.IPAddr:
ip = a.IP
case *net.IPNet:
ip = a.IP
default:
continue
}
// Assume that net.(*Interface).Addrs can only return valid IPv4
// and IPv6 addresses. Thus, if it isn't an IPv4 address, it
// must be an IPv6 one.
switch ipv {
case ipVersion4:
if ip4 := ip.To4(); ip4 != nil {
ips = append(ips, ip4)
}
case ipVersion6:
if ip6 := ip.To4(); ip6 == nil {
ips = append(ips, ip)
}
default:
return nil, fmt.Errorf("invalid ip version %d", ipv)
}
}
return ips, nil
}
</s> add </s> remove
// ifaceDNSIPAddrs returns IP addresses of the interface suitable to send to
// clients as DNS addresses. If err is nil, addrs contains either no addresses
// or at least two.
//
// It makes up to maxAttempts attempts to get the addresses if there are none,
// each time using the provided backoff. Sometimes an interface needs a few
// seconds to really ititialize.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2304.
func ifaceDNSIPAddrs(
iface netIface,
ipv ipVersion,
maxAttempts int,
backoff time.Duration,
) (addrs []net.IP, err error) {
var n int
for n = 1; n <= maxAttempts; n++ {
addrs, err = ifaceIPAddrs(iface, ipv)
if err != nil {
return nil, fmt.Errorf("getting ip addrs: %w", err)
}
if len(addrs) > 0 {
break
}
log.Debug("dhcpv%d: attempt %d: no ip addresses", ipv, n)
time.Sleep(backoff)
}
switch len(addrs) {
case 0:
// Don't return errors in case the users want to try and enable
// the DHCP server later.
t := time.Duration(n) * backoff
log.Error("dhcpv%d: no ip for iface after %d attempts and %s", ipv, n, t)
return nil, nil
case 1:
// Some Android devices use 8.8.8.8 if there is not a secondary
// DNS server. Fix that by setting the secondary DNS address to
// the same address.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/1708.
log.Debug("dhcpv%d: setting secondary dns ip to itself", ipv)
addrs = append(addrs, addrs[0])
default:
// Go on.
}
log.Debug("dhcpv%d: got addresses %s after %d attempts", ipv, addrs, n)
return addrs, nil
}
</s> add </s> remove interfaceName := strings.TrimSpace(string(body))
if interfaceName == "" {
</s> add ifaceName := strings.TrimSpace(string(body))
if ifaceName == "" { </s> remove dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion4, defaultMaxAttempts, defaultBackoff)
</s> add dnsIPAddrs, err := aghnet.IfaceDNSIPAddrs(
iface,
aghnet.IPVersion4,
defaultMaxAttempts,
defaultBackoff,
) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/helpers.go |
|
ifaceName := strings.TrimSpace(string(body))
if ifaceName == "" { | <mask> http.Error(w, msg, http.StatusBadRequest)
<mask> return
<mask> }
<mask>
<mask> interfaceName := strings.TrimSpace(string(body))
<mask> if interfaceName == "" {
<mask> msg := "empty interface name specified"
<mask> log.Error(msg)
<mask> http.Error(w, msg, http.StatusBadRequest)
<mask> return
<mask> }
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove // netIface is the interface for network interface methods.
type netIface interface {
Addrs() ([]net.Addr, error)
}
// ifaceIPAddrs returns the interface's IP addresses.
func ifaceIPAddrs(iface netIface, ipv ipVersion) (ips []net.IP, err error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, err
}
for _, a := range addrs {
var ip net.IP
switch a := a.(type) {
case *net.IPAddr:
ip = a.IP
case *net.IPNet:
ip = a.IP
default:
continue
}
// Assume that net.(*Interface).Addrs can only return valid IPv4
// and IPv6 addresses. Thus, if it isn't an IPv4 address, it
// must be an IPv6 one.
switch ipv {
case ipVersion4:
if ip4 := ip.To4(); ip4 != nil {
ips = append(ips, ip4)
}
case ipVersion6:
if ip6 := ip.To4(); ip6 == nil {
ips = append(ips, ip)
}
default:
return nil, fmt.Errorf("invalid ip version %d", ipv)
}
}
return ips, nil
}
</s> add </s> remove func isTimeout(err error) bool {
operr, ok := err.(*net.OpError)
if !ok {
return false
}
return operr.Timeout()
}
</s> add </s> remove dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion4, defaultMaxAttempts, defaultBackoff)
</s> add dnsIPAddrs, err := aghnet.IfaceDNSIPAddrs(
iface,
aghnet.IPVersion4,
defaultMaxAttempts,
defaultBackoff,
) </s> remove dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion6, defaultMaxAttempts, defaultBackoff)
</s> add dnsIPAddrs, err := aghnet.IfaceDNSIPAddrs(
iface,
aghnet.IPVersion6,
defaultMaxAttempts,
defaultBackoff,
) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/http.go |
OtherServer: dhcpSearchOtherResult{
Found: "no",
}, | <mask> }
<mask>
<mask> result := dhcpSearchResult{
<mask> V4: dhcpSearchV4Result{
<mask> OtherServer: dhcpSearchOtherResult{},
<mask> StaticIP: dhcpStaticIPStatus{
<mask> Static: "yes",
<mask> },
<mask> },
<mask> V6: dhcpSearchV6Result{
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove OtherServer: dhcpSearchOtherResult{},
</s> add OtherServer: dhcpSearchOtherResult{
Found: "no",
}, </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { </s> remove interfaceName := strings.TrimSpace(string(body))
if interfaceName == "" {
</s> add ifaceName := strings.TrimSpace(string(body))
if ifaceName == "" { </s> remove if found4 {
result.V4.OtherServer.Found = "yes"
} else if err4 != nil {
</s> add found4, found6, err4, err6 := aghnet.CheckOtherDHCP(ifaceName)
if err4 != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/http.go |
OtherServer: dhcpSearchOtherResult{
Found: "no",
}, | <mask> Static: "yes",
<mask> },
<mask> },
<mask> V6: dhcpSearchV6Result{
<mask> OtherServer: dhcpSearchOtherResult{},
<mask> },
<mask> }
<mask>
<mask> found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
<mask>
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove OtherServer: dhcpSearchOtherResult{},
</s> add OtherServer: dhcpSearchOtherResult{
Found: "no",
}, </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { </s> remove if found4 {
result.V4.OtherServer.Found = "yes"
} else if err4 != nil {
</s> add found4, found6, err4, err6 := aghnet.CheckOtherDHCP(ifaceName)
if err4 != nil { </s> remove
found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName)
if found6 {
result.V6.OtherServer.Found = "yes"
} else if err6 != nil {
</s> add if err6 != nil { </s> remove result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
</s> add // TODO(e.burkov): The returned IP should only be of version 4.
result.V4.StaticIP.IP = aghnet.GetSubnet(ifaceName).String() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/http.go |
if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { | <mask> OtherServer: dhcpSearchOtherResult{},
<mask> },
<mask> }
<mask>
<mask> found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
<mask>
<mask> isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
<mask> if err != nil {
<mask> result.V4.StaticIP.Static = "error"
<mask> result.V4.StaticIP.Error = err.Error()
<mask> } else if !isStaticIP {
<mask> result.V4.StaticIP.Static = "no"
<mask> result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove result.V4.StaticIP.Error = err.Error()
</s> add result.V4.StaticIP.Error = serr.Error() </s> remove result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
</s> add // TODO(e.burkov): The returned IP should only be of version 4.
result.V4.StaticIP.IP = aghnet.GetSubnet(ifaceName).String() </s> remove if found4 {
result.V4.OtherServer.Found = "yes"
} else if err4 != nil {
</s> add found4, found6, err4, err6 := aghnet.CheckOtherDHCP(ifaceName)
if err4 != nil { </s> remove OtherServer: dhcpSearchOtherResult{},
</s> add OtherServer: dhcpSearchOtherResult{
Found: "no",
}, </s> remove
found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName)
if found6 {
result.V6.OtherServer.Found = "yes"
} else if err6 != nil {
</s> add if err6 != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/http.go |
result.V4.StaticIP.Error = serr.Error() | <mask>
<mask> isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
<mask> if err != nil {
<mask> result.V4.StaticIP.Static = "error"
<mask> result.V4.StaticIP.Error = err.Error()
<mask> } else if !isStaticIP {
<mask> result.V4.StaticIP.Static = "no"
<mask> result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
<mask> }
<mask>
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { </s> remove result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
</s> add // TODO(e.burkov): The returned IP should only be of version 4.
result.V4.StaticIP.IP = aghnet.GetSubnet(ifaceName).String() </s> remove if found4 {
result.V4.OtherServer.Found = "yes"
} else if err4 != nil {
</s> add found4, found6, err4, err6 := aghnet.CheckOtherDHCP(ifaceName)
if err4 != nil { </s> remove
found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName)
if found6 {
result.V6.OtherServer.Found = "yes"
} else if err6 != nil {
</s> add if err6 != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/http.go |
// TODO(e.burkov): The returned IP should only be of version 4.
result.V4.StaticIP.IP = aghnet.GetSubnet(ifaceName).String() | <mask> result.V4.StaticIP.Static = "error"
<mask> result.V4.StaticIP.Error = err.Error()
<mask> } else if !isStaticIP {
<mask> result.V4.StaticIP.Static = "no"
<mask> result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
<mask> }
<mask>
<mask> if found4 {
<mask> result.V4.OtherServer.Found = "yes"
<mask> } else if err4 != nil {
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove result.V4.StaticIP.Error = err.Error()
</s> add result.V4.StaticIP.Error = serr.Error() </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { </s> remove if found4 {
result.V4.OtherServer.Found = "yes"
} else if err4 != nil {
</s> add found4, found6, err4, err6 := aghnet.CheckOtherDHCP(ifaceName)
if err4 != nil { </s> remove
found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName)
if found6 {
result.V6.OtherServer.Found = "yes"
} else if err6 != nil {
</s> add if err6 != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/http.go |
found4, found6, err4, err6 := aghnet.CheckOtherDHCP(ifaceName)
if err4 != nil { | <mask> result.V4.StaticIP.Static = "no"
<mask> result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
<mask> }
<mask>
<mask> if found4 {
<mask> result.V4.OtherServer.Found = "yes"
<mask> } else if err4 != nil {
<mask> result.V4.OtherServer.Found = "error"
<mask> result.V4.OtherServer.Error = err4.Error()
<mask> }
<mask>
<mask> found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName)
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove
found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName)
if found6 {
result.V6.OtherServer.Found = "yes"
} else if err6 != nil {
</s> add if err6 != nil { </s> remove result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
</s> add // TODO(e.burkov): The returned IP should only be of version 4.
result.V4.StaticIP.IP = aghnet.GetSubnet(ifaceName).String() </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { </s> remove result.V4.StaticIP.Error = err.Error()
</s> add result.V4.StaticIP.Error = serr.Error() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/http.go |
} else if found4 {
result.V4.OtherServer.Found = "yes" | <mask> result.V4.OtherServer.Found = "error"
<mask> result.V4.OtherServer.Error = err4.Error()
<mask> }
<mask> if err6 != nil {
<mask> result.V6.OtherServer.Found = "error"
<mask> result.V6.OtherServer.Error = err6.Error()
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove
found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName)
if found6 {
result.V6.OtherServer.Found = "yes"
} else if err6 != nil {
</s> add if err6 != nil { </s> remove if found4 {
result.V4.OtherServer.Found = "yes"
} else if err4 != nil {
</s> add found4, found6, err4, err6 := aghnet.CheckOtherDHCP(ifaceName)
if err4 != nil { </s> remove result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
</s> add // TODO(e.burkov): The returned IP should only be of version 4.
result.V4.StaticIP.IP = aghnet.GetSubnet(ifaceName).String() </s> remove result.V4.StaticIP.Error = err.Error()
</s> add result.V4.StaticIP.Error = serr.Error() | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/http.go |
if err6 != nil { | <mask> } else if err4 != nil {
<mask> result.V4.OtherServer.Found = "error"
<mask> result.V4.OtherServer.Error = err4.Error()
<mask> }
<mask>
<mask> found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName)
<mask>
<mask> if found6 {
<mask> result.V6.OtherServer.Found = "yes"
<mask> } else if err6 != nil {
<mask> result.V6.OtherServer.Found = "error"
<mask> result.V6.OtherServer.Error = err6.Error()
<mask> }
<mask>
<mask> w.Header().Set("Content-Type", "application/json")
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove if found4 {
result.V4.OtherServer.Found = "yes"
} else if err4 != nil {
</s> add found4, found6, err4, err6 := aghnet.CheckOtherDHCP(ifaceName)
if err4 != nil { </s> remove result.V4.StaticIP.IP = aghnet.GetSubnet(interfaceName).String()
</s> add // TODO(e.burkov): The returned IP should only be of version 4.
result.V4.StaticIP.IP = aghnet.GetSubnet(ifaceName).String() </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/http.go |
} else if found6 {
result.V6.OtherServer.Found = "yes" | <mask> if err6 != nil {
<mask> result.V6.OtherServer.Found = "error"
<mask> result.V6.OtherServer.Error = err6.Error()
<mask> }
<mask>
<mask> w.Header().Set("Content-Type", "application/json")
<mask> err = json.NewEncoder(w).Encode(result)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusInternalServerError, "Failed to marshal DHCP found json: %s", err)
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove
found6, err6 := CheckIfOtherDHCPServersPresentV6(interfaceName)
if found6 {
result.V6.OtherServer.Found = "yes"
} else if err6 != nil {
</s> add if err6 != nil { </s> remove if found4 {
result.V4.OtherServer.Found = "yes"
} else if err4 != nil {
</s> add found4, found6, err4, err6 := aghnet.CheckOtherDHCP(ifaceName)
if err4 != nil { </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { </s> remove result.V4.StaticIP.Error = err.Error()
</s> add result.V4.StaticIP.Error = serr.Error() | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/http.go |
dnsIPAddrs, err := aghnet.IfaceDNSIPAddrs(
iface,
aghnet.IPVersion4,
defaultMaxAttempts,
defaultBackoff,
) | <mask> }
<mask>
<mask> log.Debug("dhcpv4: starting...")
<mask>
<mask> dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion4, defaultMaxAttempts, defaultBackoff)
<mask> if err != nil {
<mask> return fmt.Errorf("interface %s: %w", ifaceName, err)
<mask> }
<mask>
<mask> if len(dnsIPAddrs) == 0 {
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion6, defaultMaxAttempts, defaultBackoff)
</s> add dnsIPAddrs, err := aghnet.IfaceDNSIPAddrs(
iface,
aghnet.IPVersion6,
defaultMaxAttempts,
defaultBackoff,
) </s> remove
bcastIP := netutil.CloneIP(routerIP)
for i, b := range subnetMask {
bcastIP[i] |= ^b
}
s.conf.broadcastIP = bcastIP
</s> add s.conf.broadcastIP = aghnet.BroadcastFromIPNet(s.conf.subnet) </s> remove func isTimeout(err error) bool {
operr, ok := err.(*net.OpError)
if !ok {
return false
}
return operr.Timeout()
}
</s> add </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/v4.go |
s.conf.broadcastIP = aghnet.BroadcastFromIPNet(s.conf.subnet) | <mask> s.conf.subnet = &net.IPNet{
<mask> IP: routerIP,
<mask> Mask: subnetMask,
<mask> }
<mask>
<mask> bcastIP := netutil.CloneIP(routerIP)
<mask> for i, b := range subnetMask {
<mask> bcastIP[i] |= ^b
<mask> }
<mask> s.conf.broadcastIP = bcastIP
<mask>
<mask> s.conf.ipRange, err = newIPRange(conf.RangeStart, conf.RangeEnd)
<mask> if err != nil {
<mask> return s, fmt.Errorf("dhcpv4: %w", err)
<mask> }
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove // netIface is the interface for network interface methods.
type netIface interface {
Addrs() ([]net.Addr, error)
}
// ifaceIPAddrs returns the interface's IP addresses.
func ifaceIPAddrs(iface netIface, ipv ipVersion) (ips []net.IP, err error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, err
}
for _, a := range addrs {
var ip net.IP
switch a := a.(type) {
case *net.IPAddr:
ip = a.IP
case *net.IPNet:
ip = a.IP
default:
continue
}
// Assume that net.(*Interface).Addrs can only return valid IPv4
// and IPv6 addresses. Thus, if it isn't an IPv4 address, it
// must be an IPv6 one.
switch ipv {
case ipVersion4:
if ip4 := ip.To4(); ip4 != nil {
ips = append(ips, ip4)
}
case ipVersion6:
if ip6 := ip.To4(); ip6 == nil {
ips = append(ips, ip)
}
default:
return nil, fmt.Errorf("invalid ip version %d", ipv)
}
}
return ips, nil
}
</s> add </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { </s> remove dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion4, defaultMaxAttempts, defaultBackoff)
</s> add dnsIPAddrs, err := aghnet.IfaceDNSIPAddrs(
iface,
aghnet.IPVersion4,
defaultMaxAttempts,
defaultBackoff,
) </s> remove dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion6, defaultMaxAttempts, defaultBackoff)
</s> add dnsIPAddrs, err := aghnet.IfaceDNSIPAddrs(
iface,
aghnet.IPVersion6,
defaultMaxAttempts,
defaultBackoff,
) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/v4.go |
<mask> package dhcpd
<mask>
<mask> import (
<mask> "fmt"
<mask> "net"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/golibs/log"
<mask> )
<mask>
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove
"github.com/AdguardTeam/golibs/log"
)
// ipVersion is a documentational alias for int. Use it when the integer means
// IP version.
type ipVersion = int
// IP version constants.
const (
ipVersion4 ipVersion = 4
ipVersion6 ipVersion = 6
</s> add </s> remove //go:build !(linux || darwin || freebsd)
// +build !linux,!darwin,!freebsd
</s> add //go:build !(linux || darwin || freebsd || openbsd)
// +build !linux,!darwin,!freebsd,!openbsd | [
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/v46.go |
|
<mask> import (
<mask> "fmt"
<mask> "net"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/golibs/log"
<mask> )
<mask>
<mask> // ipVersion is a documentational alias for int. Use it when the integer means
<mask> // IP version.
<mask> type ipVersion = int
<mask>
<mask> // IP version constants.
<mask> const (
<mask> ipVersion4 ipVersion = 4
<mask> ipVersion6 ipVersion = 6
<mask> )
<mask>
<mask> // netIface is the interface for network interface methods.
<mask> type netIface interface {
<mask> Addrs() ([]net.Addr, error)
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove // netIface is the interface for network interface methods.
type netIface interface {
Addrs() ([]net.Addr, error)
}
// ifaceIPAddrs returns the interface's IP addresses.
func ifaceIPAddrs(iface netIface, ipv ipVersion) (ips []net.IP, err error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, err
}
for _, a := range addrs {
var ip net.IP
switch a := a.(type) {
case *net.IPAddr:
ip = a.IP
case *net.IPNet:
ip = a.IP
default:
continue
}
// Assume that net.(*Interface).Addrs can only return valid IPv4
// and IPv6 addresses. Thus, if it isn't an IPv4 address, it
// must be an IPv6 one.
switch ipv {
case ipVersion4:
if ip4 := ip.To4(); ip4 != nil {
ips = append(ips, ip4)
}
case ipVersion6:
if ip6 := ip.To4(); ip6 == nil {
ips = append(ips, ip)
}
default:
return nil, fmt.Errorf("invalid ip version %d", ipv)
}
}
return ips, nil
}
</s> add </s> remove defaultDiscoverTime = time.Second * 3
</s> add </s> remove // getNetworkSetupHardwareReports parses the output of the `networksetup -listallhardwareports` command
// it returns a map where the key is the interface name, and the value is the "hardware port"
// returns nil if it fails to parse the output
</s> add // getNetworkSetupHardwareReports parses the output of the `networksetup
// -listallhardwareports` command it returns a map where the key is the
// interface name, and the value is the "hardware port" returns nil if it fails
// to parse the output
//
// TODO(e.burkov): There should be more proper approach than parsing the
// command output. For example, see
// https://developer.apple.com/documentation/systemconfiguration. </s> remove
// ifaceDNSIPAddrs returns IP addresses of the interface suitable to send to
// clients as DNS addresses. If err is nil, addrs contains either no addresses
// or at least two.
//
// It makes up to maxAttempts attempts to get the addresses if there are none,
// each time using the provided backoff. Sometimes an interface needs a few
// seconds to really ititialize.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2304.
func ifaceDNSIPAddrs(
iface netIface,
ipv ipVersion,
maxAttempts int,
backoff time.Duration,
) (addrs []net.IP, err error) {
var n int
for n = 1; n <= maxAttempts; n++ {
addrs, err = ifaceIPAddrs(iface, ipv)
if err != nil {
return nil, fmt.Errorf("getting ip addrs: %w", err)
}
if len(addrs) > 0 {
break
}
log.Debug("dhcpv%d: attempt %d: no ip addresses", ipv, n)
time.Sleep(backoff)
}
switch len(addrs) {
case 0:
// Don't return errors in case the users want to try and enable
// the DHCP server later.
t := time.Duration(n) * backoff
log.Error("dhcpv%d: no ip for iface after %d attempts and %s", ipv, n, t)
return nil, nil
case 1:
// Some Android devices use 8.8.8.8 if there is not a secondary
// DNS server. Fix that by setting the secondary DNS address to
// the same address.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/1708.
log.Debug("dhcpv%d: setting secondary dns ip to itself", ipv)
addrs = append(addrs, addrs[0])
default:
// Go on.
}
log.Debug("dhcpv%d: got addresses %s after %d attempts", ipv, addrs, n)
return addrs, nil
}
</s> add </s> remove "fmt"
"net"
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/v46.go |
|
<mask> ipVersion4 ipVersion = 4
<mask> ipVersion6 ipVersion = 6
<mask> )
<mask>
<mask> // netIface is the interface for network interface methods.
<mask> type netIface interface {
<mask> Addrs() ([]net.Addr, error)
<mask> }
<mask>
<mask> // ifaceIPAddrs returns the interface's IP addresses.
<mask> func ifaceIPAddrs(iface netIface, ipv ipVersion) (ips []net.IP, err error) {
<mask> addrs, err := iface.Addrs()
<mask> if err != nil {
<mask> return nil, err
<mask> }
<mask>
<mask> for _, a := range addrs {
<mask> var ip net.IP
<mask> switch a := a.(type) {
<mask> case *net.IPAddr:
<mask> ip = a.IP
<mask> case *net.IPNet:
<mask> ip = a.IP
<mask> default:
<mask> continue
<mask> }
<mask>
<mask> // Assume that net.(*Interface).Addrs can only return valid IPv4
<mask> // and IPv6 addresses. Thus, if it isn't an IPv4 address, it
<mask> // must be an IPv6 one.
<mask> switch ipv {
<mask> case ipVersion4:
<mask> if ip4 := ip.To4(); ip4 != nil {
<mask> ips = append(ips, ip4)
<mask> }
<mask> case ipVersion6:
<mask> if ip6 := ip.To4(); ip6 == nil {
<mask> ips = append(ips, ip)
<mask> }
<mask> default:
<mask> return nil, fmt.Errorf("invalid ip version %d", ipv)
<mask> }
<mask> }
<mask>
<mask> return ips, nil
<mask> }
<mask>
<mask> // Currently used defaults for ifaceDNSAddrs.
<mask> const (
<mask> defaultMaxAttempts int = 10
<mask>
<mask> defaultBackoff time.Duration = 500 * time.Millisecond
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove
// ifaceDNSIPAddrs returns IP addresses of the interface suitable to send to
// clients as DNS addresses. If err is nil, addrs contains either no addresses
// or at least two.
//
// It makes up to maxAttempts attempts to get the addresses if there are none,
// each time using the provided backoff. Sometimes an interface needs a few
// seconds to really ititialize.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2304.
func ifaceDNSIPAddrs(
iface netIface,
ipv ipVersion,
maxAttempts int,
backoff time.Duration,
) (addrs []net.IP, err error) {
var n int
for n = 1; n <= maxAttempts; n++ {
addrs, err = ifaceIPAddrs(iface, ipv)
if err != nil {
return nil, fmt.Errorf("getting ip addrs: %w", err)
}
if len(addrs) > 0 {
break
}
log.Debug("dhcpv%d: attempt %d: no ip addresses", ipv, n)
time.Sleep(backoff)
}
switch len(addrs) {
case 0:
// Don't return errors in case the users want to try and enable
// the DHCP server later.
t := time.Duration(n) * backoff
log.Error("dhcpv%d: no ip for iface after %d attempts and %s", ipv, n, t)
return nil, nil
case 1:
// Some Android devices use 8.8.8.8 if there is not a secondary
// DNS server. Fix that by setting the secondary DNS address to
// the same address.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/1708.
log.Debug("dhcpv%d: setting secondary dns ip to itself", ipv)
addrs = append(addrs, addrs[0])
default:
// Go on.
}
log.Debug("dhcpv%d: got addresses %s after %d attempts", ipv, addrs, n)
return addrs, nil
}
</s> add </s> remove
"github.com/AdguardTeam/golibs/log"
)
// ipVersion is a documentational alias for int. Use it when the integer means
// IP version.
type ipVersion = int
// IP version constants.
const (
ipVersion4 ipVersion = 4
ipVersion6 ipVersion = 6
</s> add </s> remove func isTimeout(err error) bool {
operr, ok := err.(*net.OpError)
if !ok {
return false
}
return operr.Timeout()
}
</s> add </s> remove // getNetworkSetupHardwareReports parses the output of the `networksetup -listallhardwareports` command
// it returns a map where the key is the interface name, and the value is the "hardware port"
// returns nil if it fails to parse the output
</s> add // getNetworkSetupHardwareReports parses the output of the `networksetup
// -listallhardwareports` command it returns a map where the key is the
// interface name, and the value is the "hardware port" returns nil if it fails
// to parse the output
//
// TODO(e.burkov): There should be more proper approach than parsing the
// command output. For example, see
// https://developer.apple.com/documentation/systemconfiguration. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/v46.go |
|
<mask> defaultMaxAttempts int = 10
<mask>
<mask> defaultBackoff time.Duration = 500 * time.Millisecond
<mask> )
<mask>
<mask> // ifaceDNSIPAddrs returns IP addresses of the interface suitable to send to
<mask> // clients as DNS addresses. If err is nil, addrs contains either no addresses
<mask> // or at least two.
<mask> //
<mask> // It makes up to maxAttempts attempts to get the addresses if there are none,
<mask> // each time using the provided backoff. Sometimes an interface needs a few
<mask> // seconds to really ititialize.
<mask> //
<mask> // See https://github.com/AdguardTeam/AdGuardHome/issues/2304.
<mask> func ifaceDNSIPAddrs(
<mask> iface netIface,
<mask> ipv ipVersion,
<mask> maxAttempts int,
<mask> backoff time.Duration,
<mask> ) (addrs []net.IP, err error) {
<mask> var n int
<mask> for n = 1; n <= maxAttempts; n++ {
<mask> addrs, err = ifaceIPAddrs(iface, ipv)
<mask> if err != nil {
<mask> return nil, fmt.Errorf("getting ip addrs: %w", err)
<mask> }
<mask>
<mask> if len(addrs) > 0 {
<mask> break
<mask> }
<mask>
<mask> log.Debug("dhcpv%d: attempt %d: no ip addresses", ipv, n)
<mask>
<mask> time.Sleep(backoff)
<mask> }
<mask>
<mask> switch len(addrs) {
<mask> case 0:
<mask> // Don't return errors in case the users want to try and enable
<mask> // the DHCP server later.
<mask> t := time.Duration(n) * backoff
<mask> log.Error("dhcpv%d: no ip for iface after %d attempts and %s", ipv, n, t)
<mask>
<mask> return nil, nil
<mask> case 1:
<mask> // Some Android devices use 8.8.8.8 if there is not a secondary
<mask> // DNS server. Fix that by setting the secondary DNS address to
<mask> // the same address.
<mask> //
<mask> // See https://github.com/AdguardTeam/AdGuardHome/issues/1708.
<mask> log.Debug("dhcpv%d: setting secondary dns ip to itself", ipv)
<mask> addrs = append(addrs, addrs[0])
<mask> default:
<mask> // Go on.
<mask> }
<mask>
<mask> log.Debug("dhcpv%d: got addresses %s after %d attempts", ipv, addrs, n)
<mask>
<mask> return addrs, nil
<mask> }
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove // netIface is the interface for network interface methods.
type netIface interface {
Addrs() ([]net.Addr, error)
}
// ifaceIPAddrs returns the interface's IP addresses.
func ifaceIPAddrs(iface netIface, ipv ipVersion) (ips []net.IP, err error) {
addrs, err := iface.Addrs()
if err != nil {
return nil, err
}
for _, a := range addrs {
var ip net.IP
switch a := a.(type) {
case *net.IPAddr:
ip = a.IP
case *net.IPNet:
ip = a.IP
default:
continue
}
// Assume that net.(*Interface).Addrs can only return valid IPv4
// and IPv6 addresses. Thus, if it isn't an IPv4 address, it
// must be an IPv6 one.
switch ipv {
case ipVersion4:
if ip4 := ip.To4(); ip4 != nil {
ips = append(ips, ip4)
}
case ipVersion6:
if ip6 := ip.To4(); ip6 == nil {
ips = append(ips, ip)
}
default:
return nil, fmt.Errorf("invalid ip version %d", ipv)
}
}
return ips, nil
}
</s> add </s> remove // getNetworkSetupHardwareReports parses the output of the `networksetup -listallhardwareports` command
// it returns a map where the key is the interface name, and the value is the "hardware port"
// returns nil if it fails to parse the output
</s> add // getNetworkSetupHardwareReports parses the output of the `networksetup
// -listallhardwareports` command it returns a map where the key is the
// interface name, and the value is the "hardware port" returns nil if it fails
// to parse the output
//
// TODO(e.burkov): There should be more proper approach than parsing the
// command output. For example, see
// https://developer.apple.com/documentation/systemconfiguration. </s> remove defaultDiscoverTime = time.Second * 3
</s> add </s> remove
"github.com/AdguardTeam/golibs/log"
)
// ipVersion is a documentational alias for int. Use it when the integer means
// IP version.
type ipVersion = int
// IP version constants.
const (
ipVersion4 ipVersion = 4
ipVersion6 ipVersion = 6
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/v46.go |
|
"github.com/AdguardTeam/AdGuardHome/internal/aghnet" | <mask> "time"
<mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> "github.com/insomniacslk/dhcp/dhcpv6"
<mask> "github.com/insomniacslk/dhcp/dhcpv6/server6"
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove "fmt"
"net"
</s> add </s> remove
"github.com/AdguardTeam/golibs/log"
)
// ipVersion is a documentational alias for int. Use it when the integer means
// IP version.
type ipVersion = int
// IP version constants.
const (
ipVersion4 ipVersion = 4
ipVersion6 ipVersion = 6
</s> add </s> remove defaultDiscoverTime = time.Second * 3
</s> add </s> remove dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion6, defaultMaxAttempts, defaultBackoff)
</s> add dnsIPAddrs, err := aghnet.IfaceDNSIPAddrs(
iface,
aghnet.IPVersion6,
defaultMaxAttempts,
defaultBackoff,
) </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/v6.go |
dnsIPAddrs, err := aghnet.IfaceDNSIPAddrs(
iface,
aghnet.IPVersion6,
defaultMaxAttempts,
defaultBackoff,
) | <mask> }
<mask>
<mask> log.Debug("dhcpv6: starting...")
<mask>
<mask> dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion6, defaultMaxAttempts, defaultBackoff)
<mask> if err != nil {
<mask> return fmt.Errorf("interface %s: %w", ifaceName, err)
<mask> }
<mask>
<mask> if len(dnsIPAddrs) == 0 {
</s> Pull request: 3225 bsd dhcp
Merge in DNS/adguard-home from 3225-bsd-dhcp to master
Closes #3225.
Closes #3417.
Squashed commit of the following:
commit e7ea691824c7ebc8cafd8c9e206679346cbc8592
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 17:02:02 2021 +0300
all: imp code, docs
commit 5b598fc18a9b69a0256569f4c691bb6a2193dfbd
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 16:28:12 2021 +0300
all: mv logic, imp code, docs, log changes
commit e3e1577a668fe3e5c61d075c390e4bd7268181ba
Author: Eugene Burkov <[email protected]>
Date: Thu Aug 12 14:15:10 2021 +0300
dhcpd: imp checkother
commit 3cc8b058195c30a7ef0b7741ee8463270d9e47ff
Author: Eugene Burkov <[email protected]>
Date: Wed Aug 11 13:20:18 2021 +0300
all: imp bsd support </s> remove dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion4, defaultMaxAttempts, defaultBackoff)
</s> add dnsIPAddrs, err := aghnet.IfaceDNSIPAddrs(
iface,
aghnet.IPVersion4,
defaultMaxAttempts,
defaultBackoff,
) </s> remove
bcastIP := netutil.CloneIP(routerIP)
for i, b := range subnetMask {
bcastIP[i] |= ^b
}
s.conf.broadcastIP = bcastIP
</s> add s.conf.broadcastIP = aghnet.BroadcastFromIPNet(s.conf.subnet) </s> remove func isTimeout(err error) bool {
operr, ok := err.(*net.OpError)
if !ok {
return false
}
return operr.Timeout()
}
</s> add </s> remove found4, err4 := CheckIfOtherDHCPServersPresentV4(interfaceName)
isStaticIP, err := aghnet.IfaceHasStaticIP(interfaceName)
if err != nil {
</s> add if isStaticIP, serr := aghnet.IfaceHasStaticIP(ifaceName); serr != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/506b459842d47e1536548fb10441aef1e534bf14 | internal/dhcpd/v6.go |
"dhcp_reset_leases": "Reset all leases",
"dhcp_reset_leases_confirm": "Are you sure you want to reset all leases?",
"dhcp_reset_leases_success": "DHCP leases successfully reset", | <mask> "dhcp_new_static_lease": "New static lease",
<mask> "dhcp_static_leases_not_found": "No DHCP static leases found",
<mask> "dhcp_add_static_lease": "Add static lease",
<mask> "dhcp_reset": "Are you sure you want to reset the DHCP configuration?",
<mask> "country": "Country",
<mask> "city": "City",
<mask> "delete_confirm": "Are you sure you want to delete \"{{key}}\"?",
<mask> "form_enter_hostname": "Enter hostname",
<mask> "error_details": "Error details",
</s> Pull request: client: add reset leases btn
Updates #1691.
Squashed commit of the following:
commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <[email protected]>
Date: Thu Jun 17 14:28:23 2021 +0300
Merge branch 'master' into 1691-dhcp-reset-form
commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <[email protected]>
Date: Thu Jun 17 13:14:59 2021 +0300
client: handle dhcp leases reset
commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <[email protected]>
Date: Wed Jun 16 17:12:10 2021 +0300
client: add reset leases btn </s> remove </div>
<div className="col-12">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
</s> add <div className="btn-list mt-2">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
<button
type="button"
className="btn btn-secondary btn-standard mt-3"
onClick={handleReset}
>
<Trans>dhcp_reset_leases</Trans>
</button>
</div> </s> remove type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear}
</s> add type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear} </s> remove type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig}
</s> add type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5104b79cf6c183c7e40e9a9f9fb9de6d8b68ac13 | client/src/__locales/en.json |
export const resetDhcpLeasesRequest = createAction('RESET_DHCP_LEASES_REQUEST');
export const resetDhcpLeasesSuccess = createAction('RESET_DHCP_LEASES_SUCCESS');
export const resetDhcpLeasesFailure = createAction('RESET_DHCP_LEASES_FAILURE');
export const resetDhcpLeases = () => async (dispatch) => {
dispatch(resetDhcpLeasesRequest());
try {
const status = await apiClient.resetDhcpLeases();
dispatch(resetDhcpLeasesSuccess(status));
dispatch(addSuccessToast('dhcp_reset_leases_success'));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(resetDhcpLeasesFailure());
}
};
| <mask> dispatch(resetDhcpFailure());
<mask> }
<mask> };
<mask>
<mask> export const toggleLeaseModal = createAction('TOGGLE_LEASE_MODAL');
<mask>
<mask> export const addStaticLeaseRequest = createAction('ADD_STATIC_LEASE_REQUEST');
<mask> export const addStaticLeaseFailure = createAction('ADD_STATIC_LEASE_FAILURE');
</s> Pull request: client: add reset leases btn
Updates #1691.
Squashed commit of the following:
commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <[email protected]>
Date: Thu Jun 17 14:28:23 2021 +0300
Merge branch 'master' into 1691-dhcp-reset-form
commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <[email protected]>
Date: Thu Jun 17 13:14:59 2021 +0300
client: handle dhcp leases reset
commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <[email protected]>
Date: Wed Jun 16 17:12:10 2021 +0300
client: add reset leases btn </s> remove </div>
<div className="col-12">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
</s> add <div className="btn-list mt-2">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
<button
type="button"
className="btn btn-secondary btn-standard mt-3"
onClick={handleReset}
>
<Trans>dhcp_reset_leases</Trans>
</button>
</div> </s> remove type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear}
</s> add type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear} </s> remove type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig}
</s> add type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig} | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5104b79cf6c183c7e40e9a9f9fb9de6d8b68ac13 | client/src/actions/index.js |
DHCP_LEASES_RESET = { path: 'dhcp/reset_leases', method: 'POST' };
| <mask>
<mask> DHCP_RESET = { path: 'dhcp/reset', method: 'POST' };
<mask>
<mask> getDhcpStatus() {
<mask> const { path, method } = this.DHCP_STATUS;
<mask> return this.makeRequest(path, method);
<mask> }
<mask>
</s> Pull request: client: add reset leases btn
Updates #1691.
Squashed commit of the following:
commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <[email protected]>
Date: Thu Jun 17 14:28:23 2021 +0300
Merge branch 'master' into 1691-dhcp-reset-form
commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <[email protected]>
Date: Thu Jun 17 13:14:59 2021 +0300
client: handle dhcp leases reset
commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <[email protected]>
Date: Wed Jun 16 17:12:10 2021 +0300
client: add reset leases btn </s> remove type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig}
</s> add type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig} </s> remove </div>
<div className="col-12">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
</s> add <div className="btn-list mt-2">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
<button
type="button"
className="btn btn-secondary btn-standard mt-3"
onClick={handleReset}
>
<Trans>dhcp_reset_leases</Trans>
</button>
</div> </s> remove type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear}
</s> add type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5104b79cf6c183c7e40e9a9f9fb9de6d8b68ac13 | client/src/api/Api.js |
resetDhcpLeases() {
const { path, method } = this.DHCP_LEASES_RESET;
return this.makeRequest(path, method);
}
| <mask> }
<mask>
<mask> // Installation
<mask> INSTALL_GET_ADDRESSES = { path: 'install/get_addresses', method: 'GET' };
<mask>
<mask> INSTALL_CONFIGURE = { path: 'install/configure', method: 'POST' };
<mask>
<mask> INSTALL_CHECK_CONFIG = { path: 'install/check_config', method: 'POST' };
</s> Pull request: client: add reset leases btn
Updates #1691.
Squashed commit of the following:
commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <[email protected]>
Date: Thu Jun 17 14:28:23 2021 +0300
Merge branch 'master' into 1691-dhcp-reset-form
commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <[email protected]>
Date: Thu Jun 17 13:14:59 2021 +0300
client: handle dhcp leases reset
commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <[email protected]>
Date: Wed Jun 16 17:12:10 2021 +0300
client: add reset leases btn </s> remove </div>
<div className="col-12">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
</s> add <div className="btn-list mt-2">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
<button
type="button"
className="btn btn-secondary btn-standard mt-3"
onClick={handleReset}
>
<Trans>dhcp_reset_leases</Trans>
</button>
</div> </s> remove type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear}
</s> add type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear} </s> remove type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig}
</s> add type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig} | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5104b79cf6c183c7e40e9a9f9fb9de6d8b68ac13 | client/src/api/Api.js |
resetDhcpLeases, | <mask> getDhcpStatus,
<mask> resetDhcp,
<mask> setDhcpConfig,
<mask> toggleDhcp,
<mask> toggleLeaseModal,
<mask> } from '../../../actions';
<mask> import FormDHCPv4 from './FormDHCPv4';
</s> Pull request: client: add reset leases btn
Updates #1691.
Squashed commit of the following:
commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <[email protected]>
Date: Thu Jun 17 14:28:23 2021 +0300
Merge branch 'master' into 1691-dhcp-reset-form
commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <[email protected]>
Date: Thu Jun 17 13:14:59 2021 +0300
client: handle dhcp leases reset
commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <[email protected]>
Date: Wed Jun 16 17:12:10 2021 +0300
client: add reset leases btn </s> remove </div>
<div className="col-12">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
</s> add <div className="btn-list mt-2">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
<button
type="button"
className="btn btn-secondary btn-standard mt-3"
onClick={handleReset}
>
<Trans>dhcp_reset_leases</Trans>
</button>
</div> </s> remove type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear}
</s> add type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear} </s> remove type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig}
</s> add type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5104b79cf6c183c7e40e9a9f9fb9de6d8b68ac13 | client/src/components/Settings/Dhcp/index.js |
const handleReset = () => {
if (window.confirm(t('dhcp_reset_leases_confirm'))) {
dispatch(resetDhcpLeases());
}
};
| <mask> };
<mask>
<mask> const enteredSomeV4Value = Object.values(v4)
<mask> .some(Boolean);
<mask> const enteredSomeV6Value = Object.values(v6)
<mask> .some(Boolean);
</s> Pull request: client: add reset leases btn
Updates #1691.
Squashed commit of the following:
commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <[email protected]>
Date: Thu Jun 17 14:28:23 2021 +0300
Merge branch 'master' into 1691-dhcp-reset-form
commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <[email protected]>
Date: Thu Jun 17 13:14:59 2021 +0300
client: handle dhcp leases reset
commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <[email protected]>
Date: Wed Jun 16 17:12:10 2021 +0300
client: add reset leases btn </s> remove </div>
<div className="col-12">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
</s> add <div className="btn-list mt-2">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
<button
type="button"
className="btn btn-secondary btn-standard mt-3"
onClick={handleReset}
>
<Trans>dhcp_reset_leases</Trans>
</button>
</div> </s> remove type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear}
</s> add type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear} </s> remove type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig}
</s> add type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig} | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5104b79cf6c183c7e40e9a9f9fb9de6d8b68ac13 | client/src/components/Settings/Dhcp/index.js |
type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig} | <mask> return <>
<mask> <PageTitle title={t('dhcp_settings')} subtitle={t('dhcp_description')} containerClass="page-title--dhcp">
<mask> {toggleDhcpButton}
<mask> <button
<mask> type="button"
<mask> className={statusButtonClass}
<mask> onClick={onClick}
<mask> disabled={enabled || !interface_name || processingConfig}
<mask> >
<mask> <Trans>check_dhcp_servers</Trans>
<mask> </button>
<mask> <button
<mask> type="button"
</s> Pull request: client: add reset leases btn
Updates #1691.
Squashed commit of the following:
commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <[email protected]>
Date: Thu Jun 17 14:28:23 2021 +0300
Merge branch 'master' into 1691-dhcp-reset-form
commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <[email protected]>
Date: Thu Jun 17 13:14:59 2021 +0300
client: handle dhcp leases reset
commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <[email protected]>
Date: Wed Jun 16 17:12:10 2021 +0300
client: add reset leases btn </s> remove type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear}
</s> add type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear} </s> remove </div>
<div className="col-12">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
</s> add <div className="btn-list mt-2">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
<button
type="button"
className="btn btn-secondary btn-standard mt-3"
onClick={handleReset}
>
<Trans>dhcp_reset_leases</Trans>
</button>
</div> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5104b79cf6c183c7e40e9a9f9fb9de6d8b68ac13 | client/src/components/Settings/Dhcp/index.js |
type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear} | <mask> >
<mask> <Trans>check_dhcp_servers</Trans>
<mask> </button>
<mask> <button
<mask> type="button"
<mask> className='btn btn-sm btn-outline-secondary'
<mask> disabled={!enteredSomeValue || processingConfig}
<mask> onClick={clear}
<mask> >
<mask> <Trans>reset_settings</Trans>
<mask> </button>
<mask> </PageTitle>
<mask> {!processing && !processingInterfaces
</s> Pull request: client: add reset leases btn
Updates #1691.
Squashed commit of the following:
commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <[email protected]>
Date: Thu Jun 17 14:28:23 2021 +0300
Merge branch 'master' into 1691-dhcp-reset-form
commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <[email protected]>
Date: Thu Jun 17 13:14:59 2021 +0300
client: handle dhcp leases reset
commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <[email protected]>
Date: Wed Jun 16 17:12:10 2021 +0300
client: add reset leases btn </s> remove type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig}
</s> add type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig} </s> remove </div>
<div className="col-12">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
</s> add <div className="btn-list mt-2">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
<button
type="button"
className="btn btn-secondary btn-standard mt-3"
onClick={handleReset}
>
<Trans>dhcp_reset_leases</Trans>
</button>
</div> | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5104b79cf6c183c7e40e9a9f9fb9de6d8b68ac13 | client/src/components/Settings/Dhcp/index.js |
<div className="btn-list mt-2">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
<button
type="button"
className="btn btn-secondary btn-standard mt-3"
onClick={handleReset}
>
<Trans>dhcp_reset_leases</Trans>
</button>
</div> | <mask> processingAdding={processingAdding}
<mask> processingDeleting={processingDeleting}
<mask> cidr={cidr}
<mask> />
<mask> </div>
<mask> <div className="col-12">
<mask> <button
<mask> type="button"
<mask> className="btn btn-success btn-standard mt-3"
<mask> onClick={toggleModal}
<mask> disabled={disabledLeasesButton}
<mask> >
<mask> <Trans>dhcp_add_static_lease</Trans>
<mask> </button>
<mask> </div>
<mask> </div>
<mask> </Card>
<mask> </>}
<mask> </>;
</s> Pull request: client: add reset leases btn
Updates #1691.
Squashed commit of the following:
commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <[email protected]>
Date: Thu Jun 17 14:28:23 2021 +0300
Merge branch 'master' into 1691-dhcp-reset-form
commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <[email protected]>
Date: Thu Jun 17 13:14:59 2021 +0300
client: handle dhcp leases reset
commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <[email protected]>
Date: Wed Jun 16 17:12:10 2021 +0300
client: add reset leases btn </s> remove type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear}
</s> add type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear} </s> remove type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig}
</s> add type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5104b79cf6c183c7e40e9a9f9fb9de6d8b68ac13 | client/src/components/Settings/Dhcp/index.js |
[actions.resetDhcpLeasesSuccess]: (state) => ({
...state,
leases: [],
staticLeases: [],
}), | <mask> v6: {},
<mask> interface_name: '',
<mask> }),
<mask>
<mask> [actions.toggleLeaseModal]: (state) => {
<mask> const newState = {
<mask> ...state,
<mask> isModalOpen: !state.isModalOpen,
<mask> };
</s> Pull request: client: add reset leases btn
Updates #1691.
Squashed commit of the following:
commit 2c48fb956aba28eae47071c9f7f4d579dde12955
Merge: 38f5191b 7547d3a4
Author: Ainar Garipov <[email protected]>
Date: Thu Jun 17 14:28:23 2021 +0300
Merge branch 'master' into 1691-dhcp-reset-form
commit 38f5191bcd62eb53e4663fccdfc2a60247881931
Author: Ildar Kamalov <[email protected]>
Date: Thu Jun 17 13:14:59 2021 +0300
client: handle dhcp leases reset
commit a97df17028ca640fd32b4d9762aa54fb381df7e5
Author: Ainar Garipov <[email protected]>
Date: Wed Jun 16 17:12:10 2021 +0300
client: add reset leases btn </s> remove </div>
<div className="col-12">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
</s> add <div className="btn-list mt-2">
<button
type="button"
className="btn btn-success btn-standard mt-3"
onClick={toggleModal}
disabled={disabledLeasesButton}
>
<Trans>dhcp_add_static_lease</Trans>
</button>
<button
type="button"
className="btn btn-secondary btn-standard mt-3"
onClick={handleReset}
>
<Trans>dhcp_reset_leases</Trans>
</button>
</div> </s> remove type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear}
</s> add type="button"
className='btn btn-sm btn-outline-secondary'
disabled={!enteredSomeValue || processingConfig}
onClick={clear} </s> remove type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig}
</s> add type="button"
className={statusButtonClass}
onClick={onClick}
disabled={enabled || !interface_name || processingConfig} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5104b79cf6c183c7e40e9a9f9fb9de6d8b68ac13 | client/src/reducers/dhcp.js |
github.com/digineo/go-ipset/v2 v2.2.1 | <mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/ameshkov/dnscrypt/v2 v2.0.1
<mask> github.com/fsnotify/fsnotify v1.4.9
<mask> github.com/go-ping/ping v0.0.0-20201115131931-3300c582a663
<mask> github.com/gobuffalo/envy v1.9.0 // indirect
<mask> github.com/gobuffalo/packr v1.30.1
<mask> github.com/gobuffalo/packr/v2 v2.8.1 // indirect
<mask> github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove s.ipset.init(s.conf.IPSETList)
</s> add err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
} </s> remove err := s.prepareUpstreamSettings()
</s> add err = s.prepareUpstreamSettings() | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.mod |
github.com/mdlayher/netlink v1.1.2-0.20201013204415-ded538f7f4be | <mask> github.com/kardianos/service v1.2.0
<mask> github.com/karrick/godirwalk v1.16.1 // indirect
<mask> github.com/lucas-clemente/quic-go v0.19.3
<mask> github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7
<mask> github.com/mdlayher/raw v0.0.0-20191009151244-50f2db8cc065
<mask> github.com/miekg/dns v1.1.35
<mask> github.com/rogpeppe/go-internal v1.6.2 // indirect
<mask> github.com/satori/go.uuid v1.2.0
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.mod |
github.com/ti-mo/netfilter v0.4.0 | <mask> github.com/sirupsen/logrus v1.7.0 // indirect
<mask> github.com/spf13/cobra v1.1.1 // indirect
<mask> github.com/stretchr/testify v1.6.1
<mask> github.com/u-root/u-root v7.0.0+incompatible
<mask> go.etcd.io/bbolt v1.3.5
<mask> golang.org/x/crypto v0.0.0-20201217014255-9d1352758620
<mask> golang.org/x/net v0.0.0-20201216054612-986b41b23924
<mask> golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 // indirect
<mask> golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.mod |
github.com/digineo/go-ipset/v2 v2.2.1 h1:k6skY+0fMqeUjjeWO/m5OuWPSZUAn7AucHMnQ1MX77g=
github.com/digineo/go-ipset/v2 v2.2.1/go.mod h1:wBsNzJlZlABHUITkesrggFnZQtgW5wkqw1uo8Qxe0VU= | <mask> github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
<mask> github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
<mask> github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
<mask> github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
<mask> github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
<mask> github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
<mask> github.com/fanliao/go-promise v0.0.0-20141029170127-1890db352a72/go.mod h1:PjfxuH4FZdUyfMdtBio2lsRr1AKEaVPwelzuHuh8Lqc=
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove err := s.prepareUpstreamSettings()
</s> add err = s.prepareUpstreamSettings() </s> remove s.ipset.init(s.conf.IPSETList)
</s> add err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.sum |
github.com/jsimonetti/rtnetlink v0.0.0-20201110080708-d2c240429e6c h1:7cpGGTQO6+OuYQWkueqeXuErSjs1NZtpALpv1x7Mq4g= | <mask> github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4/go.mod h1:WGuG/smIU4J/54PblvSbh+xvCZmpJnFgr3ds6Z55XMQ=
<mask> github.com/jsimonetti/rtnetlink v0.0.0-20201009170750-9c6f07d100c1/go.mod h1:hqoO/u39cqLeBLebZ8fWdE96O7FxrAsRYhnVOdgHxok=
<mask> github.com/jsimonetti/rtnetlink v0.0.0-20201110080708-d2c240429e6c/go.mod h1:huN4d1phzjhlOsNIjFsw2SVRbwIHj3fJDMEU2SDPTmg=
<mask> github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
<mask> github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
<mask> github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
<mask> github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
<mask> github.com/kardianos/service v1.2.0 h1:bGuZ/epo3vrt8IPC7mnKQolqFeYJb7Cs8Rk4PSOBB/g=
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove err := s.prepareUpstreamSettings()
</s> add err = s.prepareUpstreamSettings() </s> remove s.ipset.init(s.conf.IPSETList)
</s> add err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
} | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.sum |
github.com/mdlayher/netlink v0.0.0-20190313131330-258ea9dff42c/go.mod h1:eQB3mZE4aiYnlUsyGGCOpPETfdQq4Jhsgf1fk3cwQaA= | <mask> github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7 h1:lez6TS6aAau+8wXUP3G9I3TGlmPFEq2CTxBaRqY6AGE=
<mask> github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7/go.mod h1:U6ZQobyTjI/tJyq2HG+i/dfSoFUt8/aZCM+GKtmFk/Y=
<mask> github.com/mdlayher/netlink v0.0.0-20190409211403-11939a169225/go.mod h1:eQB3mZE4aiYnlUsyGGCOpPETfdQq4Jhsgf1fk3cwQaA=
<mask> github.com/mdlayher/netlink v1.0.0/go.mod h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M=
<mask> github.com/mdlayher/netlink v1.1.0/go.mod h1:H4WCitaheIsdF9yOYu8CFmCgQthAPIWZmcKp9uZHgmY=
<mask> github.com/mdlayher/netlink v1.1.1 h1:VqG+Voq9V4uZ+04vjIrcSCWDpf91B1xxbP4QBUmUJE8=
<mask> github.com/mdlayher/netlink v1.1.1/go.mod h1:WTYpFb/WTvlRJAyKhZL5/uy69TDDpHHu2VZmb2XgV7o=
<mask> github.com/mdlayher/netlink v1.1.2-0.20201013204415-ded538f7f4be h1:7JeFwhE5SIdgKRd0qnqjOYJxY8AML8x/j+/qvFZ8R+c=
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.sum |
github.com/mdlayher/netlink v1.1.1 h1:VqG+Voq9V4uZ+04vjIrcSCWDpf91B1xxbP4QBUmUJE8= | <mask> github.com/mdlayher/netlink v0.0.0-20190409211403-11939a169225/go.mod h1:eQB3mZE4aiYnlUsyGGCOpPETfdQq4Jhsgf1fk3cwQaA=
<mask> github.com/mdlayher/netlink v1.0.0/go.mod h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M=
<mask> github.com/mdlayher/netlink v1.1.0/go.mod h1:H4WCitaheIsdF9yOYu8CFmCgQthAPIWZmcKp9uZHgmY=
<mask> github.com/mdlayher/netlink v1.1.1/go.mod h1:WTYpFb/WTvlRJAyKhZL5/uy69TDDpHHu2VZmb2XgV7o=
<mask> github.com/mdlayher/netlink v1.1.2-0.20201013204415-ded538f7f4be h1:7JeFwhE5SIdgKRd0qnqjOYJxY8AML8x/j+/qvFZ8R+c=
<mask> github.com/mdlayher/netlink v1.1.2-0.20201013204415-ded538f7f4be/go.mod h1:WTYpFb/WTvlRJAyKhZL5/uy69TDDpHHu2VZmb2XgV7o=
<mask> github.com/mdlayher/raw v0.0.0-20190606142536-fef19f00fc18/go.mod h1:7EpbotpCmVZcu+KCX4g9WaRNuu11uyhiW7+Le1dKawg=
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove err := s.prepareUpstreamSettings()
</s> add err = s.prepareUpstreamSettings() | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.sum |
github.com/mdlayher/netlink v1.1.2-0.20201013204415-ded538f7f4be h1:7JeFwhE5SIdgKRd0qnqjOYJxY8AML8x/j+/qvFZ8R+c=
github.com/mdlayher/netlink v1.1.2-0.20201013204415-ded538f7f4be/go.mod h1:WTYpFb/WTvlRJAyKhZL5/uy69TDDpHHu2VZmb2XgV7o= | <mask> github.com/mdlayher/netlink v1.1.0/go.mod h1:H4WCitaheIsdF9yOYu8CFmCgQthAPIWZmcKp9uZHgmY=
<mask> github.com/mdlayher/netlink v1.1.1 h1:VqG+Voq9V4uZ+04vjIrcSCWDpf91B1xxbP4QBUmUJE8=
<mask> github.com/mdlayher/netlink v1.1.1/go.mod h1:WTYpFb/WTvlRJAyKhZL5/uy69TDDpHHu2VZmb2XgV7o=
<mask> github.com/mdlayher/raw v0.0.0-20190606142536-fef19f00fc18/go.mod h1:7EpbotpCmVZcu+KCX4g9WaRNuu11uyhiW7+Le1dKawg=
<mask> github.com/mdlayher/raw v0.0.0-20191009151244-50f2db8cc065 h1:aFkJ6lx4FPip+S+Uw4aTegFMct9shDvP+79PsSxpm3w=
<mask> github.com/mdlayher/raw v0.0.0-20191009151244-50f2db8cc065/go.mod h1:7EpbotpCmVZcu+KCX4g9WaRNuu11uyhiW7+Le1dKawg=
<mask> github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.sum |
github.com/ti-mo/netfilter v0.2.0/go.mod h1:8GbBGsY/8fxtyIdfwy29JiluNcPK4K7wIT+x42ipqUU=
github.com/ti-mo/netfilter v0.4.0 h1:rTN1nBYULDmMfDeBHZpKuNKX/bWEXQUhe02a/10orzg=
github.com/ti-mo/netfilter v0.4.0/go.mod h1:V54q75mUx8CNA2JnFl+wv9iZ5+JP9nCcRlaFS5OZSRM= | <mask> github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
<mask> github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
<mask> github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
<mask> github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
<mask> github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
<mask> github.com/u-root/u-root v7.0.0+incompatible h1:u+KSS04pSxJGI5E7WE4Bs9+Zd75QjFv+REkjy/aoAc8=
<mask> github.com/u-root/u-root v7.0.0+incompatible/go.mod h1:RYkpo8pTHrNjW08opNd/U6p/RJE7K0D8fXO0d47+3YY=
<mask> github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
<mask> github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
<mask> github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove err := s.prepareUpstreamSettings()
</s> add err = s.prepareUpstreamSettings() </s> remove s.ipset.init(s.conf.IPSETList)
</s> add err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
} | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.sum |
golang.org/x/net v0.0.0-20201016165138-7b1cca2348c0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= | <mask> golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
<mask> golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
<mask> golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
<mask> golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
<mask> golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 h1:lwlPPsmjDKK0J6eG6xDWd5XPehI0R024zxjDnw3esPA=
<mask> golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove err := s.prepareUpstreamSettings()
</s> add err = s.prepareUpstreamSettings() </s> remove s.ipset.init(s.conf.IPSETList)
</s> add err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
} | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.sum |
golang.org/x/sys v0.0.0-20190322080309-f49334f85ddc/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | <mask> golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
<mask> golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20190411185658-b44545bcd369/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20190418153312-f0ce4c0180be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove err := s.prepareUpstreamSettings()
</s> add err = s.prepareUpstreamSettings() </s> remove s.ipset.init(s.conf.IPSETList)
</s> add err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.sum |
golang.org/x/sys v0.0.0-20201017003518-b09fb700fbb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | <mask> golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20201112073958-5cba982894dd h1:5CtCZbICpIOFdgO940moixOPjc0178IU44m4EjOO5IY=
<mask> golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
<mask> golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20201214095126-aec9a390925b h1:tv7/y4pd+sR8bcNb2D6o7BNU6zjWm0VjQLac+w7fNNM=
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove err := s.prepareUpstreamSettings()
</s> add err = s.prepareUpstreamSettings() </s> remove s.ipset.init(s.conf.IPSETList)
</s> add err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | go.sum |
err := s.ipset.Close()
if err != nil {
log.Error("closing ipset: %s", err)
}
| <mask> s.stats = nil
<mask> s.queryLog = nil
<mask> s.dnsProxy = nil
<mask> s.Unlock()
<mask> }
<mask>
<mask> // WriteDiskConfig - write configuration
<mask> func (s *Server) WriteDiskConfig(c *FilteringConfig) {
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove err := s.prepareUpstreamSettings()
</s> add err = s.prepareUpstreamSettings() </s> remove s.ipset.init(s.conf.IPSETList)
</s> add err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
} | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | internal/dnsforward/dnsforward.go |
err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
} | <mask> s.initDefaultSettings()
<mask>
<mask> // Initialize IPSET configuration
<mask> // --
<mask> s.ipset.init(s.conf.IPSETList)
<mask>
<mask> // Prepare DNS servers settings
<mask> // --
<mask> err := s.prepareUpstreamSettings()
<mask> if err != nil {
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove err := s.prepareUpstreamSettings()
</s> add err = s.prepareUpstreamSettings() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | internal/dnsforward/dnsforward.go |
err = s.prepareUpstreamSettings() | <mask> s.ipset.init(s.conf.IPSETList)
<mask>
<mask> // Prepare DNS servers settings
<mask> // --
<mask> err := s.prepareUpstreamSettings()
<mask> if err != nil {
<mask> return err
<mask> }
<mask>
<mask> // Create DNS proxy configuration
</s> Pull request: 2179 ipset subdomains
Merge in DNS/adguard-home from 2179-ipset-subdomains to master
Closes #2179.
Squashed commit of the following:
commit de17caac4c2ea2bc7931f162c6dfa7822a71554f
Author: Ainar Garipov <[email protected]>
Date: Fri Jan 29 18:34:46 2021 +0300
dnsforward: imp code, docs
commit e5ab957560bcfba80feac4b72f9b22535ecd4c7d
Author: Ainar Garipov <[email protected]>
Date: Tue Jan 26 20:43:31 2021 +0300
dnsforward: imp code
commit 2b84d27b752832885e4896d0e75de2576e2b965b
Author: David Sheets <[email protected]>
Date: Tue Oct 6 16:34:06 2020 +0100
dnsforward: support subdomain matching in ipset
This is a squash of all commits in #2179. </s> remove s.ipset.init(s.conf.IPSETList)
</s> add err := s.ipset.init(s.conf.IPSETList)
if err != nil {
return err
} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/510573a904e0fd184d6a2ccedf9ebe7b7ed81465 | internal/dnsforward/dnsforward.go |
// ipRange is an inclusive range of IP addresses. A nil range is a range that
// doesn't contain any IP addresses. | <mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr"
<mask> )
<mask>
<mask> // ipRange is an inclusive range of IP addresses.
<mask> //
<mask> // It is safe for concurrent use.
<mask> //
<mask> // TODO(a.garipov): Perhaps create an optimised version with uint32 for
<mask> // IPv4 ranges? Or use one of uint128 packages?
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove // containsInt returns true if r contains ipInt.
</s> add // containsInt returns true if r contains ipInt. For internal use only. </s> remove HWAddr: make([]byte, 6),
</s> add HWAddr: make([]byte, len(mac)), | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/iprange.go |
if r == nil {
return false
}
| <mask>
<mask> // contains returns true if r contains ip.
<mask> func (r *ipRange) contains(ip net.IP) (ok bool) {
<mask> ipInt := (&big.Int{}).SetBytes(ip.To16())
<mask>
<mask> return r.containsInt(ipInt)
<mask> }
<mask>
<mask> // containsInt returns true if r contains ipInt. For internal use only.
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove // containsInt returns true if r contains ipInt.
</s> add // containsInt returns true if r contains ipInt. For internal use only. </s> remove s.blacklistLease(lease)
</s> add s.blocklistLease(lease) | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/iprange.go |
// containsInt returns true if r contains ipInt. For internal use only. | <mask>
<mask> return r.containsInt(ipInt)
<mask> }
<mask>
<mask> // containsInt returns true if r contains ipInt.
<mask> func (r *ipRange) containsInt(ipInt *big.Int) (ok bool) {
<mask> return ipInt.Cmp(r.start) >= 0 && ipInt.Cmp(r.end) <= 0
<mask> }
<mask>
<mask> // ipPredicate is a function that is called on every IP address in
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove // ipRange is an inclusive range of IP addresses.
</s> add // ipRange is an inclusive range of IP addresses. A nil range is a range that
// doesn't contain any IP addresses. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/iprange.go |
if r == nil {
return nil
}
| <mask> // 16-byte form.
<mask> func (r *ipRange) find(p ipPredicate) (ip net.IP) {
<mask> ip = make(net.IP, net.IPv6len)
<mask> _1 := big.NewInt(1)
<mask> for i := (&big.Int{}).Set(r.start); i.Cmp(r.end) <= 0; i.Add(i, _1) {
<mask> i.FillBytes(ip)
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove // containsInt returns true if r contains ipInt.
</s> add // containsInt returns true if r contains ipInt. For internal use only. </s> remove func (s *v4Server) blacklistLease(lease *Lease) {
hw := make(net.HardwareAddr, 6)
lease.HWAddr = hw
lease.Hostname = ""
lease.Expiry = time.Now().Add(s.conf.leaseTime)
</s> add func (s *v4Server) blocklistLease(l *Lease) {
l.HWAddr = make(net.HardwareAddr, defaultHwAddrLen)
l.Hostname = ""
l.Expiry = time.Now().Add(s.conf.leaseTime) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/iprange.go |
if r == nil {
return 0, false
}
| <mask>
<mask> // offset returns the offset of ip from the beginning of r. It returns 0 and
<mask> // false if ip is not in r.
<mask> func (r *ipRange) offset(ip net.IP) (offset uint, ok bool) {
<mask> ip = ip.To16()
<mask> ipInt := (&big.Int{}).SetBytes(ip)
<mask> if !r.containsInt(ipInt) {
<mask> return 0, false
<mask> }
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove // containsInt returns true if r contains ipInt.
</s> add // containsInt returns true if r contains ipInt. For internal use only. | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/iprange.go |
// defaultHwAddrLen is the default length of a hardware (MAC) address.
const defaultHwAddrLen = 6
| <mask> }
<mask>
<mask> // Add the specified IP to the black list for a time period
<mask> func (s *v4Server) blocklistLease(l *Lease) {
<mask> l.HWAddr = make(net.HardwareAddr, defaultHwAddrLen)
<mask> l.Hostname = ""
<mask> l.Expiry = time.Now().Add(s.conf.leaseTime)
<mask> }
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove func (s *v4Server) blacklistLease(lease *Lease) {
hw := make(net.HardwareAddr, 6)
lease.HWAddr = hw
lease.Hostname = ""
lease.Expiry = time.Now().Add(s.conf.leaseTime)
</s> add func (s *v4Server) blocklistLease(l *Lease) {
l.HWAddr = make(net.HardwareAddr, defaultHwAddrLen)
l.Hostname = ""
l.Expiry = time.Now().Add(s.conf.leaseTime) </s> remove HWAddr: make([]byte, 6),
</s> add HWAddr: make([]byte, len(mac)), </s> remove s.leasedOffsets.Set(uint(offset))
</s> add s.leasedOffsets.Set(offset) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/v4.go |
func (s *v4Server) blocklistLease(l *Lease) {
l.HWAddr = make(net.HardwareAddr, defaultHwAddrLen)
l.Hostname = ""
l.Expiry = time.Now().Add(s.conf.leaseTime) | <mask> return nil
<mask> }
<mask>
<mask> // Add the specified IP to the black list for a time period
<mask> func (s *v4Server) blacklistLease(lease *Lease) {
<mask> hw := make(net.HardwareAddr, 6)
<mask> lease.HWAddr = hw
<mask> lease.Hostname = ""
<mask> lease.Expiry = time.Now().Add(s.conf.leaseTime)
<mask> }
<mask>
<mask> // rmLeaseByIndex removes a lease by its index in the leases slice.
<mask> func (s *v4Server) rmLeaseByIndex(i int) {
<mask> l := s.leases[i]
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove HWAddr: make([]byte, 6),
</s> add HWAddr: make([]byte, len(mac)), </s> remove s.leasedOffsets.Set(uint(offset))
</s> add s.leasedOffsets.Set(offset) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/v4.go |
n := len(s.leases)
if i >= n {
// TODO(a.garipov): Better error handling.
log.Debug("dhcpv4: can't remove lease at index %d: no such lease", i)
return
}
| <mask>
<mask> // rmLeaseByIndex removes a lease by its index in the leases slice.
<mask> func (s *v4Server) rmLeaseByIndex(i int) {
<mask> l := s.leases[i]
<mask> s.leases = append(s.leases[:i], s.leases[i+1:]...)
<mask>
<mask> n = len(s.leases)
<mask> if n > 0 {
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove func (s *v4Server) blacklistLease(lease *Lease) {
hw := make(net.HardwareAddr, 6)
lease.HWAddr = hw
lease.Hostname = ""
lease.Expiry = time.Now().Add(s.conf.leaseTime)
</s> add func (s *v4Server) blocklistLease(l *Lease) {
l.HWAddr = make(net.HardwareAddr, defaultHwAddrLen)
l.Hostname = ""
l.Expiry = time.Now().Add(s.conf.leaseTime) </s> remove HWAddr: make([]byte, 6),
</s> add HWAddr: make([]byte, len(mac)), | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/v4.go |
n = len(s.leases)
if n > 0 {
s.leases = s.leases[:n-1]
}
| <mask> l := s.leases[i]
<mask> s.leases = append(s.leases[:i], s.leases[i+1:]...)
<mask>
<mask> r := s.conf.ipRange
<mask> offset, ok := r.offset(l.IP)
<mask> if ok {
<mask> s.leasedOffsets.Clear(offset)
<mask> }
<mask>
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove func (s *v4Server) blacklistLease(lease *Lease) {
hw := make(net.HardwareAddr, 6)
lease.HWAddr = hw
lease.Hostname = ""
lease.Expiry = time.Now().Add(s.conf.leaseTime)
</s> add func (s *v4Server) blocklistLease(l *Lease) {
l.HWAddr = make(net.HardwareAddr, defaultHwAddrLen)
l.Hostname = ""
l.Expiry = time.Now().Add(s.conf.leaseTime) | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/v4.go |
s.leasedOffsets.Set(offset) | <mask> return
<mask> }
<mask>
<mask> s.leases = append(s.leases, l)
<mask> s.leasedOffsets.Set(uint(offset))
<mask>
<mask> log.Debug("dhcpv4: added lease %s (%s)", l.IP, l.HWAddr)
<mask> }
<mask>
<mask> // Remove a lease with the same properties
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove func (s *v4Server) blacklistLease(lease *Lease) {
hw := make(net.HardwareAddr, 6)
lease.HWAddr = hw
lease.Hostname = ""
lease.Expiry = time.Now().Add(s.conf.leaseTime)
</s> add func (s *v4Server) blocklistLease(l *Lease) {
l.HWAddr = make(net.HardwareAddr, defaultHwAddrLen)
l.Hostname = ""
l.Expiry = time.Now().Add(s.conf.leaseTime) </s> remove s.blacklistLease(lease)
</s> add s.blocklistLease(lease) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/v4.go |
return !s.leasedOffsets.Test(offset) | <mask> // Shouldn't happen.
<mask> return false
<mask> }
<mask>
<mask> return !s.leasedOffsets.Test(uint(offset))
<mask> })
<mask>
<mask> return ip.To4()
<mask> }
<mask>
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove s.leasedOffsets.Set(uint(offset))
</s> add s.leasedOffsets.Set(offset) </s> remove // containsInt returns true if r contains ipInt.
</s> add // containsInt returns true if r contains ipInt. For internal use only. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/v4.go |
HWAddr: make([]byte, len(mac)), | <mask> // reserveLease reserves a lease for a client by its MAC-address. It returns
<mask> // nil if it couldn't allocate a new lease.
<mask> func (s *v4Server) reserveLease(mac net.HardwareAddr) (l *Lease) {
<mask> l = &Lease{
<mask> HWAddr: make([]byte, 6),
<mask> }
<mask>
<mask> copy(l.HWAddr, mac)
<mask>
<mask> l.IP = s.nextIP()
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove func (s *v4Server) blacklistLease(lease *Lease) {
hw := make(net.HardwareAddr, 6)
lease.HWAddr = hw
lease.Hostname = ""
lease.Expiry = time.Now().Add(s.conf.leaseTime)
</s> add func (s *v4Server) blocklistLease(l *Lease) {
l.HWAddr = make(net.HardwareAddr, defaultHwAddrLen)
l.Hostname = ""
l.Expiry = time.Now().Add(s.conf.leaseTime) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/v4.go |
s.blocklistLease(lease) | <mask>
<mask> toStore = true
<mask>
<mask> if !s.addrAvailable(lease.IP) {
<mask> s.blacklistLease(lease)
<mask> lease = nil
<mask> continue
<mask> }
<mask> break
<mask> }
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove func (s *v4Server) blacklistLease(lease *Lease) {
hw := make(net.HardwareAddr, 6)
lease.HWAddr = hw
lease.Hostname = ""
lease.Expiry = time.Now().Add(s.conf.leaseTime)
</s> add func (s *v4Server) blocklistLease(l *Lease) {
l.HWAddr = make(net.HardwareAddr, defaultHwAddrLen)
l.Hostname = ""
l.Expiry = time.Now().Add(s.conf.leaseTime) </s> remove HWAddr: make([]byte, 6),
</s> add HWAddr: make([]byte, len(mac)), | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/v4.go |
// TODO(a.garipov): Don't use a disabled server in other places or just
// use an interface. | <mask> s.conf = conf
<mask>
<mask> if !conf.Enabled {
<mask> return s, nil
<mask> }
<mask>
<mask> s.conf.routerIP, err = tryTo4(s.conf.GatewayIP)
<mask> if err != nil {
</s> Pull request: dhcpd: fix static leases
Updates #2541.
Updates #2834.
Squashed commit of the following:
commit d1580182db3b5866213e017405aa2cf8a6ee2f24
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:51:43 2021 +0300
all: doc changes; imp naming
commit f036b50a60ba030aa6866944fc7a7b8776ce01d4
Author: Ainar Garipov <[email protected]>
Date: Wed Mar 17 14:09:19 2021 +0300
dhcpd: fix static leases </s> remove s.blacklistLease(lease)
</s> add s.blocklistLease(lease) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/5243399d9d72121a7df9ca6d542043661cbbefaa | internal/dhcpd/v4.go |
func (*dhcpConn) wrapErrs(action string, udpConnErr, rawConnErr error) (err error) { | <mask> }
<mask>
<mask> // wrapErrs is a helper to wrap the errors from two independent underlying
<mask> // connections.
<mask> func (c *dhcpConn) wrapErrs(action string, udpConnErr, rawConnErr error) (err error) {
<mask> switch {
<mask> case udpConnErr != nil && rawConnErr != nil:
<mask> return errors.List(fmt.Sprintf("%s both connections", action), udpConnErr, rawConnErr)
<mask> case udpConnErr != nil:
<mask> return fmt.Errorf("%s udp connection: %w", action, udpConnErr)
</s> Pull request: 4337 increase msg size
Merge in DNS/adguard-home from 4337-dhcp-msg-len to master
Updates #4337.
Squashed commit of the following:
commit 55e53c1fadd4ccb2a8b94117afff82e9a5d2734b
Merge: f37070ea da1ae338
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 14:14:21 2022 +0300
Merge branch 'master' into 4337-dhcp-msg-len
commit f37070ea0f3a7ff8efcbbafd36001f78d9b082b5
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 13:15:25 2022 +0300
dhcpd: imp ether pkt building
commit fa43a0bcc24d4ca5e9193899dbba8495f3de5df9
Author: Eugene Burkov <[email protected]>
Date: Tue Sep 6 18:55:07 2022 +0300
dhcpd: incr msg size </s> remove return 0, fmt.Errorf("peer is of unexpected type %T", addr)
</s> add return 0, fmt.Errorf("addr has an unexpected type %T", addr) </s> remove dhcpLayer := gopacket.NewPacket(payload, layers.LayerTypeDHCPv4, gopacket.DecodeOptions{
NoCopy: true,
}).Layer(layers.LayerTypeDHCPv4)
// Check if the decoding succeeded and the resulting layer doesn't
// contain any errors. It should guarantee panic-safe converting of the
// layer into gopacket.SerializableLayer.
if dhcpLayer == nil || dhcpLayer.LayerType() != layers.LayerTypeDHCPv4 {
return nil, errInvalidPktDHCP
}
</s> add </s> remove // errInvalidPktDHCP is returned when the provided payload is not a valid DHCP
// packet.
const errInvalidPktDHCP errors.Error = "packet is not a valid dhcp packet"
// buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames. The
// payload is expected to be an encoded DHCP packet.
</s> add // buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames.
// Validation of the payload is a caller's responsibility. </s> remove log.Debug("dhcpv4: sending to %s: %s", peer, resp.Summary())
if _, err := conn.WriteTo(resp.ToBytes(), peer); err != nil {
</s> add pktData := resp.ToBytes()
pktLen := len(pktData)
if pktLen < minDHCPMsgSize {
// Expand the packet to match the minimum DHCP message length. Although
// the dhpcv4 package deals with the BOOTP's lower packet length
// constraint, it seems some clients expecting the length being at least
// 576 bytes as per RFC 2131 (and an obsolete RFC 1533).
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/4337.
pktData = append(pktData, make([]byte, minDHCPMsgSize-pktLen)...)
}
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/53209bc42c2401e017e5b727fb74272953a8cd0e | internal/dhcpd/conn_unix.go |
return 0, fmt.Errorf("addr has an unexpected type %T", addr) | <mask> // Unicast the message to the client's IP address. Use the UDP
<mask> // connection.
<mask> return c.udpConn.WriteTo(p, addr)
<mask> default:
<mask> return 0, fmt.Errorf("peer is of unexpected type %T", addr)
<mask> }
<mask> }
<mask>
<mask> // ReadFrom implements net.PacketConn for *dhcpConn.
<mask> func (c *dhcpConn) ReadFrom(p []byte) (n int, addr net.Addr, err error) {
</s> Pull request: 4337 increase msg size
Merge in DNS/adguard-home from 4337-dhcp-msg-len to master
Updates #4337.
Squashed commit of the following:
commit 55e53c1fadd4ccb2a8b94117afff82e9a5d2734b
Merge: f37070ea da1ae338
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 14:14:21 2022 +0300
Merge branch 'master' into 4337-dhcp-msg-len
commit f37070ea0f3a7ff8efcbbafd36001f78d9b082b5
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 13:15:25 2022 +0300
dhcpd: imp ether pkt building
commit fa43a0bcc24d4ca5e9193899dbba8495f3de5df9
Author: Eugene Burkov <[email protected]>
Date: Tue Sep 6 18:55:07 2022 +0300
dhcpd: incr msg size </s> remove dhcpLayer := gopacket.NewPacket(payload, layers.LayerTypeDHCPv4, gopacket.DecodeOptions{
NoCopy: true,
}).Layer(layers.LayerTypeDHCPv4)
// Check if the decoding succeeded and the resulting layer doesn't
// contain any errors. It should guarantee panic-safe converting of the
// layer into gopacket.SerializableLayer.
if dhcpLayer == nil || dhcpLayer.LayerType() != layers.LayerTypeDHCPv4 {
return nil, errInvalidPktDHCP
}
</s> add </s> remove // errInvalidPktDHCP is returned when the provided payload is not a valid DHCP
// packet.
const errInvalidPktDHCP errors.Error = "packet is not a valid dhcp packet"
// buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames. The
// payload is expected to be an encoded DHCP packet.
</s> add // buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames.
// Validation of the payload is a caller's responsibility. </s> remove log.Debug("dhcpv4: sending to %s: %s", peer, resp.Summary())
if _, err := conn.WriteTo(resp.ToBytes(), peer); err != nil {
</s> add pktData := resp.ToBytes()
pktLen := len(pktData)
if pktLen < minDHCPMsgSize {
// Expand the packet to match the minimum DHCP message length. Although
// the dhpcv4 package deals with the BOOTP's lower packet length
// constraint, it seems some clients expecting the length being at least
// 576 bytes as per RFC 2131 (and an obsolete RFC 1533).
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/4337.
pktData = append(pktData, make([]byte, minDHCPMsgSize-pktLen)...)
}
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil { </s> remove func (c *dhcpConn) wrapErrs(action string, udpConnErr, rawConnErr error) (err error) {
</s> add func (*dhcpConn) wrapErrs(action string, udpConnErr, rawConnErr error) (err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/53209bc42c2401e017e5b727fb74272953a8cd0e | internal/dhcpd/conn_unix.go |
// ipv4DefaultTTL is the default Time to Live value in seconds as recommended by
// RFC-1700.
//
// See https://datatracker.ietf.org/doc/html/rfc1700. | <mask> c.rawConn.SetWriteDeadline(t),
<mask> )
<mask> }
<mask>
<mask> // ipv4DefaultTTL is the default Time to Live value as recommended by
<mask> // RFC-1700 (https://datatracker.ietf.org/doc/html/rfc1700) in seconds.
<mask> const ipv4DefaultTTL = 64
<mask>
<mask> // errInvalidPktDHCP is returned when the provided payload is not a valid DHCP
<mask> // packet.
<mask> const errInvalidPktDHCP errors.Error = "packet is not a valid dhcp packet"
</s> Pull request: 4337 increase msg size
Merge in DNS/adguard-home from 4337-dhcp-msg-len to master
Updates #4337.
Squashed commit of the following:
commit 55e53c1fadd4ccb2a8b94117afff82e9a5d2734b
Merge: f37070ea da1ae338
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 14:14:21 2022 +0300
Merge branch 'master' into 4337-dhcp-msg-len
commit f37070ea0f3a7ff8efcbbafd36001f78d9b082b5
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 13:15:25 2022 +0300
dhcpd: imp ether pkt building
commit fa43a0bcc24d4ca5e9193899dbba8495f3de5df9
Author: Eugene Burkov <[email protected]>
Date: Tue Sep 6 18:55:07 2022 +0300
dhcpd: incr msg size </s> remove // errInvalidPktDHCP is returned when the provided payload is not a valid DHCP
// packet.
const errInvalidPktDHCP errors.Error = "packet is not a valid dhcp packet"
// buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames. The
// payload is expected to be an encoded DHCP packet.
</s> add // buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames.
// Validation of the payload is a caller's responsibility. </s> remove dhcpLayer := gopacket.NewPacket(payload, layers.LayerTypeDHCPv4, gopacket.DecodeOptions{
NoCopy: true,
}).Layer(layers.LayerTypeDHCPv4)
// Check if the decoding succeeded and the resulting layer doesn't
// contain any errors. It should guarantee panic-safe converting of the
// layer into gopacket.SerializableLayer.
if dhcpLayer == nil || dhcpLayer.LayerType() != layers.LayerTypeDHCPv4 {
return nil, errInvalidPktDHCP
}
</s> add </s> remove log.Debug("dhcpv4: sending to %s: %s", peer, resp.Summary())
if _, err := conn.WriteTo(resp.ToBytes(), peer); err != nil {
</s> add pktData := resp.ToBytes()
pktLen := len(pktData)
if pktLen < minDHCPMsgSize {
// Expand the packet to match the minimum DHCP message length. Although
// the dhpcv4 package deals with the BOOTP's lower packet length
// constraint, it seems some clients expecting the length being at least
// 576 bytes as per RFC 2131 (and an obsolete RFC 1533).
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/4337.
pktData = append(pktData, make([]byte, minDHCPMsgSize-pktLen)...)
}
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil { </s> remove return 0, fmt.Errorf("peer is of unexpected type %T", addr)
</s> add return 0, fmt.Errorf("addr has an unexpected type %T", addr) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/53209bc42c2401e017e5b727fb74272953a8cd0e | internal/dhcpd/conn_unix.go |
// buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames.
// Validation of the payload is a caller's responsibility. | <mask> // ipv4DefaultTTL is the default Time to Live value as recommended by
<mask> // RFC-1700 (https://datatracker.ietf.org/doc/html/rfc1700) in seconds.
<mask> const ipv4DefaultTTL = 64
<mask>
<mask> // errInvalidPktDHCP is returned when the provided payload is not a valid DHCP
<mask> // packet.
<mask> const errInvalidPktDHCP errors.Error = "packet is not a valid dhcp packet"
<mask>
<mask> // buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames. The
<mask> // payload is expected to be an encoded DHCP packet.
<mask> func (c *dhcpConn) buildEtherPkt(payload []byte, peer *dhcpUnicastAddr) (pkt []byte, err error) {
<mask> dhcpLayer := gopacket.NewPacket(payload, layers.LayerTypeDHCPv4, gopacket.DecodeOptions{
<mask> NoCopy: true,
<mask> }).Layer(layers.LayerTypeDHCPv4)
<mask>
</s> Pull request: 4337 increase msg size
Merge in DNS/adguard-home from 4337-dhcp-msg-len to master
Updates #4337.
Squashed commit of the following:
commit 55e53c1fadd4ccb2a8b94117afff82e9a5d2734b
Merge: f37070ea da1ae338
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 14:14:21 2022 +0300
Merge branch 'master' into 4337-dhcp-msg-len
commit f37070ea0f3a7ff8efcbbafd36001f78d9b082b5
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 13:15:25 2022 +0300
dhcpd: imp ether pkt building
commit fa43a0bcc24d4ca5e9193899dbba8495f3de5df9
Author: Eugene Burkov <[email protected]>
Date: Tue Sep 6 18:55:07 2022 +0300
dhcpd: incr msg size </s> remove // ipv4DefaultTTL is the default Time to Live value as recommended by
// RFC-1700 (https://datatracker.ietf.org/doc/html/rfc1700) in seconds.
</s> add // ipv4DefaultTTL is the default Time to Live value in seconds as recommended by
// RFC-1700.
//
// See https://datatracker.ietf.org/doc/html/rfc1700. </s> remove dhcpLayer := gopacket.NewPacket(payload, layers.LayerTypeDHCPv4, gopacket.DecodeOptions{
NoCopy: true,
}).Layer(layers.LayerTypeDHCPv4)
// Check if the decoding succeeded and the resulting layer doesn't
// contain any errors. It should guarantee panic-safe converting of the
// layer into gopacket.SerializableLayer.
if dhcpLayer == nil || dhcpLayer.LayerType() != layers.LayerTypeDHCPv4 {
return nil, errInvalidPktDHCP
}
</s> add </s> remove return 0, fmt.Errorf("peer is of unexpected type %T", addr)
</s> add return 0, fmt.Errorf("addr has an unexpected type %T", addr) </s> remove log.Debug("dhcpv4: sending to %s: %s", peer, resp.Summary())
if _, err := conn.WriteTo(resp.ToBytes(), peer); err != nil {
</s> add pktData := resp.ToBytes()
pktLen := len(pktData)
if pktLen < minDHCPMsgSize {
// Expand the packet to match the minimum DHCP message length. Although
// the dhpcv4 package deals with the BOOTP's lower packet length
// constraint, it seems some clients expecting the length being at least
// 576 bytes as per RFC 2131 (and an obsolete RFC 1533).
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/4337.
pktData = append(pktData, make([]byte, minDHCPMsgSize-pktLen)...)
}
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/53209bc42c2401e017e5b727fb74272953a8cd0e | internal/dhcpd/conn_unix.go |
<mask>
<mask> // buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames. The
<mask> // payload is expected to be an encoded DHCP packet.
<mask> func (c *dhcpConn) buildEtherPkt(payload []byte, peer *dhcpUnicastAddr) (pkt []byte, err error) {
<mask> dhcpLayer := gopacket.NewPacket(payload, layers.LayerTypeDHCPv4, gopacket.DecodeOptions{
<mask> NoCopy: true,
<mask> }).Layer(layers.LayerTypeDHCPv4)
<mask>
<mask> // Check if the decoding succeeded and the resulting layer doesn't
<mask> // contain any errors. It should guarantee panic-safe converting of the
<mask> // layer into gopacket.SerializableLayer.
<mask> if dhcpLayer == nil || dhcpLayer.LayerType() != layers.LayerTypeDHCPv4 {
<mask> return nil, errInvalidPktDHCP
<mask> }
<mask>
<mask> udpLayer := &layers.UDP{
<mask> SrcPort: dhcpv4.ServerPort,
<mask> DstPort: dhcpv4.ClientPort,
<mask> }
<mask> ipv4Layer := &layers.IPv4{
</s> Pull request: 4337 increase msg size
Merge in DNS/adguard-home from 4337-dhcp-msg-len to master
Updates #4337.
Squashed commit of the following:
commit 55e53c1fadd4ccb2a8b94117afff82e9a5d2734b
Merge: f37070ea da1ae338
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 14:14:21 2022 +0300
Merge branch 'master' into 4337-dhcp-msg-len
commit f37070ea0f3a7ff8efcbbafd36001f78d9b082b5
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 13:15:25 2022 +0300
dhcpd: imp ether pkt building
commit fa43a0bcc24d4ca5e9193899dbba8495f3de5df9
Author: Eugene Burkov <[email protected]>
Date: Tue Sep 6 18:55:07 2022 +0300
dhcpd: incr msg size </s> remove // errInvalidPktDHCP is returned when the provided payload is not a valid DHCP
// packet.
const errInvalidPktDHCP errors.Error = "packet is not a valid dhcp packet"
// buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames. The
// payload is expected to be an encoded DHCP packet.
</s> add // buildEtherPkt wraps the payload with IPv4, UDP and Ethernet frames.
// Validation of the payload is a caller's responsibility. </s> remove log.Debug("dhcpv4: sending to %s: %s", peer, resp.Summary())
if _, err := conn.WriteTo(resp.ToBytes(), peer); err != nil {
</s> add pktData := resp.ToBytes()
pktLen := len(pktData)
if pktLen < minDHCPMsgSize {
// Expand the packet to match the minimum DHCP message length. Although
// the dhpcv4 package deals with the BOOTP's lower packet length
// constraint, it seems some clients expecting the length being at least
// 576 bytes as per RFC 2131 (and an obsolete RFC 1533).
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/4337.
pktData = append(pktData, make([]byte, minDHCPMsgSize-pktLen)...)
}
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil { </s> remove return 0, fmt.Errorf("peer is of unexpected type %T", addr)
</s> add return 0, fmt.Errorf("addr has an unexpected type %T", addr) </s> remove // ipv4DefaultTTL is the default Time to Live value as recommended by
// RFC-1700 (https://datatracker.ietf.org/doc/html/rfc1700) in seconds.
</s> add // ipv4DefaultTTL is the default Time to Live value in seconds as recommended by
// RFC-1700.
//
// See https://datatracker.ietf.org/doc/html/rfc1700. | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/53209bc42c2401e017e5b727fb74272953a8cd0e | internal/dhcpd/conn_unix.go |
|
setts := gopacket.SerializeOptions{ | <mask> EthernetType: layers.EthernetTypeIPv4,
<mask> }
<mask>
<mask> buf := gopacket.NewSerializeBuffer()
<mask> err = gopacket.SerializeLayers(buf, gopacket.SerializeOptions{
<mask> FixLengths: true,
<mask> ComputeChecksums: true,
<mask> }, ethLayer, ipv4Layer, udpLayer, dhcpLayer.(gopacket.SerializableLayer))
<mask> if err != nil {
<mask> return nil, fmt.Errorf("serializing layers: %w", err)
</s> Pull request: 4337 increase msg size
Merge in DNS/adguard-home from 4337-dhcp-msg-len to master
Updates #4337.
Squashed commit of the following:
commit 55e53c1fadd4ccb2a8b94117afff82e9a5d2734b
Merge: f37070ea da1ae338
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 14:14:21 2022 +0300
Merge branch 'master' into 4337-dhcp-msg-len
commit f37070ea0f3a7ff8efcbbafd36001f78d9b082b5
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 13:15:25 2022 +0300
dhcpd: imp ether pkt building
commit fa43a0bcc24d4ca5e9193899dbba8495f3de5df9
Author: Eugene Burkov <[email protected]>
Date: Tue Sep 6 18:55:07 2022 +0300
dhcpd: incr msg size </s> remove }, ethLayer, ipv4Layer, udpLayer, dhcpLayer.(gopacket.SerializableLayer))
</s> add }
err = gopacket.SerializeLayers(
buf,
setts,
ethLayer,
ipv4Layer,
udpLayer,
gopacket.Payload(payload),
) </s> remove dhcpLayer := gopacket.NewPacket(payload, layers.LayerTypeDHCPv4, gopacket.DecodeOptions{
NoCopy: true,
}).Layer(layers.LayerTypeDHCPv4)
// Check if the decoding succeeded and the resulting layer doesn't
// contain any errors. It should guarantee panic-safe converting of the
// layer into gopacket.SerializableLayer.
if dhcpLayer == nil || dhcpLayer.LayerType() != layers.LayerTypeDHCPv4 {
return nil, errInvalidPktDHCP
}
</s> add </s> remove log.Debug("dhcpv4: sending to %s: %s", peer, resp.Summary())
if _, err := conn.WriteTo(resp.ToBytes(), peer); err != nil {
</s> add pktData := resp.ToBytes()
pktLen := len(pktData)
if pktLen < minDHCPMsgSize {
// Expand the packet to match the minimum DHCP message length. Although
// the dhpcv4 package deals with the BOOTP's lower packet length
// constraint, it seems some clients expecting the length being at least
// 576 bytes as per RFC 2131 (and an obsolete RFC 1533).
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/4337.
pktData = append(pktData, make([]byte, minDHCPMsgSize-pktLen)...)
}
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil { </s> remove func (c *dhcpConn) wrapErrs(action string, udpConnErr, rawConnErr error) (err error) {
</s> add func (*dhcpConn) wrapErrs(action string, udpConnErr, rawConnErr error) (err error) { </s> remove testutil.AssertErrorMsg(t, "peer is of unexpected type *dhcpd.unexpectedAddrType", err)
</s> add testutil.AssertErrorMsg(t, "addr has an unexpected type *dhcpd.unexpectedAddrType", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/53209bc42c2401e017e5b727fb74272953a8cd0e | internal/dhcpd/conn_unix.go |
}
err = gopacket.SerializeLayers(
buf,
setts,
ethLayer,
ipv4Layer,
udpLayer,
gopacket.Payload(payload),
) | <mask> buf := gopacket.NewSerializeBuffer()
<mask> err = gopacket.SerializeLayers(buf, gopacket.SerializeOptions{
<mask> FixLengths: true,
<mask> ComputeChecksums: true,
<mask> }, ethLayer, ipv4Layer, udpLayer, dhcpLayer.(gopacket.SerializableLayer))
<mask> if err != nil {
<mask> return nil, fmt.Errorf("serializing layers: %w", err)
<mask> }
<mask>
<mask> return buf.Bytes(), nil
</s> Pull request: 4337 increase msg size
Merge in DNS/adguard-home from 4337-dhcp-msg-len to master
Updates #4337.
Squashed commit of the following:
commit 55e53c1fadd4ccb2a8b94117afff82e9a5d2734b
Merge: f37070ea da1ae338
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 14:14:21 2022 +0300
Merge branch 'master' into 4337-dhcp-msg-len
commit f37070ea0f3a7ff8efcbbafd36001f78d9b082b5
Author: Eugene Burkov <[email protected]>
Date: Wed Sep 7 13:15:25 2022 +0300
dhcpd: imp ether pkt building
commit fa43a0bcc24d4ca5e9193899dbba8495f3de5df9
Author: Eugene Burkov <[email protected]>
Date: Tue Sep 6 18:55:07 2022 +0300
dhcpd: incr msg size </s> remove err = gopacket.SerializeLayers(buf, gopacket.SerializeOptions{
</s> add setts := gopacket.SerializeOptions{ </s> remove dhcpLayer := gopacket.NewPacket(payload, layers.LayerTypeDHCPv4, gopacket.DecodeOptions{
NoCopy: true,
}).Layer(layers.LayerTypeDHCPv4)
// Check if the decoding succeeded and the resulting layer doesn't
// contain any errors. It should guarantee panic-safe converting of the
// layer into gopacket.SerializableLayer.
if dhcpLayer == nil || dhcpLayer.LayerType() != layers.LayerTypeDHCPv4 {
return nil, errInvalidPktDHCP
}
</s> add </s> remove log.Debug("dhcpv4: sending to %s: %s", peer, resp.Summary())
if _, err := conn.WriteTo(resp.ToBytes(), peer); err != nil {
</s> add pktData := resp.ToBytes()
pktLen := len(pktData)
if pktLen < minDHCPMsgSize {
// Expand the packet to match the minimum DHCP message length. Although
// the dhpcv4 package deals with the BOOTP's lower packet length
// constraint, it seems some clients expecting the length being at least
// 576 bytes as per RFC 2131 (and an obsolete RFC 1533).
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/4337.
pktData = append(pktData, make([]byte, minDHCPMsgSize-pktLen)...)
}
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil { </s> remove func (c *dhcpConn) wrapErrs(action string, udpConnErr, rawConnErr error) (err error) {
</s> add func (*dhcpConn) wrapErrs(action string, udpConnErr, rawConnErr error) (err error) { </s> remove testutil.AssertErrorMsg(t, "peer is of unexpected type *dhcpd.unexpectedAddrType", err)
</s> add testutil.AssertErrorMsg(t, "addr has an unexpected type *dhcpd.unexpectedAddrType", err) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/53209bc42c2401e017e5b727fb74272953a8cd0e | internal/dhcpd/conn_unix.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.