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

llmnrd: Detect hostname changes #23

Closed
tbetker opened this issue Feb 28, 2017 · 2 comments
Closed

llmnrd: Detect hostname changes #23

tbetker opened this issue Feb 28, 2017 · 2 comments
Assignees

Comments

@tbetker
Copy link

tbetker commented Feb 28, 2017

If the hostname is changed, e.g., by the hostname command, llmnrd will still use the old one. We can poll /proc/sys/kernel/hostname to get notified if the hostname is written, though; systemd does this as well.

See the attached patch for suggestions. It is more of a hack for now (and probably has to be restructured), but it works for us.

llmnrd-poll-hostname.patch.txt

@tklauser tklauser self-assigned this Feb 28, 2017
@tklauser
Copy link
Owner

tklauser commented Feb 28, 2017

Thanks a lot for the patch.

I see one issue in case the hostname was set via command line parameter -H and then the system host name gets changed, we'll still call hostname_change_handle(). If now the new hostname is longer than the one being set via command line, we'll overrun the buffer in the `strcpy()' call.

In any case I think this behavior could be unintuitive to the user (after all they explicitly set the hostname) and IMO the proper solution would be to not react on system hostname changes in case the LLMNR hostname was set via command line.

I'll adjust your patch accordingly if that's OK with you...

EDIT: Sorry, I didn't read your patch properly. Of course llmnrd_fd_hostname is only open()'ed in case the hostname is not set manually. So everything is fine with your patch and I'll apply it as such.

tklauser added a commit that referenced this issue Feb 28, 2017
Acknowledge @tbetker for issues #22 and #23 and the patches provided
therein.

Signed-off-by: Tobias Klauser <[email protected]>
@tbetker
Copy link
Author

tbetker commented Feb 28, 2017

Whoa, that was fast! (:-)

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

No branches or pull requests

2 participants