Bug 1473089 - rwhod sends out info as 'localhost' if using DHCP
rwhod sends out info as 'localhost' if using DHCP
Status: MODIFIED
Product: Fedora
Classification: Fedora
Component: rwho (Show other bugs)
27
x86_64 Linux
unspecified Severity low
: ---
: ---
Assigned To: Petr Kubat
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-19 21:50 EDT by Ian Donaldson
Modified: 2017-12-11 22:11 EST (History)
3 users (show)

See Also:
Fixed In Version: rwho-0.17-58.fc26 rwho-0.17-57.fc25
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-07-31 12:20:55 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ian Donaldson 2017-07-19 21:50:22 EDT
Description of problem:

(been meaning to post this for a while)

Since start of fc25, something has changed in that rwhod now reliably
sends out info claiming to be 'localhost' instead of the real host name
of the device. This only seems to happen if DHCP is used, probably
due to changes in the systemd startup behaviour, and the way
NetworkManager works.

This worked fine in fc24 and prior.


Version-Release number of selected component (if applicable):

rwho-0.17-56.fc24.x86_64 (NB: I'm on fc25; looks like rwhod hasn't been updated)

How reproducible:

100% on a desktop using DHCP

Steps to Reproduce:
1. start desktop with rwhod and DHCP client (NetworkManager) enabled
2. wait a few minutes
3. rwho or ruptime on some other host on the LAN

Actual results:

Note you see your desktop mentioned as 'localhost' in rwho or ruptime output,
or you don't see it at all as some other host has since sent out a similarly
bogus broadcast as 'localhost'


Expected results:

see your desktop's host name, not 'localhost'

Additional info:

workaround is to restart rwhod after it starts and is on the network

systemctl restart rwhod


Suggested fix is to have rwhod not broadcast if the host name is 'localhost'
and do a gethostname() repeatedly, so it starts working when NetworkManager
has done the DHCP initialization
Comment 1 Petr Kubat 2017-07-20 08:08:13 EDT
Hi Ian, thanks for reporting this!

I have not tried to reproduce this yet but from what I can see the issue might lie with rwhod not waiting until the network configuration is completed.

Can you try modifying your rwhod service file so that its unit section looks like this:

[Unit]
Description=Remote Machine Logged In User Lister
Requires=network.target
Wants=network-online.target
After=syslog.target network-online.target

So using `network-online.target` instead of just `network.target` while also pulling it as a dependency.
Comment 2 Ian Donaldson 2017-07-20 21:33:05 EDT
That change seems to work and would fix it for the localhost case which is
probably the most common; it
wouldn't necessarily fix it for the case where the DHCP server handed
out a different IP after the system leased one at startup. Not worth
fixing that case IMHO; probably pretty rare, if not impossible unless
the DHCP server lost its mapping and restarted.   So your fix should suffice.

# diff rwhod.service.dist rwhod.service
4c4,5
< After=syslog.target network.target
---
> Wants=network-online.target
> After=syslog.target network-online.target


Let me know when your suggested change hits rpm testing stage and I'll test it.

Thanks

Ian D
Comment 3 Ian Donaldson 2017-07-20 21:36:16 EDT
Curiously, on fc22 the systemd rwho.service file is the same as on fc25, so something else must have changed in the startup sequence to trigger this issue.
Comment 4 Petr Kubat 2017-07-21 03:13:58 EDT
Thanks for testing out the patch, I am glad it fixed the issue for you.
Pushed into git for F25 and later:

http://pkgs.fedoraproject.org/cgit/rpms/rwho.git/commit/?id=1a579ce682e226702b895217f0ac1585fc553109

Builds should hit updates-testing in a few days.
Comment 5 Fedora Update System 2017-07-21 03:16:29 EDT
rwho-0.17-57.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-e91f4d5bcf
Comment 6 Fedora Update System 2017-07-21 03:17:08 EDT
rwho-0.17-58.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-82346f7374
Comment 7 Fedora Update System 2017-07-23 02:56:47 EDT
rwho-0.17-57.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-e91f4d5bcf
Comment 8 Fedora Update System 2017-07-23 05:58:40 EDT
rwho-0.17-58.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-82346f7374
Comment 9 Fedora Update System 2017-07-31 12:20:55 EDT
rwho-0.17-58.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.
Comment 10 Fedora Update System 2017-07-31 16:20:47 EDT
rwho-0.17-57.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.
Comment 11 Ian Donaldson 2017-08-02 23:47:18 EDT
Reopening...

I've done a fresh-kickstart of fc26 with this version of rwho and all updates
and unfortunately the fix isn't working.

$ ls -l /etc/systemd/system/multi-user.target.wants/rwhod.service 
lrwxrwxrwx. 1 root root 37 Aug  1 16:13 /etc/systemd/system/multi-user.target.wants/rwhod.service -> /usr/lib/systemd/system/rwhod.service

$ cat /etc/systemd/system/multi-user.target.wants/rwhod.service
[Unit]
Description=Remote Machine Logged In User Lister
Requires=network.target
Wants=network-online.target
After=syslog.target network-online.target

[Service]
Type=forking
ExecStart=/usr/sbin/rwhod
StandardError=syslog

[Install]
WantedBy=multi-user.target


$ rpm -q rwho
rwho-0.17-58.fc26.x86_64

$ uptime
 13:39:38 up  2:31,  2 users,  load average: 0.01, 0.03, 0.00

$ ps -ef|grep rwho
root       872     1  0 11:08 ?        00:00:00 /usr/sbin/rwhod
root       873   872  0 11:08 ?        00:00:00 /usr/sbin/rwhod


# strace -f -p 873

...

sendto(3, "\1\1\0\0Y\202\232\324\0\0\0\0localhost\0\0\0\0\0\0\0\0\0\0\0"..., 108, 0, {sa_family=AF_INET, sin_port=htons(513), sin_addr=inet_addr("192.168.122.255")}, 16) = 108
sendto(3, "\1\1\0\0Y\202\232\324\0\0\0\0localhost\0\0\0\0\0\0\0\0\0\0\0"..., 108, 0, {sa_family=AF_INET, sin_port=htons(513), sin_addr=inet_addr("192.168.41.255")}, 16) = 108

hostname isn't localhost though... its the correct value, via DHCP IP assignment and reverse DNS lookup.


So maybe plan B is required after all... have rwhod not broadcast if
the hostname part of gethostname() is 'localhost'.
Comment 12 Fedora End Of Life 2017-11-16 14:24:47 EST
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Comment 13 Ian Donaldson 2017-11-16 17:09:05 EST
Adjusting to fc26 ...
Comment 14 Ian Donaldson 2017-12-11 22:11:42 EST
issue still present in fresh install of fc27

rwho-0.17-60.fc27.x86_64

Note You need to log in before you can comment on or make changes to this bug.