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

Read network interfaces from system and remove invalid characters from hostnames #17

Merged
merged 1 commit into from
Mar 6, 2017

Conversation

WolfspiritM
Copy link
Contributor

On Systems with a bond the interface for example is called "ovs_bond0" which breaks the current behaviour of hardcoded interfaces. This PR changes the way adapters are handled by reading out all the interfaces from the system instead of keeping a hardcoded list.

Also this PR removes all invalid characters from the hostname as I had trouble with a host that had an underscore like "host_name". Underscores are not allowed to be in hostnames and bind won't load the zone if that hostname is used.
(See: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_hostnames )

gsub(/([^a-zA-Z0-9-]*|^[-]*|[-]*$)/,"",NAME)

Means: Replace every character sequence that is not a alphanumeric or a hyphen OR sequence of hyphens at the begining OR at the end of NAME with an empty string.

@gclayburg
Copy link
Owner

Sorry @WolfspiritM I guess I missed this PR. I'll try it out on my DSM 5.1 system before merging it. Maybe in the next few days or so I should have some time.

@gclayburg gclayburg merged commit 3c93434 into gclayburg:master Mar 6, 2017
gclayburg added a commit that referenced this pull request Mar 6, 2017
Changes from WolfSpriritM

#17
gclayburg added a commit that referenced this pull request Mar 7, 2017
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