Skip to content

Commit

Permalink
Merge pull request torvalds#278 from libos-nuse/fix-ipv6-on-dhcp
Browse files Browse the repository at this point in the history
lkl: avoid dhcp client running if ipv6 addr is specified
  • Loading branch information
thehajime authored Dec 15, 2016
2 parents 4f1cc24 + b6cc229 commit 7d748bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 4 additions & 5 deletions tools/lkl/lib/hijack/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ hijack_init(void)
cpu_set_t ori_cpu;
char *offload1 = getenv("LKL_HIJACK_OFFLOAD");
int offload = 0;
/* with dhcp client by default */
char *boot_cmdline = "ip=dhcp";
char boot_cmdline[256] = "\0";

memset(&nd_args, 0, sizeof(struct lkl_netdev_args));
if (!debug) {
Expand Down Expand Up @@ -325,9 +324,9 @@ hijack_init(void)
if (single_cpu_mode == 1)
PinToFirstCpu(&ori_cpu);

/* clear cmdline if non-dhcp case */
if ((ip && strcmp(ip, "dhcp")) || (nd_id == -1))
boot_cmdline = "";
/* set cmdline if dhcp case */
if ((ip && !strcmp(ip, "dhcp")) && (nd_id != -1))
snprintf(boot_cmdline, sizeof(boot_cmdline), "ip=dhcp");

ret = lkl_start_kernel(&lkl_host_ops, 64 * 1024 * 1024UL, boot_cmdline);
if (ret) {
Expand Down
3 changes: 1 addition & 2 deletions tools/lkl/tests/net-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ static int test_net_init(int argc, char **argv)
char *debug = getenv("LKL_DEBUG");
int ret, nd_id = -1, nd_ifindex = -1;
struct lkl_netdev *nd = NULL;
/* with dhcp client by default */
char boot_cmdline[256] = "\0";

if (argc < 3) {
Expand Down Expand Up @@ -160,7 +159,7 @@ static int test_net_init(int argc, char **argv)
lkl_host_ops.print = NULL;


if (ip && !strcmp(ip, "dhcp"))
if ((ip && !strcmp(ip, "dhcp")) && (nd_id != -1))
snprintf(boot_cmdline, sizeof(boot_cmdline), "ip=dhcp");

ret = lkl_start_kernel(&lkl_host_ops, 64 * 1024 * 1024, boot_cmdline);
Expand Down

0 comments on commit 7d748bc

Please sign in to comment.