| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -961,27 +961,34 @@ public static String getLinkLocalNetMask() { | |
| return "255.255.0.0"; | ||
| } | ||
|
|
||
| public static String getLinkLocalGateway(String cidr) { | ||
| return getLinkLocalFirstAddressFromCIDR(cidr); | ||
| } | ||
|
|
||
| public static String getLinkLocalGateway() { | ||
| return "169.254.0.1"; | ||
| return getLinkLocalGateway(getLinkLocalCIDR()); | ||
| } | ||
|
|
||
| public static String getLinkLocalCIDR() { | ||
| return "169.254.0.0/16"; | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySame as the comment above, instead of returning a hardcoded value, this method can return the configured CIDR and can make getLinkLocalGateway() above to be consistent with it.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityDo we have access to the configuration here? I don't think so. Therefor I changed it this way.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityLooks good
Sorry, something went wrong.
wido reacted with thumbs up emoji
All reactions
|
||
| } | ||
|
|
||
| public static String[] getLinkLocalIPRange(final int size) { | ||
| if (size > 16 || size <= 0) { | ||
| return null; | ||
| } | ||
| /* reserve gateway */ | ||
| final String[] range = getIpRangeFromCidr(getLinkLocalGateway(), MAX_CIDR - size); | ||
| public static String getLinkLocalFirstAddressFromCIDR(final String cidr) { | ||
| SubnetUtils subnetUtils = new SubnetUtils(cidr); | ||
| return subnetUtils.getInfo().getLowAddress(); | ||
| } | ||
|
|
||
| public static String getLinkLocalAddressFromCIDR(final String cidr) { | ||
| return getLinkLocalFirstAddressFromCIDR(cidr) + "/" + cidr2Netmask(cidr); | ||
| } | ||
|
|
||
| public static String[] getLinkLocalIPRange(final String cidr) { | ||
| final SubnetUtils subnetUtils = new SubnetUtils(cidr); | ||
| final String[] addresses = subnetUtils.getInfo().getAllAddresses(); | ||
| final String[] range = new String[2]; | ||
| range[0] = addresses[1]; | ||
| range[1] = subnetUtils.getInfo().getHighAddress(); | ||
|
|
||
| if (range[0].equalsIgnoreCase(getLinkLocalGateway())) { | ||
| /* remove the gateway */ | ||
| long ip = ip2Long(range[0]); | ||
| ip += 1; | ||
| range[0] = long2Ip(ip); | ||
| } | ||
| return range; | ||
| } | ||
|
|
||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityLooks like libvirtVersion was not being used on this class, is that right?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityNot being used indeed. Dead variable which was never called
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.