Merge ~pwlars/plainbox-provider-checkbox:discover-gateway-ip into plainbox-provider-checkbox:master

Proposed by Paul Larson
Status: Merged
Approved by: Paul Larson
Approved revision: 98c72afe7246149e4cf9262da39e0a24ad62a9ad
Merged at revision: 248b8725aac9ff6ae31df05e2e5ea5c26e768bfa
Proposed branch: ~pwlars/plainbox-provider-checkbox:discover-gateway-ip
Merge into: plainbox-provider-checkbox:master
Diff against target: 23 lines (+12/-0)
1 file modified
bin/gateway_ping_test (+12/-0)
Reviewer Review Type Date Requested Status
Jonathan Cave (community) Approve
Sylvain Pineau Approve
Review via email: mp+372778@code.launchpad.net

Description of the change

Same concept as my previous MP, but do it in gateway_ping_test instead. We can still rely on the arp mechanism to find the address, but we can't depend on broadcast ping to get the router into the arp table. Instead, try to help it along by finding the address of the gateway and pinging it.

------------
I noticed that dawson-j was consistently failing on the wifi tests today, so I took the opportunity to look into it a bit more. The gateway ping test can take an arg to tell it which ip you want it to ping, but we don't pass it that, instead we rely on it to discover a valid ip for the subnet using a broadcast ping, followed by looking at the arp table. However, if nothing replies to the broadcast ping, it doesn't discover any valid ip and has nothing to ping. If I gave it a valid ip to ping, or even pinged the gateway so that it would arp, then it worked just fine though.

I tried this patch on that system, and it worked after that.

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

LGTM, +1

review: Approve
Revision history for this message
Jonathan Cave (jocave) wrote :

Thanks for extra tests on NM managed devices, LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/gateway_ping_test b/bin/gateway_ping_test
2index 914792c..7bac0f8 100755
3--- a/bin/gateway_ping_test
4+++ b/bin/gateway_ping_test
5@@ -133,6 +133,18 @@ def get_host_to_ping(interface=None, verbose=False, default=None):
6 stderr=subprocess.STDOUT)
7 except subprocess.CalledProcessError:
8 pass
9+ # Try to get the gateway address for the interface from networkctl
10+ cmd = 'networkctl status --no-pager --no-legend {}'.format(interface)
11+ try:
12+ output = subprocess.check_output(cmd, shell=True)
13+ for line in output.decode(sys.stdout.encoding).splitlines():
14+ key, val = line.strip().split(':', maxsplit=1)
15+ if key == "Gateway":
16+ subprocess.check_output(["ping", "-q", "-c", "1", val],
17+ stderr=subprocess.STDOUT)
18+ break
19+ except subprocess.CalledProcessError:
20+ pass
21 ARP_POPULATE_TRIES = 10
22 num_tries = 0
23 while num_tries < ARP_POPULATE_TRIES:

Subscribers

People subscribed via source and target branches