Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d86574b2e75a
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: aac5207b3fd9
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Oct 12, 2019

  1. maintainers: add hexa

    mweinelt committed Oct 12, 2019
    Copy the full SHA
    1c165f5 View commit details
  2. nixos/tests: add babeld

    mweinelt committed Oct 12, 2019
    Copy the full SHA
    97d2959 View commit details
  3. babeld: add test (#71006)

    babeld: add test
    flokli authored Oct 12, 2019
    Copy the full SHA
    aac5207 View commit details
Showing with 157 additions and 1 deletion.
  1. +5 −0 maintainers/maintainer-list.nix
  2. +1 −0 nixos/tests/all-tests.nix
  3. +148 −0 nixos/tests/babeld.nix
  4. +3 −1 pkgs/tools/networking/babeld/default.nix
5 changes: 5 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
@@ -2637,6 +2637,11 @@
githubId = 1401179;
name = "Guanpeng Xu";
};
hexa = {
github = "mweinelt";
githubId = 131599;
name = "Martin Weinelt";
};
hhm = {
email = "heehooman+nixpkgs@gmail.com";
github = "hhm0";
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ in
atd = handleTest ./atd.nix {};
automysqlbackup = handleTest ./automysqlbackup.nix {};
avahi = handleTest ./avahi.nix {};
babeld = handleTest ./babeld.nix {};
bcachefs = handleTestOn ["x86_64-linux"] ./bcachefs.nix {}; # linux-4.18.2018.10.12 is unsupported on aarch64
beanstalkd = handleTest ./beanstalkd.nix {};
beegfs = handleTestOn ["x86_64-linux"] ./beegfs.nix {}; # beegfs is unsupported on aarch64
148 changes: 148 additions & 0 deletions nixos/tests/babeld.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@

import ./make-test.nix ({ pkgs, lib, ...} : {
name = "babeld";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ hexa ];
};

nodes =
{ client = { pkgs, lib, ... }:
{
virtualisation.vlans = [ 10 ];

networking = {
useDHCP = false;
interfaces."eth1" = {
ipv4.addresses = lib.mkForce [ { address = "192.168.10.2"; prefixLength = 24; } ];
ipv4.routes = lib.mkForce [ { address = "0.0.0.0"; prefixLength = 0; via = "192.168.10.1"; } ];
ipv6.addresses = lib.mkForce [ { address = "2001:db8:10::2"; prefixLength = 64; } ];
ipv6.routes = lib.mkForce [ { address = "::"; prefixLength = 0; via = "2001:db8:10::1"; } ];
};
};
};

localRouter = { pkgs, lib, ... }:
{
virtualisation.vlans = [ 10 20 ];

boot.kernel.sysctl."net.ipv4.conf.all.forwarding" = 1;
boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = 1;

networking = {
useDHCP = false;
firewall.enable = false;

interfaces."eth1" = {
ipv4.addresses = lib.mkForce [ { address = "192.168.10.1"; prefixLength = 24; } ];
ipv6.addresses = lib.mkForce [ { address = "2001:db8:10::1"; prefixLength = 64; } ];
};

interfaces."eth2" = {
ipv4.addresses = lib.mkForce [ { address = "192.168.20.1"; prefixLength = 24; } ];
ipv6.addresses = lib.mkForce [ { address = "2001:db8:20::1"; prefixLength = 64; } ];
};
};

services.babeld = {
enable = true;
interfaces.eth2 = {
hello-interval = 1;
type = "wired";
};
extraConfig = ''
local-port-readwrite 33123
import-table 254 # main
export-table 254 # main
in ip 192.168.10.0/24 deny
in ip 192.168.20.0/24 deny
in ip 2001:db8:10::/64 deny
in ip 2001:db8:20::/64 deny
in ip 192.168.30.0/24 allow
in ip 2001:db8:30::/64 allow
in deny
redistribute local proto 2
redistribute local deny
'';
};
};
remoteRouter = { pkgs, lib, ... }:
{
virtualisation.vlans = [ 20 30 ];

boot.kernel.sysctl."net.ipv4.conf.all.forwarding" = 1;
boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = 1;

networking = {
useDHCP = false;
firewall.enable = false;

interfaces."eth1" = {
ipv4.addresses = lib.mkForce [ { address = "192.168.20.2"; prefixLength = 24; } ];
ipv6.addresses = lib.mkForce [ { address = "2001:db8:20::2"; prefixLength = 64; } ];
};

interfaces."eth2" = {
ipv4.addresses = lib.mkForce [ { address = "192.168.30.1"; prefixLength = 24; } ];
ipv6.addresses = lib.mkForce [ { address = "2001:db8:30::1"; prefixLength = 64; } ];
};
};

services.babeld = {
enable = true;
interfaces.eth1 = {
hello-interval = 1;
type = "wired";
};
extraConfig = ''
local-port-readwrite 33123
import-table 254 # main
export-table 254 # main
in ip 192.168.20.0/24 deny
in ip 192.168.30.0/24 deny
in ip 2001:db8:20::/64 deny
in ip 2001:db8:30::/64 deny
in ip 192.168.10.0/24 allow
in ip 2001:db8:10::/64 allow
in deny
redistribute local proto 2
redistribute local deny
'';
};

};
};

testScript =
''
startAll;
$client->waitForUnit("network-online.target");
$localRouter->waitForUnit("network-online.target");
$remoteRouter->waitForUnit("network-online.target");
$localRouter->waitForUnit("babeld.service");
$remoteRouter->waitForUnit("babeld.service");
$localRouter->waitUntilSucceeds("ip route get 192.168.30.1");
$localRouter->waitUntilSucceeds("ip route get 2001:db8:30::1");
$remoteRouter->waitUntilSucceeds("ip route get 192.168.10.1");
$remoteRouter->waitUntilSucceeds("ip route get 2001:db8:10::1");
$client->succeed("ping -c1 192.168.30.1");
$client->succeed("ping -c1 2001:db8:30::1");
$remoteRouter->succeed("ping -c1 192.168.10.2");
$remoteRouter->succeed("ping -c1 2001:db8:10::2");
'';
})
4 changes: 3 additions & 1 deletion pkgs/tools/networking/babeld/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, fetchurl }:
{ stdenv, fetchurl, nixosTests }:

stdenv.mkDerivation rec {
pname = "babeld";
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
makeFlags="PREFIX=$out ETCDIR=$out/etc"
'';

passthru.tests.babeld = nixosTests.babeld;

meta = {
homepage = http://www.pps.univ-paris-diderot.fr/~jch/software/babel/;
description = "Loop-avoiding distance-vector routing protocol";