Skip to content

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

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

Nambrok
Copy link

@Nambrok Nambrok commented Nov 16, 2023

No description provided.

@Nambrok Nambrok marked this pull request as draft November 16, 2023 15:34
@Nambrok Nambrok marked this pull request as ready for review November 16, 2023 15:34
@Nambrok
Copy link
Author

Nambrok commented Nov 16, 2023

@benjamreis @stormi In need of review

@stormi stormi requested review from stormi and benjamreis November 16, 2023 16:05
Copy link

@benjamreis benjamreis left a 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
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

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
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link

@benjamreis benjamreis left a 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Co-authored-by: BenjiReis <[email protected]>
Signed-off-by: Damien Thenot <[email protected]>
@benjamreis benjamreis merged commit fbc84b1 into xcp-ng:adapt-for-ipv6 Nov 17, 2023
@Nambrok Nambrok deleted the adapt-for-ipv6 branch November 17, 2023 12:50
@benjamreis
Copy link

Upstream contribution included in xapi-project#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants