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

utils_net: get default gateway for specific interface #3818

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

smitterl
Copy link
Contributor

@smitterl smitterl commented Dec 22, 2023

Add optional parameter in order to retrieve the default gateway for a specific interface.

On a system with two interfaces, the routes might look like

default via 10.172.161.254 dev enc1 proto dhcp src 10.172.160.70 metric 100
default via 192.168.126.1 dev enc2 proto dhcp src 192.168.126.48 metric 102

Filtering only by default will return two ips

10.172.161.254
192.168.126.1

The change allows us to select the interface and thus retrieve only

192.168.126.1

Add optional parameter in order to retrieve the default gateway
for a specific interface.

On a system with two interfaces, the routes might look like

```
default via 10.172.161.254 dev enc1 proto dhcp src 10.172.160.70 metric 100
default via 192.168.126.1 dev enc2 proto dhcp src 192.168.126.48 metric
102
```

Filtering only by default will return two ips

```
10.172.161.254
192.168.126.1
```

The change allows us to select the interface and thus retrieve only

```
192.168.126.1
```

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
@smitterl
Copy link
Contributor Author

@chloerh please help review

@chloerh chloerh merged commit 26cc872 into avocado-framework:master Jan 5, 2024
50 checks passed
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.

3 participants