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

feat: use 127.0.0.1 as IPv4 if there's no external IPv4 addr #1353

Merged
merged 3 commits into from
Jun 1, 2022

Conversation

eryugey
Copy link
Contributor

@eryugey eryugey commented May 31, 2022

Since commit 0bc0d3b ("feat: add vsock network type support
(#1303)") we have vsock support, which means we could run dfget in a
constrained VM env that only has loopback net interface, and connect to
dfdaemon on host via vsock connection. So it's a valid setup to have no
external IPv4 addr.

Don't panic in this case and use "127.0.0.1" as IPv4.

Signed-off-by: Eryu Guan [email protected]

Description

Related Issue

Motivation and Context

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@eryugey eryugey requested a review from a team as a code owner May 31, 2022 12:36
@eryugey eryugey force-pushed the ipv4 branch 2 times, most recently from 164bde0 to fec24db Compare May 31, 2022 13:20
KubeStacker
KubeStacker previously approved these changes May 31, 2022
Since commit 0bc0d3b ("feat: add vsock network type support
(dragonflyoss#1303)") we have vsock support, which means we could run dfget in a
constrained VM env that only has loopback net interface, and connect to
dfdaemon on host via vsock connection. So it's a valid setup to have no
external IPv4 addr.

Don't panic in this case and use "127.0.0.1" as IPv4.

Signed-off-by: Eryu Guan <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented May 31, 2022

Codecov Report

Merging #1353 (3b87b4f) into main (a12ef5f) will decrease coverage by 0.06%.
The diff coverage is 20.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1353      +/-   ##
==========================================
- Coverage   45.67%   45.60%   -0.07%     
==========================================
  Files         140      140              
  Lines       11978    11981       +3     
==========================================
- Hits         5471     5464       -7     
- Misses       5881     5898      +17     
+ Partials      626      619       -7     
Flag Coverage Δ
Object-compatibility-e2etests ?
e2etests ?
unittests 45.60% <20.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/util/net/iputils/ip_utils.go 59.37% <20.00%> (-2.93%) ⬇️
client/daemon/peer/peertask_piecetask_poller.go 30.43% <0.00%> (-16.67%) ⬇️
client/daemon/peer/peertask_conductor.go 58.14% <0.00%> (+1.00%) ⬆️
...ent/daemon/peer/peertask_piecetask_synchronizer.go 48.91% <0.00%> (+1.29%) ⬆️
client/daemon/peer/peertask_file.go 58.77% <0.00%> (+1.52%) ⬆️
client/daemon/peer/piece_broker.go 92.30% <0.00%> (+2.56%) ⬆️

Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@yxxhero yxxhero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gaius-qi gaius-qi merged commit cba7ff4 into dragonflyoss:main Jun 1, 2022
gaius-qi added a commit that referenced this pull request Jun 28, 2023
* feat: use 127.0.0.1 as IPv4 if there's no external IPv4 addr

Since commit 0bc0d3b ("feat: add vsock network type support
(#1303)") we have vsock support, which means we could run dfget in a
constrained VM env that only has loopback net interface, and connect to
dfdaemon on host via vsock connection. So it's a valid setup to have no
external IPv4 addr.

Don't panic in this case and use "127.0.0.1" as IPv4.

Signed-off-by: Eryu Guan <[email protected]>

* Update ip_utils.go

* Update ip_utils.go

Co-authored-by: Gaius <[email protected]>
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.

5 participants