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
networkmanager service: support changing the mac-address #23464
Conversation
Set `networking.networkmanager.wifi.macAddress` or `networking.networkmanager.ethernet.macAddress` to one of these values to change your macAddress. * "XX:XX:XX:XX:XX:XX": set the MAC address of the interface. * "permanent": use the permanent MAC address of the device. * "preserve": don’t change the MAC address of the device upon activation. * "random": generate a randomized value upon each connect. * "stable": generate a stable, hashed MAC address. See https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/ for more information
@TomSmeets, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rickynils, @domenkozar and @urkud to be potential reviewers. |
If changing the config affects the service definition, |
@@ -140,6 +144,34 @@ in { | |||
''; | |||
}; | |||
|
|||
ethernet.macAddress = mkOption { | |||
type = types.nullOr (types.either types.str (types.enum ["permanent" "preserve" "random" "stable"])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does null
mean here? Is it different from "preserve"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this so that the networkmanager could choose the default value (if none has been set).
But after checking the blog-post, it might be better to use "preserve"
Update-2017-01-25: with 1.6 release and newer, the default value changed from “permanent” to “preserve” [commit],[bug].
By setting the default to "preserve"
might acctually fix the issue with setting networking.interfaces.wlan0.macAddress
while the networkmanger is used.
I will change the default to "preserve"
}; | ||
|
||
wifi.macAddress = mkOption { | ||
type = types.nullOr (types.either types.str (types.enum ["permanent" "preserve" "random" "stable"])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the type
is exactly the same as for the above option; perhaps it could be factored out and re-used.
Thank you |
Motivation for this change
Setting the MAC-address with
networking.interfaces.wlan0.macAddress
does not work when usingnetworking.networkmanager
.Things done
This commit introduces these options:
networking.networkmanager.wifi.macAddress
and
networking.networkmanager.ethernet.macAddress
Which can be set to these possible values
See https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/ for more information
Notes
The networkmanager service has to be restarted after changing these settings.
This can be done by calling:
Is it possible to do this automatically?
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)