-
Gary Wong authored
Right now, the only addresses it knows are allocated are anything assigned in the interfaces table with a "ctrl" role, and anything in the dynamic pool in the virt_node_public_addr table. (And the reserved network and broadcast addresses.) This needs to be extended to anything else we know about! By default, the output is supposed to be easy to parse and simply displays the first available address. More than one available address can be requested with the "-n" option (e.g. "-n 10" will show the first ten unallocated addresses). "-n 0" will show every free address on the subnet. The "-a" option (meant more for human consumption) also describes allocated addresses. For instance, "ctrladdr -a -n 0" will show every address on the control net, and what it's used for (if anything). "-r" will compress ranges of consecutive free addresses onto a single line. To test whether a particular address is in use, invoke it as (e.g.) "ctrladdr -t 155.98.36.1". This will give an exit code of 0 if the address is available, and 1 if used. Any other options are ignored if "-t" is specified.
9047e21a