Skip to content
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

Fixed IPv6 host renaming #7275

Merged
merged 4 commits into from Sep 2, 2017
Merged

Conversation

Zmegolaz
Copy link
Member

@Zmegolaz Zmegolaz commented Aug 31, 2017

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

Renaming a host which contains an IPv6 address fails, as it tries to move a directory with the exact hostname. The actual directory name has some characters escaped.
This commit updates the renamehost() function to trim [] and replace : with _, in the same way as rrd_name() in includes/rrdtool.inc.php does.


This change is Reviewable

@murrant
Copy link
Member

murrant commented Aug 31, 2017

Thanks for the fix.

I just checked and there are other areas of the code that would be affected by the sanitized ipv6 address directories.

I think the best fix would be to implement a new funciton get_rrd_dir($hostname) or something.

@Zmegolaz
Copy link
Member Author

I was afraid of that. Just to be clear, the directories are already sanitized in the current code when first adding a device, this patch makes it possible to rename to/from that.

Would you like me to try to find all other places? I'm very new to LibreNMS, but I can give it a shot.

@murrant
Copy link
Member

murrant commented Aug 31, 2017

That would be great.

Basically, you are looking for $config['rrd_dir'] . $hostname the second variable could be a lot of things but should be the hostname.

@Zmegolaz
Copy link
Member Author

Zmegolaz commented Sep 1, 2017

I think I've found all places now. I haven't been able to test every thing I changed, since I don't have any place to add all applications. But all automatic tests passed at least. :)

Please let me know if you find anything weird.

Copy link
Member

@laf laf left a comment

Choose a reason for hiding this comment

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

lgtm

@scrutinizer-notifier
Copy link

The inspection completed: No new issues

@murrant
Copy link
Member

murrant commented Sep 2, 2017

Looks great, thanks @Zmegolaz

@murrant murrant merged commit 5441baf into librenms:master Sep 2, 2017
@Zmegolaz Zmegolaz deleted the rename_ipv6_host branch September 4, 2017 06:59
@lock
Copy link

lock bot commented May 17, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

@lock lock bot locked as resolved and limited conversation to collaborators May 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants