Skip to content
  • Laine Stump's avatar
    kill dhclient before attempting to change guest IP in no-ip-spoofing test · 4be2af3e
    Laine Stump authored
    
    
    This test changes the IP address of the guest interface so that it can
    send out a packet with a different source IP address. It may have
    worked properly with older versions of Fedora running on the test
    guest, but at least in Fedora 27, NetworkManager keeps the dhclient
    process running after it has already acquired an IP address, and if
    you set the interface offline and then back on, dhclient will very
    quickly re-acquire the IP address, so the test ends up sending a ping
    from the *same* address, the packet passes the filters, and the test
    fails.
    
    The solution is to just kill the dhclient process. This allows the
    manually set IP address to "stick". Since the guest is shutdown
    immediately after this test, it doesn't matter that dhclient is no
    longer running. (We *do* need to set the IP address back to its
    original setting though, so that the ssh socket used for the test
    (which is connecting via the same interface) won't hang and delay
    completion of the test (also causing it to fail).
    
    Signed-off-by: default avatarLaine Stump <laine@laine.org>
    Reviewed-by: default avatarStefan Berger <stefanb@linux.vnet.ibm.com>
    Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
    4be2af3e