From 0810ed2da402f425ac98bc82c44871d55fbd3321 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Wed, 2 Jul 2025 20:12:19 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Updated=20Router=20Config=20at?= =?UTF-8?q?=20Wed=2002=20Jul=202025=2008:12:19=20PM=20EDT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- os/routers/glmain/config.yaml | 20 ++++++++- os/routers/glmain/gen-mappings.py | 15 ++++++- os/routers/glmain/output/etc/ethers | 9 ++++- os/routers/glmain/output/summary.yaml | 15 ++++++- os/routers/glmain/output/white.list | 58 +++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 4 deletions(-) create mode 100644 os/routers/glmain/output/white.list diff --git a/os/routers/glmain/config.yaml b/os/routers/glmain/config.yaml index eb88a7e..05ff959 100755 --- a/os/routers/glmain/config.yaml +++ b/os/routers/glmain/config.yaml @@ -102,8 +102,21 @@ networks: mac: 'D8:BE:65:F2:ED:18' justMac: true - name: 'lgtv-bedroom' - mac: '94:83:C4:41:77:B0' + mac: 'A8:A2:37:27:3F:8A' justMac: true + - name: 'pablo' + mac: 'B0:4A:39:F7:E5:8E' + justMac: true + - name: 'pod-eddie' + mac: '40:ED:CF:9D:C1:01' + justMac: true + - name: 'brother-printer' + mac: '00:1B:A9:B9:37:B7' + justMac: true + - name: 'ipad-eddie' + mac: 'F0:DB:F8:4C:96:B9' + justMac: true + router: - name: 'gl-basement' mac: '94:83:C4:31:D5:CE' @@ -113,6 +126,9 @@ networks: mac: '94:83:C4:41:77:29' - name: 'velica-node2' mac: '94:83:C4:41:77:B0' + - name: 'extender' + id: 100 + mac: '5C:E9:31:00:65:61' devices: - name: 'fwlaptop' mac: '14:AC:60:29:85:4D' @@ -126,4 +142,6 @@ networks: mac: 'E0:92:5C:20:F7:21' - name: 'levaphone' mac: 'EC:28:D3:53:30:59' + - name: 'koriephone' + mac: 'D8:DC:40:DC:D4:A0' diff --git a/os/routers/glmain/gen-mappings.py b/os/routers/glmain/gen-mappings.py index cad5abc..e8b53a0 100755 --- a/os/routers/glmain/gen-mappings.py +++ b/os/routers/glmain/gen-mappings.py @@ -10,6 +10,7 @@ OUTPUT_FOLDER = BASE_PATH / "output" DNSMASQ_CONF = OUTPUT_FOLDER / "etc/dnsmasq.conf" ETHERS = OUTPUT_FOLDER / "etc/ethers" SUMMARY = OUTPUT_FOLDER / "summary.yaml" +WHITELIST = OUTPUT_FOLDER / "white.list" shutil.rmtree(OUTPUT_FOLDER) DNSMASQ_CONF.parent.mkdir(exist_ok=True, parents=True) @@ -42,6 +43,8 @@ def cap1_and_join(*args: str) -> str: with CONFIG_FILE.open('r') as fp: settings = yaml.safe_load(fp) +mac_addrs = set() + with DNSMASQ_CONF.open('w') as dfp, SUMMARY.open('w') as sfp, ETHERS.open('w') as efp: for sub_domain, configs in settings['networks'].items(): default_values = defaults.get(sub_domain, {}) @@ -49,14 +52,22 @@ with DNSMASQ_CONF.open('w') as dfp, SUMMARY.open('w') as sfp, ETHERS.open('w') a sfp.write(f'\n{cap1_and_join(sub_domain)}:') efp.write(f'#{cap1_and_join(sub_domain)}\n') ip_suffix = 0 + seen_nets = set() for dvc in configs: if dvc.get('id'): ip_suffix = dvc.get('id') else: ip_suffix += 1 + for _ in range(254): + if ip_suffix in seen_nets: + ip_suffix += 1 + else: + break + seen_nets.add(ip_suffix) dvc = {**default_values, **dvc} mac = dvc['mac'] name = dvc['name'] + mac_addrs.add(mac) sfp.write(f'\n {cap1_and_join(name)}:') ip = f"{ip_prefix}{ip_suffix}" host = f"{name}.{sub_domain}.{root_domain}" @@ -75,4 +86,6 @@ with DNSMASQ_CONF.open('w') as dfp, SUMMARY.open('w') as sfp, ETHERS.open('w') a ip = config['ip'] for domain in config['domains']: dfp.write(f"address=/{domain}/{ip}\n") - dfp.write(f"address=/.{domain}/{ip}\n") \ No newline at end of file + dfp.write(f"address=/.{domain}/{ip}\n") + +WHITELIST.write_text('\n'.join(mac_addrs)) \ No newline at end of file diff --git a/os/routers/glmain/output/etc/ethers b/os/routers/glmain/output/etc/ethers index e399ea2..09d3736 100644 --- a/os/routers/glmain/output/etc/ethers +++ b/os/routers/glmain/output/etc/ethers @@ -79,7 +79,11 @@ F0:70:4F:54:F3:F0 samsuntv-livingroom.apl.internal 3C:E9:0E:62:14:D8 leviot-humid1.apl.internal 1C:9D:C2:39:61:F8 leviot-humid2.apl.internal D8:BE:65:F2:ED:18 amzn-bedroom.apl.internal -94:83:C4:41:77:B0 lgtv-bedroom.apl.internal +A8:A2:37:27:3F:8A lgtv-bedroom.apl.internal +B0:4A:39:F7:E5:8E pablo.apl.internal +40:ED:CF:9D:C1:01 pod-eddie.apl.internal +00:1B:A9:B9:37:B7 brother-printer.apl.internal +F0:DB:F8:4C:96:B9 ipad-eddie.apl.internal #Router 94:83:C4:31:D5:CE 10.0.16.1 94:83:C4:31:D5:CE gl-basement.router.internal @@ -89,6 +93,8 @@ D8:BE:65:F2:ED:18 amzn-bedroom.apl.internal 94:83:C4:41:77:29 velica-node1.router.internal 94:83:C4:41:77:B0 10.0.16.4 94:83:C4:41:77:B0 velica-node2.router.internal +5C:E9:31:00:65:61 10.0.16.100 +5C:E9:31:00:65:61 extender.router.internal #Devices 14:AC:60:29:85:4D fwlaptop.devices.internal F8:E4:3B:36:0F:E4 sumomac.devices.internal @@ -96,3 +102,4 @@ F8:E4:3B:36:0F:E4 sumomac.devices.internal E0:0A:F6:79:C6:E9 vitapc.devices.internal E0:92:5C:20:F7:21 vitaphone.devices.internal EC:28:D3:53:30:59 levaphone.devices.internal +D8:DC:40:DC:D4:A0 koriephone.devices.internal diff --git a/os/routers/glmain/output/summary.yaml b/os/routers/glmain/output/summary.yaml index 33eb322..c16090f 100644 --- a/os/routers/glmain/output/summary.yaml +++ b/os/routers/glmain/output/summary.yaml @@ -125,6 +125,14 @@ Apl: host: "amzn-bedroom.apl.internal" Lgtv-bedroom: host: "lgtv-bedroom.apl.internal" + Pablo: + host: "pablo.apl.internal" + Pod-eddie: + host: "pod-eddie.apl.internal" + Brother-printer: + host: "brother-printer.apl.internal" + Ipad-eddie: + host: "ipad-eddie.apl.internal" Router: Gl-basement: ip: "10.0.16.1" @@ -138,6 +146,9 @@ Router: Velica-node2: ip: "10.0.16.4" host: "velica-node2.router.internal" + Extender: + ip: "10.0.16.100" + host: "extender.router.internal" Devices: Fwlaptop: host: "fwlaptop.devices.internal" @@ -150,4 +161,6 @@ Devices: Vitaphone: host: "vitaphone.devices.internal" Levaphone: - host: "levaphone.devices.internal" \ No newline at end of file + host: "levaphone.devices.internal" + Koriephone: + host: "koriephone.devices.internal" \ No newline at end of file diff --git a/os/routers/glmain/output/white.list b/os/routers/glmain/output/white.list new file mode 100644 index 0000000..bb2d472 --- /dev/null +++ b/os/routers/glmain/output/white.list @@ -0,0 +1,58 @@ +30:30:F9:DC:BE:7C +3C:E9:0E:62:14:D8 +E0:92:5C:20:F7:21 +F0:DB:F8:4C:96:B9 +9C:8E:CD:25:83:1F +B0:4A:39:F7:E5:8E +DC:A6:32:92:B2:79 +30:30:F9:DC:A8:18 +D8:DC:40:DC:D4:A0 +3C:7C:3F:1E:B7:A0 +74:56:3C:CA:E2:ED +A0:60:32:03:86:8A +34:6F:24:CA:70:57 +EC:71:DB:0C:5A:6E +5C:E9:31:00:65:61 +6C:BF:B5:01:E9:86 +E4:5F:01:A2:8D:BC +CC:6A:10:8B:7D:D3 +9C:BF:0D:00:56:51 +B8:D6:1A:8C:4C:DC +20:DF:B9:71:55:9C +48:E1:5C:5B:CB:A3 +6C:BF:B5:01:E9:87 +94:83:C4:31:D5:CE +04:99:B9:88:ED:3B +68:1D:EF:26:B7:6C +00:A0:98:3D:7C:C8 +48:9E:9D:4A:32:80 +EC:28:D3:53:30:59 +30:30:F9:DA:C7:A4 +F0:70:4F:54:F3:F0 +94:83:C4:41:77:29 +48:9E:BD:CB:07:E3 +34:60:F9:D7:51:3F +44:61:32:FC:10:EC +04:99:B9:86:2D:AE +64:B7:08:28:56:F4 +64:B7:08:28:52:50 +60:74:F4:4D:B8:C5 +B8:27:EB:F7:44:4E +58:47:CA:71:D8:E6 +B8:D6:1A:8A:5F:F4 +40:ED:CF:9D:C1:01 +1C:9D:C2:39:61:F8 +EC:71:DB:2E:6F:F5 +94:83:C4:41:77:B0 +DC:4F:22:24:0C:E4 +14:AC:60:29:85:4D +7C:83:34:B8:7B:43 +00:1B:A9:B9:37:B7 +D8:BE:65:F2:ED:18 +4E:F6:9C:7C:56:33 +94:83:C4:41:77:BA +A8:A2:37:27:3F:8A +F8:E4:3B:36:0F:E4 +E8:6B:EA:23:F9:14 +C8:2B:96:1D:DA:B4 +E0:0A:F6:79:C6:E9 \ No newline at end of file