Add autodetection of MAC address, NTP improvements, oui.txt cleanup#3
Open
tlhackque wants to merge 1 commit intoadeverteuil:masterfrom
Open
Add autodetection of MAC address, NTP improvements, oui.txt cleanup#3tlhackque wants to merge 1 commit intoadeverteuil:masterfrom
tlhackque wants to merge 1 commit intoadeverteuil:masterfrom
Conversation
1) use ip link or ifconfig to select a MAC address if not user-specified 2) handle upper-case hex input 3) allow user to specify an NTP server 4) if ntpq fails, try fallback to ntpdate. (Current ntp servers often block 'rv'.commands.) 5) ntp utilities will try all IP addresses assigned to a host. Deal with multiple responses. 6) If oui.txt is downloaded, place it in /tmp and remove it on exit. 7) Fix use of undefined 'date' (instead of 'clock') in GID, use LSB of SHA per RFC 8) Use variables for defaults to simplify customization 9) Default to not prompting; use -i for prompts. 10) Add usage and command line options. 11) Ensure all errors reported to stderr. Fully validate input. 12) Suppress leading zeros in ULA 13) Don't depend on GNU sed's extended REs or GNU echo -ne 14) By default, only output generated ULA. -v for verbose mode. 15) Add option to get (download) a copy of oui.txt Note that ntpq/ntpdate can take a while to get a timestamp. ntpq may timeout, but the script will try to recover using ntpdate. Manually providing a MAC address and/or timestamp should not be necessary. Doing so without understanding the RFC is likely to reduce the uniqueness of the generated address. -i is provided for advanced users. The MAC autoselection uses the first interface with an ethernet address. The address of another interface can be used safely. However, since the purpose is only to seed a hash to identify the network, there is no reason to prefer one over another. The timestamp ensures that a given interface can generate more than one ULA. The only reason to set it manually is deterministic debugging .
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes several bugs - the most serious of which is failure to include
the NTP timestamp in the result. Crashes due to invalid input are also
fixed. Usage is simplified so that it most cases, no user input is required.
However, no functionality is lost: prompts and overrides are still available.
Changes include:
block 'rv'.commands.)
Deal with multiple responses.
Note that ntpq/ntpdate can take a while to get a timestamp.
ntpq may timeout, but the script will try to recover using ntpdate.
Manually providing a MAC address and/or timestamp should not be
necessary. Doing so without understanding the RFC is likely to
reduce the uniqueness of the generated address. -i is provided
for advanced users.
The MAC autoselection uses the first interface with an ethernet
address. The address of another interface can be used safely.
However, since the purpose is only to seed a hash to identify
the network, there is no reason to prefer one over another.
The timestamp ensures that a given interface can generate more than
one ULA. The only reason to set it manually is deterministic
debugging.
Closes #2 - Part 1 (MAC case). Part two is not an issue: a broadcast addresses can never be a physical MAC address.