From c082d90be6396149404704e127f10ec7c9aa79ad Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Mon, 30 Dec 2019 20:56:03 +0100 Subject: Wait for link-local address for DHCPv6 dhclient -6 fails if the interface to be configures has no link-local address. This is especially problematic when only DHCPv6 is used (e.g., --ip=none --ip6=dhcp), because the wait for a DHCPv4 lease is usually ample time for the LL address to become available on the IPv6 link. The LL address must not be tenative. Therefore, this patch implements waiting for a non-tentative link-local address in fnet for DHCPv6 configured interfaces. The command fnet waitll waits for an LL address on the interface . Currently, the maximum waiting time is 30 seconds, and the kernel is polled through rtnetlink every 500 milliseconds. These values seem sufficient for virtual bridged networks, e.g., libvirt NAT networks. --- src/fnet/main.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/fnet/main.c') diff --git a/src/fnet/main.c b/src/fnet/main.c index 890f842f6..3ef500b5e 100644 --- a/src/fnet/main.c +++ b/src/fnet/main.c @@ -47,6 +47,7 @@ static void usage(void) { printf("\tfnet config mac addr\n"); printf("\tfnet config ipv6 dev ip\n"); printf("\tfnet ifup dev\n"); + printf("\tfnet waitll dev\n"); } int main(int argc, char **argv) { @@ -141,6 +142,9 @@ printf("\n"); else if (argc == 5 && strcmp(argv[1], "config") == 0 && strcmp(argv[2], "ipv6") == 0) { net_if_ip6(argv[3], argv[4]); } + else if (argc == 3 && strcmp(argv[1], "waitll") == 0) { + net_if_waitll(argv[2]); + } else { fprintf(stderr, "Error fnet: invalid arguments\n"); return 1; -- cgit v1.2.3-70-g09d2