-
Notifications
You must be signed in to change notification settings - Fork 2
Add IPv6 support to netmask and gateway fields #3
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
Conversation
@benjamreis @stormi In need of review |
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.
You added back an old logic, you only need to check the right field in XAPI depending on IPv6 or not.
XSConsoleData.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is no longer relevant Whatever the mode the netmask should be read from xapi.
XSConsoleData.py
Outdated
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 | ||
|
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.
Same as above.
621e3fa
to
619a489
Compare
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.
Since we maintain patches we try to limit stylistic changes AMAP
if retVal: | ||
break | ||
|
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.
same
619a489
to
5409679
Compare
Co-authored-by: BenjiReis <[email protected]> Signed-off-by: Damien Thenot <[email protected]>
5409679
to
19745b8
Compare
Upstream contribution included in xapi-project#4 |
No description provided.