From 3540f594b142c52fef05716e3364137caafea16f Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 25 Sep 2022 16:51:13 +0100 Subject: [PATCH] address service: rename addr->address & add prefixLength these names are consistent with nixos --- pkgs/liminix-tools/default.nix | 14 ++++++++------ tests/pppoe/configuration.nix | 4 ++-- tests/smoke/configuration.nix | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pkgs/liminix-tools/default.nix b/pkgs/liminix-tools/default.nix index 3d5858c..5f5ddae 100644 --- a/pkgs/liminix-tools/default.nix +++ b/pkgs/liminix-tools/default.nix @@ -66,12 +66,14 @@ in { } // { inherit device; }; - address = interface: { family, addr } @ args: oneshot { - dependencies = [ interface ]; - name = "${interface.device}.addr.${addr}"; - up = "ip address add ${addr} dev ${interface.device} "; - down = "ip address del ${addr} dev ${interface.device} "; - }; + address = interface: { family, prefixLength, address } @ args: + let inherit (builtins) toString; + in oneshot { + dependencies = [ interface ]; + name = "${interface.device}.addr.${address}"; + up = "ip address add ${address}/${toString prefixLength} dev ${interface.device} "; + down = "ip address del ${address}/${toString prefixLength} dev ${interface.device} "; + }; udhcpc = callPackage ./networking/udhcpc.nix {}; odhcpc = interface: { ... } @ args: longrun { name = "${interface.device}.odhcp"; diff --git a/tests/pppoe/configuration.nix b/tests/pppoe/configuration.nix index 75193ed..c002aca 100644 --- a/tests/pppoe/configuration.nix +++ b/tests/pppoe/configuration.nix @@ -8,8 +8,8 @@ in rec { in bundle { name = "loopback"; contents = [ - (address iface { family = "inet4"; addr ="127.0.0.1";}) - (address iface { family = "inet6"; addr ="::1";}) + (address iface { family = "inet4"; address ="127.0.0.1"; prefixLength = 8;}) + (address iface { family = "inet6"; address ="::1"; prefixLength = 128;}) ]; }; diff --git a/tests/smoke/configuration.nix b/tests/smoke/configuration.nix index e56d8ff..2696c8c 100644 --- a/tests/smoke/configuration.nix +++ b/tests/smoke/configuration.nix @@ -8,8 +8,8 @@ in rec { in bundle { name = "loopback"; contents = [ - (address iface { family = "inet4"; addr ="127.0.0.1";}) - (address iface { family = "inet6"; addr ="::1";}) + (address iface { family = "inet4"; address ="127.0.0.1"; prefixLength = 8;}) + (address iface { family = "inet6"; address ="::1"; prefixLength = 128;}) ]; }; services.dhcpv4 =