diff --git a/kernel/run.py b/kernel/run.py index ff588750..1010909f 100644 --- a/kernel/run.py +++ b/kernel/run.py @@ -49,6 +49,7 @@ def get_network_config(workers): config['tap{}'.format(2*i)] = { 'mid': i, 'mac': '56:b4:44:e9:62:d{:x}'.format(i), + 'ip' : f"172.31.0.1{i}" } return config @@ -215,8 +216,10 @@ def build_kernel(args): build_args = ['build', '--target', KERNEL_TARGET] if args.no_kfeatures: build_args += ["--no-default-features"] + log(" - enable feature --no-default-features") for feature in args.kfeatures: build_args += ['--features', feature] + log(" - enable feature {}".format(feature)) build_args += CARGO_DEFAULT_ARGS build_args += CARGO_NOSTD_BUILD_ARGS if args.verbose: @@ -233,6 +236,16 @@ def build_user_libraries(args): build_args += ["--features", "rumprt"] if args.nic == "virtio-net-pci": build_args += ["--features", "virtio"] + log(" - enable feature virtio") + + for featurelist in args.ufeatures: + for feature in featurelist.split(',') : + if ':' in feature: + mod_part, feature_part = feature.split(':') + if "libvibrio" == mod_part: + log(" - enable feature {}".format(feature_part)) + build_args += ['--features', feature_part] + # else: use e1000 / wm0 build_args += CARGO_DEFAULT_ARGS build_args += CARGO_NOSTD_BUILD_ARGS @@ -259,18 +272,21 @@ def build_userspace(args): if not (USR_PATH / module).exists(): log("User module {} not found, skipping.".format(module)) continue + log("build user-space module {}".format(module)) with local.cwd(USR_PATH / module): with local.env(RUSTFLAGS=USER_RUSTFLAGS): with local.env(RUST_TARGET_PATH=USR_PATH.absolute()): build_args = build_args_default.copy() - for feature in args.ufeatures: - if ':' in feature: - mod_part, feature_part = feature.split(':') - if module == mod_part: - build_args += ['--features', feature_part] - else: - build_args += ['--features', feature] - log("Build user-module {}".format(module)) + for featurelist in args.ufeatures: + for feature in featurelist.split(',') : + if ':' in feature: + mod_part, feature_part = feature.split(':') + if module == mod_part: + log(" - enable feature {}".format(feature_part)) + build_args += ['--features', feature_part] + else: + log(" - enable feature {}".format(feature)) + build_args += ['--features', feature] if args.verbose: print("cd {}".format(USR_PATH / module)) print("RUSTFLAGS={} RUST_TARGET_PATH={} cargo ".format( @@ -742,8 +758,10 @@ def configure_network(args): assert args.workers <= MAX_WORKERS, "Too many workers, can't configure network" sudo[ip[['link', 'add', 'br0', 'type', 'bridge']]]() sudo[ip[['addr', 'add', NETWORK_INFRA_IP, 'brd', '+', 'dev', 'br0']]]() + for _, ncfg in zip(range(0, args.workers), NETWORK_CONFIG): sudo[tunctl[['-t', ncfg, '-u', user, '-g', group]]]() + sudo[ip[['link', 'set', 'address', NETWORK_CONFIG[ncfg]['mac'], 'dev', ncfg]]]() sudo[ip[['link', 'set', ncfg, 'up']]](retcode=(0, 1)) sudo[brctl[['addif', 'br0', ncfg]]]() sudo[ip[['link', 'set', 'br0', 'up']]](retcode=(0, 1)) diff --git a/kernel/tests/dhcpd.conf b/kernel/tests/dhcpd.conf index 26e798af..929c5f1e 100644 --- a/kernel/tests/dhcpd.conf +++ b/kernel/tests/dhcpd.conf @@ -5,7 +5,7 @@ option domain-name-servers ns1.example.org, ns2.example.org; ddns-update-style none; subnet 172.31.0.0 netmask 255.255.255.0 { - range 172.31.0.12 172.31.0.16; + range 172.31.0.118 172.31.0.118; option routers 172.31.0.20; option subnet-mask 255.255.255.0; default-lease-time 1; @@ -20,4 +20,34 @@ host nrk1 { host nrk2 { hardware ethernet 56:b4:44:e9:62:d1; fixed-address 172.31.0.11; +} + +host nrk3 { + hardware ethernet 56:b4:44:e9:62:d2; + fixed-address 172.31.0.12; +} + +host nrk4 { + hardware ethernet 56:b4:44:e9:62:d3; + fixed-address 172.31.0.13; +} + +host nrk5 { + hardware ethernet 56:b4:44:e9:62:d4; + fixed-address 172.31.0.14; +} + +host nrk6 { + hardware ethernet 56:b4:44:e9:62:d5; + fixed-address 172.31.0.15; +} + +host nrk7 { + hardware ethernet 56:b4:44:e9:62:d6; + fixed-address 172.31.0.16; +} + +host nrk8 { + hardware ethernet 56:b4:44:e9:62:d7; + fixed-address 172.31.0.17; } \ No newline at end of file