-
Notifications
You must be signed in to change notification settings - Fork 144
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
Fix generate_static_mac #781
Conversation
@yaazkal this one now tests fine for me. Test it too please. |
I've tested and nothing seems broken. Just for documentation, can you please explain with examples what is the behavior before and after the patch @tschettervictor ? |
Before the patch there is no option for a jail with the patch, the jail will be assigned a static mac based on the interface Mac and jail name. the Mac should always be the same for the same combo of interface/jailname pair per server. |
ok, but why the PR says fix? Is it fixing PR #725 ? |
Oh sorry. Yes it does expand from #725 The old version would generate it but it would not hash the interface MAC meaning that the MAC prefix would always be the same for interfaces like bridge0 bridge1 bridge2 which is unacceptable. This PR hashes the full MAC of the interface resulting in a different one for every interface. |
Ok, thanks for the clarification. To put it on an example and to understand the logic behind this: If I have my host interface |
The prefix will be a result of the following code. Which result in And the suffix is the same as above, only instead of the interface, the jail name is hashed. |
sorry for missing then last character of the vtnet0 MAC, does that change the result? (I've just edited the missing part) |
Yes it will change. if it is a "b" for example, the MAC would then be 14:0a:46 |
I'm getting this |
That is the correct prefix for the corrected MAC above. |
|
I think it's fairly random, as each server (if bridges are created) creates them with unique MACs. Also, each servers MAC is unique so the hashed value is also unique. |
ok, that makes sense now. Thanks for the clarification. I'll merge. |
I've updated the generate_static_mac function to hash the MAC of the host for the prefix. This is helpful when using interfaces such as bridge0, bridge1 etc.. which all have the same prefix.
This ensures that the MAC will always be unique for each IF/JAIL combo