Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate random MAC addresses host-side #128

Open
AdamBromiley opened this issue Sep 27, 2022 · 0 comments
Open

Generate random MAC addresses host-side #128

AdamBromiley opened this issue Sep 27, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@AdamBromiley
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Currently, /kernel/patches/90-netkit_support.patch is used to patch the kernel into generating a constant MAC address for a network interface by computing the SHA-1 hash of the hostname and interface name. If the user desires a random MAC address (which is the standard functionality but noticeably slower), they must recompile the kernel with the CONFIG_UML_NET_RANDOM_MAC configuration option.

The user must be given this option without having to recompile the kernel, and potentially be able to specify a constant MAC address too.

Describe the solution you'd like
vstart's --ethN=DOMAIN option should be able to specify a MAC address too, such as --ethN=[HW_ADDR],DOMAIN. This must be optional. To avoid conflict with TAP specifications (which also use comma delimiters) the code must be able to distinguish between the two; this should be doable without breaking backwards compatibility since TAP specifications use two commas.

Passing the address to the kernel is done as the following (i.e., utilising the second parameter):

ethN=daemon,<mac-address>,,/path/to/socket

This should be an option for vconf too.

If the user desires, they should be able to specify random MAC addresses with --random-mac (or similarly named option). This will apply to all interfaces that lack a provided address. Because this function cannot trigger the relevant code in the kernel, the host machine will instead generate the MAC address in vstart and pass it to the kernel command line as is the case with a user-provided address. This will be quicker than the UML kernel's random generator.

Describe alternatives you've considered
Keep the patch. This is not an ideal solution since the user may not be aware of the patch (instead assuming a standard UML kernel) and the patch will require constant updating in-line with kernel development to prevent breaking.

@AdamBromiley AdamBromiley added the enhancement New feature or request label Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant