Dawnline 0.20.0
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / Backend (Go: vet, tests, a real ubusd and uhttpd) (push) Blocked by required conditions
CI / Package files (push) Blocked by required conditions
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / Backend (Go: vet, tests, a real ubusd and uhttpd) (push) Blocked by required conditions
CI / Package files (push) Blocked by required conditions
- **Backend rewritten in Go.** One daemon, `dawnlined`, replaces the whole ucode backend: the rpcd plugin, the agent, the CLI and the updater. The package no longer depends on ucode. - **Per-architecture builds.** The release carries the backend for arm64, ARMv7, mips, mipsle and amd64; the router fetches its own after the package is installed and checks its sha256. Dawnline does not run on other architectures (older ARM, 32-bit x86, RISC-V). - **Faster on the router.** A firewall sync takes 0.06 s instead of 0.9 s; a full apply takes about 300 ms. The portal is served by the daemon itself, without a CGI process per request. - **Live pages.** The admin and the portal follow a live stream from the router instead of re-fetching the whole state every 30 seconds. - **Admin redesigned in the portal's style.** Three sections (Overview · Log · Settings); a server is a page of its own with People, Places and Settings; a device opens as a dialog over its person. - **Changes wait for «Apply».** Every setting, and a person's access, is staged in one dock before it reaches the router. - **Configuration rollout.** After a change that makes devices fetch their configuration again, the admin shows how many have fetched it and who has not. Every setting shows beforehand (⟳N) how many devices it will touch. - **Waiting for a decision.** Overview and People put first the people who need one (access ended, limit reached, a device that does not connect), each with its one action a tap away. - **Bulk actions on people.** «Select» (or a long press on a card) picks several people to extend by a month, pause or resume at once. - **Undo.** An action done from a card or a request is undone from its toast. - **Update dialogs redesigned.** An update is one view from its question to its result; Dawnline's own update runs in it like every other, and the page reloads itself once the new version answers. Other versions are a list, each with its notes and Install on a page of its own. - **Site to site: networks behind a router.** A router connected as a device can have networks behind it (up to eight, /16 to /30): the server routes them and applies the router's access to them. A network that shares addresses with a tunnel, the router's own networks or another site is refused by name. - **Routers from the portal.** People can add a router and name its networks on their own page; the admin accepts or declines with a reason, or lets them through without asking. - **Check access and Health know the networks behind routers.** - **Usage limits reworked.** A monthly limit no longer follows the calendar. A person's month starts with their first traffic and ends a month later; the next one starts only when they connect again, so time away uses up none of it. Before, everyone's limit reset on the 1st. - Extra data lasts until that person's month ends; «Reset usage» starts the month anew. - A limit is for a month or for the whole term; the admin and the portal show when it resets. - Charts that said «this month» show the last 30 days. - After the update nobody loses what was counted: the month that was running becomes the person's first and ends on the 1st. - **Access by time of day removed.** The Hours limit is gone from the admin, the portal and the backend; saved hours are dropped. - **Expiry simplified.** An end date always stops access, with a heads-up three days before; the per-person choice is gone. - **No false disconnects from sleeping phones.** A phone or a tablet stays online through ten minutes of silence. - **Mobile Safari fixes.** Pressing a control no longer sends the page to its top; tab tracks that do not fit scroll; switches animate after a press.
This commit is contained in:
1 parent
f8130e39a8
commit
ac90575b0b
788 files changed
+139244
-41720
No files matched your search
@@ -0,0 +1,524 @@
|
||||
// Package netview is the router's own networks: which interfaces there are, which is the WAN, which the
|
||||
// LAN, and what a server's and a person's "home" reaches. As dawnline.net (snapshot, server_net) and
|
||||
// dawnline.core (person_home) work them out: a device's configuration lists these networks, so the two
|
||||
// backends must name the same ones.
|
||||
//
|
||||
// What it reads of the system comes through Sources, so a test hands in what a router said.
|
||||
package netview
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/tickcount/luci-app-dawnline/backend/ipnet"
|
||||
"github.com/tickcount/luci-app-dawnline/backend/model"
|
||||
"github.com/tickcount/luci-app-dawnline/backend/uci"
|
||||
)
|
||||
|
||||
// Links Dawnline makes itself: never interfaces to offer.
|
||||
const transit, inner = "dlx0", "dll0"
|
||||
|
||||
var (
|
||||
vpnProtos = []string{"amneziawg", "wireguard", "openvpn", "openconnect", "vpnc", "pptp", "l2tp", "gre", "gretap", "vti", "xfrm"}
|
||||
vpnNames = regexp.MustCompile(`^(wg|awg|tun|tap|ovpn|ipsec|vti|xfrm)`)
|
||||
notWanProto = []string{"amneziawg", "wireguard", "openvpn", "openconnect", "vpnc"}
|
||||
notWanNames = regexp.MustCompile(`^(wg|awg|tun|tap|ovpn)`)
|
||||
noise = regexp.MustCompile(`^(ifb|teql|sit|ip6tnl|gre|gretap|erspan|ip6gre|ip6gretap|ip_vti|ip6_vti|tunl|bond)[0-9]*$`)
|
||||
private = []string{"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "100.64.0.0/10"}
|
||||
)
|
||||
|
||||
// Link is what the system says of one interface.
|
||||
type Link struct {
|
||||
Flags int64 `json:"flags"`
|
||||
Type int `json:"type"`
|
||||
Master string `json:"master"`
|
||||
Bridge bool `json:"bridge"`
|
||||
Wifi bool `json:"wifi"`
|
||||
}
|
||||
|
||||
// Logical is a netifd interface on a device.
|
||||
type Logical struct {
|
||||
Name string `json:"name"`
|
||||
Proto string `json:"proto"`
|
||||
}
|
||||
|
||||
// Sources is where a snapshot reads the system.
|
||||
type Sources struct {
|
||||
// Routes is `ip -j -4 route show table main`'s answer.
|
||||
Routes func() []byte
|
||||
// Addrs is `ip -j -4 addr show`'s answer (nil: no addresses are read).
|
||||
Addrs func() []byte
|
||||
// Links is every interface by name; Logical the netifd interface on each device.
|
||||
Links func() map[string]Link
|
||||
Logical func() map[string]Logical
|
||||
// Zones is the firewall's zones (nil: none are read).
|
||||
Zones func() Zones
|
||||
}
|
||||
|
||||
// Device is an interface as Dawnline sees it.
|
||||
type Device struct {
|
||||
Name string `json:"name"`
|
||||
// Category is what it is to the admin: wan (the one the default route leaves by), wifi, vpn, ethernet,
|
||||
// other. Kind is the same but for a bridge, which is "bridge", and for the WAN, which keeps its own.
|
||||
Category string `json:"category"`
|
||||
Kind string `json:"kind"`
|
||||
Up bool `json:"up"`
|
||||
// Master is the bridge it is a port of; Members a bridge's ports.
|
||||
Master string `json:"master"`
|
||||
Members []string `json:"members"`
|
||||
Nets []string `json:"nets"`
|
||||
// Addrs is its IPv4 addresses ("192.0.2.7/24"), when they were read.
|
||||
Addrs []string `json:"addrs"`
|
||||
// Logical is the netifd interface on it and Proto that one's protocol; Zone its firewall zone ("": none).
|
||||
Logical string `json:"logical"`
|
||||
Proto string `json:"proto"`
|
||||
Zone string `json:"zone"`
|
||||
}
|
||||
|
||||
// Zones is the firewall's zones: every name, and the zone of each network and each device named in one.
|
||||
type Zones struct {
|
||||
Names []string
|
||||
ByNet, ByDev map[string]string
|
||||
}
|
||||
|
||||
// ZonesOf reads the zones of a firewall configuration, the first zone that names a network or device winning.
|
||||
func ZonesOf(fw *uci.Config) Zones {
|
||||
z := Zones{ByNet: map[string]string{}, ByDev: map[string]string{}}
|
||||
if fw == nil {
|
||||
return z
|
||||
}
|
||||
for _, s := range fw.OfType("zone") {
|
||||
name, _ := s.Get("name")
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
z.Names = append(z.Names, name)
|
||||
for key, into := range map[string]map[string]string{"network": z.ByNet, "device": z.ByDev} {
|
||||
v := s.Values[key]
|
||||
list := v.List
|
||||
if !v.IsList {
|
||||
list = strings.Fields(v.Str)
|
||||
}
|
||||
for _, n := range list {
|
||||
if _, has := into[n]; n != "" && !has {
|
||||
into[n] = name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return z
|
||||
}
|
||||
|
||||
// Snapshot is one consistent look at the router's interfaces.
|
||||
type Snapshot struct {
|
||||
Devices map[string]*Device
|
||||
WAN string
|
||||
LAN string
|
||||
// Zones is every firewall zone's name.
|
||||
Zones []string
|
||||
}
|
||||
|
||||
// Names is the interfaces' names, sorted: the order ucode lists them in.
|
||||
func (s *Snapshot) Names() []string {
|
||||
out := make([]string, 0, len(s.Devices))
|
||||
for n := range s.Devices {
|
||||
out = append(out, n)
|
||||
}
|
||||
sort.Strings(out)
|
||||
return out
|
||||
}
|
||||
|
||||
func has(list []string, v string) bool {
|
||||
for _, x := range list {
|
||||
if x == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func isPrivate(cidr string) bool {
|
||||
n, ok := ipnet.Any(cidr)
|
||||
if !ok || n.Prefix < 1 {
|
||||
return false
|
||||
}
|
||||
for _, p := range private {
|
||||
if r, _ := ipnet.Any(p); r.Holds(n.Base) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Take looks at the router.
|
||||
func Take(src Sources) *Snapshot {
|
||||
var routes []struct {
|
||||
Dst string `json:"dst"`
|
||||
Dev string `json:"dev"`
|
||||
Metric *int `json:"metric"`
|
||||
}
|
||||
json.Unmarshal(src.Routes(), &routes)
|
||||
logical := map[string]Logical{}
|
||||
if src.Logical != nil {
|
||||
logical = src.Logical()
|
||||
}
|
||||
byDev := map[string][]string{}
|
||||
vpn := func(dev string) bool { return has(notWanProto, logical[dev].Proto) || notWanNames.MatchString(dev) }
|
||||
// The WAN: the default route with the lowest metric that does not go into a VPN client; only VPN
|
||||
// routes: the lowest of them.
|
||||
wan, wanMetric, wanVPN := "", 0, true
|
||||
for _, r := range routes {
|
||||
if r.Dev == "" {
|
||||
continue
|
||||
}
|
||||
if r.Dst != "default" {
|
||||
byDev[r.Dev] = append(byDev[r.Dev], r.Dst)
|
||||
continue
|
||||
}
|
||||
v, metric := vpn(r.Dev), 0
|
||||
if r.Metric != nil {
|
||||
metric = *r.Metric
|
||||
}
|
||||
if wan == "" || (wanVPN && !v) || (wanVPN == v && metric < wanMetric) {
|
||||
wan, wanMetric, wanVPN = r.Dev, metric, v
|
||||
}
|
||||
}
|
||||
addrs := map[string][]string{}
|
||||
if src.Addrs != nil {
|
||||
var list []struct {
|
||||
Ifname string `json:"ifname"`
|
||||
Info []struct {
|
||||
Family string `json:"family"`
|
||||
Local string `json:"local"`
|
||||
Prefix int `json:"prefixlen"`
|
||||
} `json:"addr_info"`
|
||||
}
|
||||
json.Unmarshal(src.Addrs(), &list)
|
||||
for _, l := range list {
|
||||
for _, a := range l.Info {
|
||||
if a.Family == "inet" {
|
||||
addrs[l.Ifname] = append(addrs[l.Ifname], a.Local+"/"+strconv.Itoa(a.Prefix))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
links := src.Links()
|
||||
names := make([]string, 0, len(links))
|
||||
for n := range links {
|
||||
names = append(names, n)
|
||||
}
|
||||
sort.Strings(names)
|
||||
zones := Zones{}
|
||||
if src.Zones != nil {
|
||||
zones = src.Zones()
|
||||
}
|
||||
s := &Snapshot{Devices: map[string]*Device{}, WAN: wan, Zones: zones.Names}
|
||||
if s.Zones == nil {
|
||||
s.Zones = []string{}
|
||||
}
|
||||
var order []string
|
||||
for _, dev := range names {
|
||||
if dev == "lo" || dev == transit || dev == inner {
|
||||
continue
|
||||
}
|
||||
l := links[dev]
|
||||
nets := []string{}
|
||||
if byDev[dev] != nil {
|
||||
nets = ipnet.Collapse(byDev[dev])
|
||||
}
|
||||
if noise.MatchString(dev) && len(nets) == 0 {
|
||||
continue
|
||||
}
|
||||
lg, known := logical[dev]
|
||||
cat := "other"
|
||||
switch {
|
||||
case l.Wifi:
|
||||
cat = "wifi"
|
||||
case (known && has(vpnProtos, lg.Proto)) || l.Type == 65534 || (l.Flags&0x10 != 0 && l.Type != 1) || vpnNames.MatchString(dev):
|
||||
cat = "vpn"
|
||||
case l.Type == 1 || l.Bridge:
|
||||
cat = "ethernet"
|
||||
}
|
||||
d := &Device{Name: dev, Category: cat, Kind: cat, Up: l.Flags&1 != 0, Master: l.Master, Members: []string{}, Nets: nets, Addrs: addrs[dev],
|
||||
Logical: lg.Name, Proto: lg.Proto, Zone: zones.ByDev[dev]}
|
||||
if l.Bridge {
|
||||
d.Kind = "bridge"
|
||||
}
|
||||
if dev == wan {
|
||||
d.Category = "wan"
|
||||
}
|
||||
if d.Addrs == nil {
|
||||
d.Addrs = []string{}
|
||||
}
|
||||
if d.Zone == "" && known {
|
||||
d.Zone = zones.ByNet[lg.Name]
|
||||
}
|
||||
s.Devices[dev] = d
|
||||
order = append(order, dev)
|
||||
}
|
||||
for _, dev := range order {
|
||||
if m := s.Devices[s.Devices[dev].Master]; m != nil {
|
||||
m.Members = append(m.Members, dev)
|
||||
}
|
||||
}
|
||||
// The LAN: netifd's "lan" if present, otherwise the first bridge (then ethernet device) carrying a
|
||||
// private network.
|
||||
for dev, lg := range logical {
|
||||
if lg.Name == "lan" && s.Devices[dev] != nil {
|
||||
s.LAN = dev
|
||||
}
|
||||
}
|
||||
for _, pass := range []string{"bridge", "ethernet"} {
|
||||
for _, dev := range order {
|
||||
d := s.Devices[dev]
|
||||
if s.LAN != "" || dev == wan || d.Kind != pass || d.Master != "" {
|
||||
continue
|
||||
}
|
||||
for _, n := range d.Nets {
|
||||
if isPrivate(n) {
|
||||
s.LAN = dev
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// WanAddress is the address of the interface a server's devices come in on, or "".
|
||||
func (s *Snapshot) WanAddress(srv *model.Server) string {
|
||||
wan := srv.WanDevice
|
||||
if srv.AutoWan {
|
||||
wan = s.WAN
|
||||
if wan == "" {
|
||||
wan = srv.DetectedWan
|
||||
}
|
||||
}
|
||||
if d := s.Devices[wan]; d != nil && len(d.Addrs) > 0 {
|
||||
return strings.SplitN(d.Addrs[0], "/", 2)[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Home is one interface of a server's home network.
|
||||
type Home struct {
|
||||
Dev string
|
||||
Nets []string
|
||||
}
|
||||
|
||||
// ServerHome is the interfaces that make up a server's home network and what they reach together.
|
||||
func (s *Snapshot) ServerHome(srv *model.Server) (home []Home, nets []string) {
|
||||
wan := srv.WanDevice
|
||||
if srv.AutoWan {
|
||||
wan = s.WAN
|
||||
if wan == "" {
|
||||
wan = srv.DetectedWan
|
||||
}
|
||||
}
|
||||
var picked []string
|
||||
auto := ""
|
||||
if srv.AutoLan {
|
||||
auto = s.LAN
|
||||
if auto == "" {
|
||||
auto = srv.DetectedLan
|
||||
}
|
||||
}
|
||||
if auto != "" {
|
||||
picked = append(picked, auto)
|
||||
}
|
||||
for _, d := range srv.LanDevices {
|
||||
if d != auto {
|
||||
picked = append(picked, d)
|
||||
}
|
||||
}
|
||||
var all []string
|
||||
for _, dev := range picked {
|
||||
d := s.Devices[dev]
|
||||
// Never the WAN, the tunnel itself, or a bridge port (routing only sees the bridge).
|
||||
if dev == wan || dev == srv.Ifname || (d != nil && d.Master != "") {
|
||||
continue
|
||||
}
|
||||
h := Home{Dev: dev, Nets: []string{}}
|
||||
if d != nil {
|
||||
h.Nets = d.Nets
|
||||
}
|
||||
home = append(home, h)
|
||||
all = append(all, h.Nets...)
|
||||
}
|
||||
return home, ipnet.Collapse(all)
|
||||
}
|
||||
|
||||
// PersonHome is the home networks a person reaches: all of the server's, or only the interfaces ticked on
|
||||
// their page.
|
||||
func (s *Snapshot) PersonHome(srv *model.Server, p *model.Person) []string {
|
||||
home, nets := s.ServerHome(srv)
|
||||
if p == nil || len(p.HomeNets) == 0 {
|
||||
return nets
|
||||
}
|
||||
var picked []string
|
||||
for _, h := range home {
|
||||
if has(p.HomeNets, h.Dev) {
|
||||
picked = append(picked, h.Nets...)
|
||||
}
|
||||
}
|
||||
return ipnet.Collapse(picked)
|
||||
}
|
||||
|
||||
// System reads the router itself: `ip` for the routes, /sys/class/net for the interfaces. logical is asked
|
||||
// of netifd by the caller (it holds the bus).
|
||||
func System(logical func() map[string]Logical) Sources {
|
||||
const sys = "/sys/class/net"
|
||||
read := func(dev, f string) string {
|
||||
b, _ := os.ReadFile(filepath.Join(sys, dev, f))
|
||||
return strings.TrimSpace(string(b))
|
||||
}
|
||||
return Sources{
|
||||
Routes: func() []byte {
|
||||
out, _ := exec.Command("ip", "-j", "-4", "route", "show", "table", "main").Output()
|
||||
return out
|
||||
},
|
||||
Addrs: func() []byte {
|
||||
out, _ := exec.Command("ip", "-j", "-4", "addr", "show").Output()
|
||||
return out
|
||||
},
|
||||
Links: func() map[string]Link {
|
||||
out := map[string]Link{}
|
||||
entries, _ := os.ReadDir(sys)
|
||||
for _, e := range entries {
|
||||
dev := e.Name()
|
||||
l := Link{}
|
||||
l.Flags, _ = strconv.ParseInt(strings.TrimPrefix(read(dev, "flags"), "0x"), 16, 64)
|
||||
l.Type, _ = strconv.Atoi(read(dev, "type"))
|
||||
if m, err := os.Readlink(filepath.Join(sys, dev, "master")); err == nil {
|
||||
l.Master = filepath.Base(m)
|
||||
}
|
||||
_, err := os.Stat(filepath.Join(sys, dev, "bridge"))
|
||||
l.Bridge = err == nil
|
||||
_, e1 := os.Stat(filepath.Join(sys, dev, "phy80211"))
|
||||
_, e2 := os.Stat(filepath.Join(sys, dev, "wireless"))
|
||||
l.Wifi = e1 == nil || e2 == nil
|
||||
out[dev] = l
|
||||
}
|
||||
return out
|
||||
},
|
||||
Logical: logical,
|
||||
Zones: func() Zones {
|
||||
raw, err := os.ReadFile("/etc/config/firewall")
|
||||
if err != nil {
|
||||
return Zones{}
|
||||
}
|
||||
fw, _ := uci.Parse(string(raw))
|
||||
return ZonesOf(fw)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Wan is the interface a server's devices come in on; HomeOf one interface of its home network.
|
||||
type Wan struct {
|
||||
Dev string
|
||||
Auto bool
|
||||
Zone string
|
||||
Missing bool
|
||||
}
|
||||
|
||||
type HomeOf struct {
|
||||
Dev string
|
||||
Auto bool
|
||||
Nets []string
|
||||
Zone string
|
||||
Missing bool
|
||||
}
|
||||
|
||||
// ServerNet is what a server uses right now (dawnline.net server_net): its WAN, the interfaces of its home
|
||||
// Own is the router's own networks: every route of its main table but the ones through Dawnline's own
|
||||
// tunnels, which Dawnline puts there itself (a tunnel's subnet, the networks behind people's routers).
|
||||
func (s *Snapshot) Own(m *model.Model) []string {
|
||||
ours := map[string]bool{}
|
||||
for _, srv := range m.Servers {
|
||||
ours[srv.Ifname] = true
|
||||
}
|
||||
var nets []string
|
||||
for _, name := range s.Names() {
|
||||
if !ours[name] {
|
||||
nets = append(nets, s.Devices[name].Nets...)
|
||||
}
|
||||
}
|
||||
return ipnet.Collapse(nets)
|
||||
}
|
||||
|
||||
// Behind is the networks behind each router that are in effect on this router, by the device's id: none
|
||||
// that shares addresses with a network the router has itself.
|
||||
func (s *Snapshot) Behind(m *model.Model) map[string][]string { return m.BehindOf(s.Own(m)) }
|
||||
|
||||
// network, what those reach together, and their firewall zones.
|
||||
func (s *Snapshot) ServerNet(srv *model.Server) (wan Wan, home []HomeOf, nets, zones []string) {
|
||||
wan = Wan{Dev: srv.WanDevice, Auto: srv.AutoWan}
|
||||
if srv.AutoWan {
|
||||
if wan.Dev = s.WAN; wan.Dev == "" {
|
||||
wan.Dev = srv.DetectedWan
|
||||
}
|
||||
}
|
||||
wan.Zone = srv.WanZone
|
||||
if d := s.Devices[wan.Dev]; d != nil && d.Zone != "" {
|
||||
wan.Zone = d.Zone
|
||||
}
|
||||
if wan.Zone == "" {
|
||||
wan.Zone = "wan"
|
||||
}
|
||||
wan.Missing = wan.Dev != "" && s.Devices[wan.Dev] == nil
|
||||
type pick struct {
|
||||
dev string
|
||||
auto bool
|
||||
}
|
||||
var picked []pick
|
||||
auto := ""
|
||||
if srv.AutoLan {
|
||||
if auto = s.LAN; auto == "" {
|
||||
auto = srv.DetectedLan
|
||||
}
|
||||
}
|
||||
if auto != "" {
|
||||
picked = append(picked, pick{auto, true})
|
||||
}
|
||||
for _, d := range srv.LanDevices {
|
||||
if d != auto {
|
||||
picked = append(picked, pick{d, false})
|
||||
}
|
||||
}
|
||||
home, zones = []HomeOf{}, []string{}
|
||||
var all []string
|
||||
zone := func(z string) {
|
||||
if z != "" && !has(zones, z) {
|
||||
zones = append(zones, z)
|
||||
}
|
||||
}
|
||||
for _, p := range picked {
|
||||
d := s.Devices[p.dev]
|
||||
// Never the WAN, the tunnel itself, or a bridge port (routing only sees the bridge).
|
||||
if p.dev == wan.Dev || p.dev == srv.Ifname || (d != nil && d.Master != "") {
|
||||
continue
|
||||
}
|
||||
// The detected LAN missing for a moment (bridge recreated) keeps its zone.
|
||||
h := HomeOf{Dev: p.dev, Auto: p.auto, Nets: []string{}, Missing: d == nil}
|
||||
if d != nil {
|
||||
h.Nets, h.Zone = d.Nets, d.Zone
|
||||
}
|
||||
if h.Zone == "" && p.auto {
|
||||
h.Zone = srv.LanZone
|
||||
}
|
||||
home = append(home, h)
|
||||
all = append(all, h.Nets...)
|
||||
zone(h.Zone)
|
||||
}
|
||||
// Older configs and routers where nothing could be resolved: the zone set at setup.
|
||||
if len(home) == 0 && srv.AutoLan {
|
||||
zone(srv.LanZone)
|
||||
}
|
||||
return wan, home, ipnet.Collapse(all), zones
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package netview
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/tickcount/luci-app-dawnline/backend/model"
|
||||
"github.com/tickcount/luci-app-dawnline/backend/uci"
|
||||
)
|
||||
|
||||
// From what the golden's router said, the same interfaces, WAN, LAN and home networks as ucode found
|
||||
// (scripts/ucode-golden.sh writes trace.json from dawnline.net and dawnline.core).
|
||||
func TestHeldToUcode(t *testing.T) {
|
||||
raw, err := os.ReadFile("testdata/trace.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var golden struct {
|
||||
Routes json.RawMessage `json:"routes"`
|
||||
Addrs json.RawMessage `json:"addrs"`
|
||||
Firewall string `json:"firewall"`
|
||||
Zones []string `json:"zones"`
|
||||
Servers map[string]struct {
|
||||
Wan struct {
|
||||
Dev string `json:"dev"`
|
||||
Auto bool `json:"auto"`
|
||||
Zone string `json:"zone"`
|
||||
Missing bool `json:"missing"`
|
||||
} `json:"wan"`
|
||||
Home []struct {
|
||||
Dev string `json:"dev"`
|
||||
Auto bool `json:"auto"`
|
||||
Nets []string `json:"nets"`
|
||||
Zone string `json:"zone"`
|
||||
Missing bool `json:"missing"`
|
||||
} `json:"home"`
|
||||
Nets []string `json:"nets"`
|
||||
Zones []string `json:"zones"`
|
||||
} `json:"servers"`
|
||||
Links map[string]Link `json:"links"`
|
||||
Devices map[string]*Device `json:"devices"`
|
||||
WAN *string `json:"wan"`
|
||||
LAN *string `json:"lan"`
|
||||
Homes map[string][]string `json:"homes"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &golden); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fw, err := uci.Parse(golden.Firewall)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s := Take(Sources{Routes: func() []byte { return golden.Routes }, Addrs: func() []byte { return golden.Addrs },
|
||||
Links: func() map[string]Link { return golden.Links }, Zones: func() Zones { return ZonesOf(fw) }})
|
||||
if !reflect.DeepEqual(s.Zones, golden.Zones) || len(s.Zones) < 2 {
|
||||
t.Fatalf("zones %v, ucode has %v", s.Zones, golden.Zones)
|
||||
}
|
||||
if !reflect.DeepEqual(s.Devices, golden.Devices) {
|
||||
g, _ := json.MarshalIndent(s.Devices, "", " ")
|
||||
w, _ := json.MarshalIndent(golden.Devices, "", " ")
|
||||
t.Fatalf("the interfaces differ\nGo: %s\nucode: %s", g, w)
|
||||
}
|
||||
str := func(p *string) string {
|
||||
if p == nil {
|
||||
return ""
|
||||
}
|
||||
return *p
|
||||
}
|
||||
if s.WAN != str(golden.WAN) || s.LAN != str(golden.LAN) {
|
||||
t.Fatalf("WAN %q, LAN %q; ucode has %q, %q", s.WAN, s.LAN, str(golden.WAN), str(golden.LAN))
|
||||
}
|
||||
if s.LAN == "" || len(golden.Devices) < 5 {
|
||||
t.Fatalf("the golden's router is too bare to hold anything to: %d interfaces, LAN %q", len(golden.Devices), s.LAN)
|
||||
}
|
||||
text, err := os.ReadFile("../handout/testdata/conf.uci")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
c, err := uci.Parse(string(text))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
m := model.Load(c, nil)
|
||||
zoned := 0
|
||||
for id, want := range golden.Servers {
|
||||
wan, home, nets, zones := s.ServerNet(m.Servers[id])
|
||||
got, _ := json.Marshal(map[string]any{"wan": wan, "home": home, "nets": nets, "zones": zones})
|
||||
type w = map[string]any
|
||||
homes := []any{}
|
||||
for _, h := range want.Home {
|
||||
homes = append(homes, HomeOf{h.Dev, h.Auto, h.Nets, h.Zone, h.Missing})
|
||||
if h.Zone != "" {
|
||||
zoned++
|
||||
}
|
||||
}
|
||||
exp, _ := json.Marshal(w{"wan": Wan{want.Wan.Dev, want.Wan.Auto, want.Wan.Zone, want.Wan.Missing}, "home": homes, "nets": want.Nets, "zones": want.Zones})
|
||||
if string(got) != string(exp) {
|
||||
t.Errorf("server %s uses\n Go: %s\n ucode: %s", id, got, exp)
|
||||
}
|
||||
}
|
||||
if len(golden.Servers) == 0 || zoned == 0 {
|
||||
t.Fatalf("the golden holds no server's home in a zone: %d servers", len(golden.Servers))
|
||||
}
|
||||
reached := 0
|
||||
for id, want := range golden.Homes {
|
||||
p := m.People[id]
|
||||
srv := m.Servers[p.Server]
|
||||
if srv == nil {
|
||||
continue
|
||||
}
|
||||
got := s.PersonHome(srv, p)
|
||||
reached += len(got)
|
||||
if len(got) != len(want) || (len(got) > 0 && !reflect.DeepEqual(got, want)) {
|
||||
t.Errorf("%s reaches %v, ucode has %v", id, got, want)
|
||||
}
|
||||
}
|
||||
if reached == 0 {
|
||||
t.Fatal("nobody reaches a home network in the golden")
|
||||
}
|
||||
}
|
||||
Vendored
+605
@@ -0,0 +1,605 @@
|
||||
{
|
||||
"routes": [
|
||||
{
|
||||
"dst": "default",
|
||||
"gateway": "172.17.0.1",
|
||||
"dev": "eth0",
|
||||
"flags": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"dst": "10.20.4.0/22",
|
||||
"dev": "dlguest",
|
||||
"protocol": "kernel",
|
||||
"scope": "link",
|
||||
"prefsrc": "10.20.4.1",
|
||||
"flags": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"dst": "10.66.0.0/24",
|
||||
"dev": "wg9",
|
||||
"protocol": "kernel",
|
||||
"scope": "link",
|
||||
"prefsrc": "10.66.0.2",
|
||||
"flags": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"dst": "172.17.0.0/16",
|
||||
"dev": "eth0",
|
||||
"protocol": "kernel",
|
||||
"scope": "link",
|
||||
"prefsrc": "172.17.0.2",
|
||||
"flags": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"dst": "192.168.50.0/24",
|
||||
"dev": "dlhome",
|
||||
"protocol": "kernel",
|
||||
"scope": "link",
|
||||
"prefsrc": "192.168.50.1",
|
||||
"flags": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"dst": "192.168.77.0/24",
|
||||
"dev": "br-lan",
|
||||
"protocol": "kernel",
|
||||
"scope": "link",
|
||||
"prefsrc": "192.168.77.1",
|
||||
"flags": [
|
||||
]
|
||||
}
|
||||
],
|
||||
"addrs": [
|
||||
{
|
||||
"ifindex": 1,
|
||||
"ifname": "lo",
|
||||
"flags": [
|
||||
"LOOPBACK",
|
||||
"UP",
|
||||
"LOWER_UP"
|
||||
],
|
||||
"mtu": 65536,
|
||||
"qdisc": "noqueue",
|
||||
"operstate": "UNKNOWN",
|
||||
"group": "default",
|
||||
"txqlen": 1000,
|
||||
"addr_info": [
|
||||
{
|
||||
"family": "inet",
|
||||
"local": "127.0.0.1",
|
||||
"prefixlen": 8,
|
||||
"scope": "host",
|
||||
"label": "lo",
|
||||
"valid_life_time": 4294967295,
|
||||
"preferred_life_time": 4294967295
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ifindex": 11,
|
||||
"link_index": 243,
|
||||
"ifname": "eth0",
|
||||
"flags": [
|
||||
"BROADCAST",
|
||||
"MULTICAST",
|
||||
"UP",
|
||||
"LOWER_UP"
|
||||
],
|
||||
"mtu": 65535,
|
||||
"qdisc": "noqueue",
|
||||
"operstate": "UP",
|
||||
"group": "default",
|
||||
"link_netnsid": 0,
|
||||
"addr_info": [
|
||||
{
|
||||
"family": "inet",
|
||||
"local": "172.17.0.2",
|
||||
"prefixlen": 16,
|
||||
"broadcast": "172.17.255.255",
|
||||
"scope": "global",
|
||||
"label": "eth0",
|
||||
"valid_life_time": 4294967295,
|
||||
"preferred_life_time": 4294967295
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ifindex": 12,
|
||||
"ifname": "dlhome",
|
||||
"flags": [
|
||||
"BROADCAST",
|
||||
"NOARP",
|
||||
"UP",
|
||||
"LOWER_UP"
|
||||
],
|
||||
"mtu": 1500,
|
||||
"qdisc": "noqueue",
|
||||
"operstate": "UNKNOWN",
|
||||
"group": "default",
|
||||
"txqlen": 1000,
|
||||
"addr_info": [
|
||||
{
|
||||
"family": "inet",
|
||||
"local": "192.168.50.1",
|
||||
"prefixlen": 24,
|
||||
"scope": "global",
|
||||
"label": "dlhome",
|
||||
"valid_life_time": 4294967295,
|
||||
"preferred_life_time": 4294967295
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ifindex": 13,
|
||||
"ifname": "dlguest",
|
||||
"flags": [
|
||||
"BROADCAST",
|
||||
"NOARP",
|
||||
"UP",
|
||||
"LOWER_UP"
|
||||
],
|
||||
"mtu": 1500,
|
||||
"qdisc": "noqueue",
|
||||
"operstate": "UNKNOWN",
|
||||
"group": "default",
|
||||
"txqlen": 1000,
|
||||
"addr_info": [
|
||||
{
|
||||
"family": "inet",
|
||||
"local": "10.20.4.1",
|
||||
"prefixlen": 22,
|
||||
"scope": "global",
|
||||
"label": "dlguest",
|
||||
"valid_life_time": 4294967295,
|
||||
"preferred_life_time": 4294967295
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ifindex": 14,
|
||||
"ifname": "br-lan",
|
||||
"flags": [
|
||||
"BROADCAST",
|
||||
"MULTICAST",
|
||||
"UP",
|
||||
"LOWER_UP"
|
||||
],
|
||||
"mtu": 1500,
|
||||
"qdisc": "noqueue",
|
||||
"operstate": "UP",
|
||||
"group": "default",
|
||||
"txqlen": 1000,
|
||||
"addr_info": [
|
||||
{
|
||||
"family": "inet",
|
||||
"local": "192.168.77.1",
|
||||
"prefixlen": 24,
|
||||
"scope": "global",
|
||||
"label": "br-lan",
|
||||
"valid_life_time": 4294967295,
|
||||
"preferred_life_time": 4294967295
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ifindex": 17,
|
||||
"ifname": "wg9",
|
||||
"flags": [
|
||||
"BROADCAST",
|
||||
"NOARP",
|
||||
"UP",
|
||||
"LOWER_UP"
|
||||
],
|
||||
"mtu": 1500,
|
||||
"qdisc": "noqueue",
|
||||
"operstate": "UNKNOWN",
|
||||
"group": "default",
|
||||
"txqlen": 1000,
|
||||
"addr_info": [
|
||||
{
|
||||
"family": "inet",
|
||||
"local": "10.66.0.2",
|
||||
"prefixlen": 24,
|
||||
"scope": "global",
|
||||
"label": "wg9",
|
||||
"valid_life_time": 4294967295,
|
||||
"preferred_life_time": 4294967295
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"firewall": "config defaults\n\toption syn_flood\t1\n\toption input\t\tREJECT\n\toption output\t\tACCEPT\n\toption forward\t\tREJECT\n# Uncomment this line to disable ipv6 rules\n#\toption disable_ipv6\t1\n\nconfig zone\n\toption name\t\tlan\n\tlist network\t\t'lan'\n\toption input\t\tACCEPT\n\toption output\t\tACCEPT\n\toption forward\t\tACCEPT\n\nconfig zone\n\toption name\t\twan\n\tlist network\t\t'wan'\n\tlist network\t\t'wan6'\n\toption input\t\tREJECT\n\toption output\t\tACCEPT\n\toption forward\t\tDROP\n\toption masq\t\t1\n\toption mtu_fix\t\t1\n\nconfig forwarding\n\toption src\t\tlan\n\toption dest\t\twan\n\n# We need to accept udp packets on port 68,\n# see https://dev.openwrt.org/ticket/4108\nconfig rule\n\toption name\t\tAllow-DHCP-Renew\n\toption src\t\twan\n\toption proto\t\tudp\n\toption dest_port\t68\n\toption target\t\tACCEPT\n\toption family\t\tipv4\n\n# Allow IPv4 ping\nconfig rule\n\toption name\t\tAllow-Ping\n\toption src\t\twan\n\toption proto\t\ticmp\n\toption icmp_type\techo-request\n\toption family\t\tipv4\n\toption target\t\tACCEPT\n\nconfig rule\n\toption name\t\tAllow-IGMP\n\toption src\t\twan\n\toption proto\t\tigmp\n\toption family\t\tipv4\n\toption target\t\tACCEPT\n\n# Allow DHCPv6 replies\n# see https://github.com/openwrt/openwrt/issues/5066\nconfig rule\n\toption name\t\tAllow-DHCPv6\n\toption src\t\twan\n\toption proto\t\tudp\n\toption dest_port\t546\n\toption family\t\tipv6\n\toption target\t\tACCEPT\n\nconfig rule\n\toption name\t\tAllow-MLD\n\toption src\t\twan\n\toption proto\t\ticmp\n\toption src_ip\t\tfe80::/10\n\tlist icmp_type\t\t'130/0'\n\tlist icmp_type\t\t'131/0'\n\tlist icmp_type\t\t'132/0'\n\tlist icmp_type\t\t'143/0'\n\toption family\t\tipv6\n\toption target\t\tACCEPT\n\n# Allow essential incoming IPv6 ICMP traffic\nconfig rule\n\toption name\t\tAllow-ICMPv6-Input\n\toption src\t\twan\n\toption proto\ticmp\n\tlist icmp_type\t\techo-request\n\tlist icmp_type\t\techo-reply\n\tlist icmp_type\t\tdestination-unreachable\n\tlist icmp_type\t\tpacket-too-big\n\tlist icmp_type\t\ttime-exceeded\n\tlist icmp_type\t\tbad-header\n\tlist icmp_type\t\tunknown-header-type\n\tlist icmp_type\t\trouter-solicitation\n\tlist icmp_type\t\tneighbour-solicitation\n\tlist icmp_type\t\trouter-advertisement\n\tlist icmp_type\t\tneighbour-advertisement\n\toption limit\t\t1000/sec\n\toption family\t\tipv6\n\toption target\t\tACCEPT\n\n# Allow essential forwarded IPv6 ICMP traffic\nconfig rule\n\toption name\t\tAllow-ICMPv6-Forward\n\toption src\t\twan\n\toption dest\t\t*\n\toption proto\t\ticmp\n\tlist icmp_type\t\techo-request\n\tlist icmp_type\t\techo-reply\n\tlist icmp_type\t\tdestination-unreachable\n\tlist icmp_type\t\tpacket-too-big\n\tlist icmp_type\t\ttime-exceeded\n\tlist icmp_type\t\tbad-header\n\tlist icmp_type\t\tunknown-header-type\n\toption limit\t\t1000/sec\n\toption family\t\tipv6\n\toption target\t\tACCEPT\n\nconfig rule\n\toption name\t\tAllow-IPSec-ESP\n\toption src\t\twan\n\toption dest\t\tlan\n\toption proto\t\tesp\n\toption target\t\tACCEPT\n\nconfig rule\n\toption name\t\tAllow-ISAKMP\n\toption src\t\twan\n\toption dest\t\tlan\n\toption dest_port\t500\n\toption proto\t\tudp\n\toption target\t\tACCEPT\n\n\n### EXAMPLE CONFIG SECTIONS\n# do not allow a specific ip to access wan\n#config rule\n#\toption src\t\tlan\n#\toption src_ip\t192.168.45.2\n#\toption dest\t\twan\n#\toption proto\ttcp\n#\toption target\tREJECT\n\n# block a specific mac on wan\n#config rule\n#\toption dest\t\twan\n#\toption src_mac\t00:11:22:33:44:66\n#\toption target\tREJECT\n\n# block incoming ICMP traffic on a zone\n#config rule\n#\toption src\t\tlan\n#\toption proto\tICMP\n#\toption target\tDROP\n\n# port redirect port coming in on wan to lan\n#config redirect\n#\toption src\t\t\twan\n#\toption src_dport\t80\n#\toption dest\t\t\tlan\n#\toption dest_ip\t\t192.168.16.235\n#\toption dest_port\t80\n#\toption proto\t\ttcp\n\n# port redirect of remapped ssh port (22001) on wan\n#config redirect\n#\toption src\t\twan\n#\toption src_dport\t22001\n#\toption dest\t\tlan\n#\toption dest_port\t22\n#\toption proto\t\ttcp\n\n### FULL CONFIG SECTIONS\n#config rule\n#\toption src\t\tlan\n#\toption src_ip\t192.168.45.2\n#\toption src_mac\t00:11:22:33:44:55\n#\toption src_port\t80\n#\toption dest\t\twan\n#\toption dest_ip\t194.25.2.129\n#\toption dest_port\t120\n#\toption proto\ttcp\n#\toption target\tREJECT\n\n#config redirect\n#\toption src\t\tlan\n#\toption src_ip\t192.168.45.2\n#\toption src_mac\t00:11:22:33:44:55\n#\toption src_port\t\t1024\n#\toption src_dport\t80\n#\toption dest_ip\t194.25.2.129\n#\toption dest_port\t120\n#\toption proto\ttcp\n\nconfig zone\n\toption name 'guest'\n\tlist device 'dlguest'\n\nconfig zone\n\toption name 'home'\n\toption device 'br-lan dlhome'\n",
|
||||
"links": {
|
||||
"bonding_masters": {
|
||||
"flags": 0,
|
||||
"type": 0,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"br-lan": {
|
||||
"flags": 4099,
|
||||
"type": 1,
|
||||
"master": "",
|
||||
"bridge": true,
|
||||
"wifi": false
|
||||
},
|
||||
"dlguest": {
|
||||
"flags": 131,
|
||||
"type": 1,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"dlhome": {
|
||||
"flags": 131,
|
||||
"type": 1,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"erspan0": {
|
||||
"flags": 4098,
|
||||
"type": 1,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"eth0": {
|
||||
"flags": 4099,
|
||||
"type": 1,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"gre0": {
|
||||
"flags": 128,
|
||||
"type": 778,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"gretap0": {
|
||||
"flags": 4098,
|
||||
"type": 1,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"ifb7": {
|
||||
"flags": 130,
|
||||
"type": 1,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"ip6_vti0": {
|
||||
"flags": 128,
|
||||
"type": 769,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"ip6gre0": {
|
||||
"flags": 128,
|
||||
"type": 823,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"ip6tnl0": {
|
||||
"flags": 128,
|
||||
"type": 769,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"ip_vti0": {
|
||||
"flags": 128,
|
||||
"type": 768,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"lanp1": {
|
||||
"flags": 899,
|
||||
"type": 1,
|
||||
"master": "br-lan",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"lanp2": {
|
||||
"flags": 899,
|
||||
"type": 1,
|
||||
"master": "br-lan",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"lo": {
|
||||
"flags": 9,
|
||||
"type": 772,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"sit0": {
|
||||
"flags": 128,
|
||||
"type": 776,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"tunl0": {
|
||||
"flags": 128,
|
||||
"type": 768,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
},
|
||||
"wg9": {
|
||||
"flags": 131,
|
||||
"type": 1,
|
||||
"master": "",
|
||||
"bridge": false,
|
||||
"wifi": false
|
||||
}
|
||||
},
|
||||
"devices": {
|
||||
"bonding_masters": {
|
||||
"name": "bonding_masters",
|
||||
"category": "other",
|
||||
"kind": "other",
|
||||
"up": false,
|
||||
"master": "",
|
||||
"members": [
|
||||
],
|
||||
"nets": [
|
||||
],
|
||||
"addrs": [
|
||||
],
|
||||
"logical": "",
|
||||
"proto": "",
|
||||
"zone": ""
|
||||
},
|
||||
"br-lan": {
|
||||
"name": "br-lan",
|
||||
"category": "ethernet",
|
||||
"kind": "bridge",
|
||||
"up": true,
|
||||
"master": "",
|
||||
"members": [
|
||||
"lanp1",
|
||||
"lanp2"
|
||||
],
|
||||
"nets": [
|
||||
"192.168.77.0/24"
|
||||
],
|
||||
"addrs": [
|
||||
"192.168.77.1/24"
|
||||
],
|
||||
"logical": "",
|
||||
"proto": "",
|
||||
"zone": "home"
|
||||
},
|
||||
"dlguest": {
|
||||
"name": "dlguest",
|
||||
"category": "ethernet",
|
||||
"kind": "ethernet",
|
||||
"up": true,
|
||||
"master": "",
|
||||
"members": [
|
||||
],
|
||||
"nets": [
|
||||
"10.20.4.0/22"
|
||||
],
|
||||
"addrs": [
|
||||
"10.20.4.1/22"
|
||||
],
|
||||
"logical": "",
|
||||
"proto": "",
|
||||
"zone": "guest"
|
||||
},
|
||||
"dlhome": {
|
||||
"name": "dlhome",
|
||||
"category": "ethernet",
|
||||
"kind": "ethernet",
|
||||
"up": true,
|
||||
"master": "",
|
||||
"members": [
|
||||
],
|
||||
"nets": [
|
||||
"192.168.50.0/24"
|
||||
],
|
||||
"addrs": [
|
||||
"192.168.50.1/24"
|
||||
],
|
||||
"logical": "",
|
||||
"proto": "",
|
||||
"zone": "home"
|
||||
},
|
||||
"eth0": {
|
||||
"name": "eth0",
|
||||
"category": "wan",
|
||||
"kind": "ethernet",
|
||||
"up": true,
|
||||
"master": "",
|
||||
"members": [
|
||||
],
|
||||
"nets": [
|
||||
"172.17.0.0/16"
|
||||
],
|
||||
"addrs": [
|
||||
"172.17.0.2/16"
|
||||
],
|
||||
"logical": "",
|
||||
"proto": "",
|
||||
"zone": ""
|
||||
},
|
||||
"lanp1": {
|
||||
"name": "lanp1",
|
||||
"category": "ethernet",
|
||||
"kind": "ethernet",
|
||||
"up": true,
|
||||
"master": "br-lan",
|
||||
"members": [
|
||||
],
|
||||
"nets": [
|
||||
],
|
||||
"addrs": [
|
||||
],
|
||||
"logical": "",
|
||||
"proto": "",
|
||||
"zone": ""
|
||||
},
|
||||
"lanp2": {
|
||||
"name": "lanp2",
|
||||
"category": "ethernet",
|
||||
"kind": "ethernet",
|
||||
"up": true,
|
||||
"master": "br-lan",
|
||||
"members": [
|
||||
],
|
||||
"nets": [
|
||||
],
|
||||
"addrs": [
|
||||
],
|
||||
"logical": "",
|
||||
"proto": "",
|
||||
"zone": ""
|
||||
},
|
||||
"wg9": {
|
||||
"name": "wg9",
|
||||
"category": "vpn",
|
||||
"kind": "vpn",
|
||||
"up": true,
|
||||
"master": "",
|
||||
"members": [
|
||||
],
|
||||
"nets": [
|
||||
"10.66.0.0/24"
|
||||
],
|
||||
"addrs": [
|
||||
"10.66.0.2/24"
|
||||
],
|
||||
"logical": "",
|
||||
"proto": "",
|
||||
"zone": ""
|
||||
}
|
||||
},
|
||||
"wan": "eth0",
|
||||
"lan": "br-lan",
|
||||
"zones": [
|
||||
"lan",
|
||||
"wan",
|
||||
"guest",
|
||||
"home"
|
||||
],
|
||||
"servers": {
|
||||
"junk": {
|
||||
"wan": {
|
||||
"dev": "eth0",
|
||||
"auto": true,
|
||||
"zone": "wan",
|
||||
"missing": false
|
||||
},
|
||||
"home": [
|
||||
{
|
||||
"dev": "dlhome",
|
||||
"auto": false,
|
||||
"nets": [
|
||||
"192.168.50.0/24"
|
||||
],
|
||||
"zone": "home",
|
||||
"missing": false
|
||||
}
|
||||
],
|
||||
"nets": [
|
||||
"192.168.50.0/24"
|
||||
],
|
||||
"zones": [
|
||||
"home"
|
||||
]
|
||||
},
|
||||
"max": {
|
||||
"wan": {
|
||||
"dev": "eth0",
|
||||
"auto": true,
|
||||
"zone": "wan",
|
||||
"missing": false
|
||||
},
|
||||
"home": [
|
||||
],
|
||||
"nets": [
|
||||
],
|
||||
"zones": [
|
||||
]
|
||||
},
|
||||
"plain": {
|
||||
"wan": {
|
||||
"dev": "eth0",
|
||||
"auto": true,
|
||||
"zone": "wan",
|
||||
"missing": false
|
||||
},
|
||||
"home": [
|
||||
{
|
||||
"dev": "dlhome",
|
||||
"auto": false,
|
||||
"nets": [
|
||||
"192.168.50.0/24"
|
||||
],
|
||||
"zone": "home",
|
||||
"missing": false
|
||||
},
|
||||
{
|
||||
"dev": "dlguest",
|
||||
"auto": false,
|
||||
"nets": [
|
||||
"10.20.4.0/22"
|
||||
],
|
||||
"zone": "guest",
|
||||
"missing": false
|
||||
}
|
||||
],
|
||||
"nets": [
|
||||
"10.20.4.0/22",
|
||||
"192.168.50.0/24"
|
||||
],
|
||||
"zones": [
|
||||
"home",
|
||||
"guest"
|
||||
]
|
||||
}
|
||||
},
|
||||
"homes": {
|
||||
"j_both": [
|
||||
"192.168.50.0/24"
|
||||
],
|
||||
"j_lan": [
|
||||
"192.168.50.0/24"
|
||||
],
|
||||
"lost": null,
|
||||
"m_net": [
|
||||
],
|
||||
"p_both": [
|
||||
"10.20.4.0/22",
|
||||
"192.168.50.0/24"
|
||||
],
|
||||
"p_lan": [
|
||||
"10.20.4.0/22",
|
||||
"192.168.50.0/24"
|
||||
],
|
||||
"p_lanhome": [
|
||||
"10.20.4.0/22",
|
||||
"192.168.50.0/24"
|
||||
],
|
||||
"p_net": [
|
||||
"10.20.4.0/22",
|
||||
"192.168.50.0/24"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user