Add IPv6 support to netmask and gateway fields#3
Merged
benjamreis merged 1 commit intoxcp-ng:adapt-for-ipv6from Nov 17, 2023
Merged
Add IPv6 support to netmask and gateway fields#3benjamreis merged 1 commit intoxcp-ng:adapt-for-ipv6from
benjamreis merged 1 commit intoxcp-ng:adapt-for-ipv6from
Conversation
Author
|
@benjamreis @stormi In need of review |
benjamreis
requested changes
Nov 16, 2023
benjamreis
left a comment
There was a problem hiding this comment.
You added back an old logic, you only need to check the right field in XAPI depending on IPv6 or not.
Comment on lines
989
to
992
| elif configuration_mode.lower().startswith('dhcp'): | ||
| # For DHCP, find the gateway address by parsing the output from the 'route' command | ||
| if 'bridge' in pif['network']: | ||
| device = pif['network']['bridge'] | ||
| else: | ||
| device = pif['device'] | ||
|
|
||
| device = ShellUtils.MakeSafeParam(device) | ||
|
|
||
| ipre = r'[0-9a-f.:]+' | ||
| ifRE = re.compile(r'\s*inet\s+' + ipre + '\s+netmask\s+(' + ipre + r')\s+broadcast\s+(' + ipre + r')\s*$', | ||
| re.IGNORECASE) | ||
|
|
||
| ifconfig = commands.getoutput("/sbin/ifconfig '"+device+"'").split("\n") | ||
| for line in ifconfig: | ||
| match = ifRE.match(line) | ||
| if match: | ||
| retVal = match.group(1) | ||
| break | ||
|
|
There was a problem hiding this comment.
This code is no longer relevant Whatever the mode the netmask should be read from xapi.
Comment on lines
1020
to
1003
| elif configuration_mode.lower().startswith('dhcp'): | ||
| # For DHCP, find the gateway address by parsing the output from the 'route' command | ||
| if 'bridge' in pif['network']: | ||
| device = pif['network']['bridge'] | ||
| else: | ||
| device = pif['device'] | ||
| routeRE = re.compile(r'([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\s+UG\s+\d+\s+\d+\s+\d+\s+'+device, | ||
| re.IGNORECASE) | ||
|
|
||
| routes = commands.getoutput("/sbin/route -n").split("\n") | ||
| for line in routes: | ||
| match = routeRE.match(line) | ||
| if match: | ||
| retVal = match.group(2) | ||
| break | ||
|
|
621e3fa to
619a489
Compare
benjamreis
requested changes
Nov 17, 2023
benjamreis
left a comment
There was a problem hiding this comment.
Since we maintain patches we try to limit stylistic changes AMAP
| retVal = pif['ipv6_gateway'] if ipv6 else pif['gateway'] | ||
| if retVal: | ||
| break | ||
|
|
619a489 to
5409679
Compare
Co-authored-by: BenjiReis <benjamin.reis@vates.fr> Signed-off-by: Damien Thenot <damien.thenot@vates.tech>
5409679 to
19745b8
Compare
benjamreis
approved these changes
Nov 17, 2023
|
Upstream contribution included in xapi-project#4 |
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.
No description provided.