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

Support v2 and v3 options from libslirp #200

Merged
merged 1 commit into from
May 5, 2020

Conversation

5eraph
Copy link
Contributor

@5eraph 5eraph commented Apr 29, 2020

Hi,

This is first draft of changes providing support for configuration v2 and v3 of libslirp.

Fixes #173

@AkihiroSuda please let me know your thoughts on this. I am not sure about organization of some parts.
E.g.:

  • is it ok to parse outbound addresses in slirp4netns_config_from_options
    - if we want to print configured outbound address on slirp setup, is it ok to pass original char * outbound_addr/6 to parent function or is there better way ? (this is not implemented yet)

slirp4netns.c Outdated Show resolved Hide resolved
@AkihiroSuda
Copy link
Member

Thanks!

  • Please sign the commits with your full name (git commit -a -s)
  • Please add tests

main.c Show resolved Hide resolved
main.c Outdated Show resolved Hide resolved
main.c Outdated Show resolved Hide resolved
@AkihiroSuda AkihiroSuda added this to the v1.1.0 milestone Apr 29, 2020
@5eraph
Copy link
Contributor Author

5eraph commented Apr 29, 2020

Thanks!

  • Please sign the commits with your full name (git commit -a -s)
  • Please add tests

Alright will do. Thanks for prompt feedback. I will go through that tomorrow.

@5eraph 5eraph force-pushed the master branch 2 times, most recently from 8aa9db3 to 7f305ab Compare April 30, 2020 05:08
@5eraph
Copy link
Contributor Author

5eraph commented Apr 30, 2020

I don't know why are the test failing yet. I ran Dockerfile.tests in my environment with same parameters and same code base without issues. 🤔

Any suggestions ?
Another run for same commit was successful.

@5eraph
Copy link
Contributor Author

5eraph commented Apr 30, 2020

To me it looks like the final cleanup trap fails and returns error exit code and causes failure of entire test even though the test might be successful.

Can we outsource cleanup routine to avoid these errors? Like this:

function cleanup {
    kill -9 $nc_pid $child $slirp_pid &
}

Also regarding outbound address. Do you have any suggestions how to test it with automated tests?
I think to test it properly we need two endpoints - either servers or containers. Then grep non local host ip address which connects these two and verify whether the server is receiving connections from correct IPv4/6. And I am not sure whether this is achievable in reasonable/straightforward way.

main.c Outdated Show resolved Hide resolved
slirp4netns.1.md Outdated Show resolved Hide resolved
main.c Outdated Show resolved Hide resolved
main.c Outdated Show resolved Hide resolved
slirp4netns.1.md Outdated Show resolved Hide resolved
@AkihiroSuda
Copy link
Member

I think to test it properly we need two endpoints

I guess we can just test lo and eth0 and call it a day

main.c Show resolved Hide resolved
main.c Outdated Show resolved Hide resolved
@AkihiroSuda
Copy link
Member

cc @giuseppe @elmarco PTAL

@5eraph
Copy link
Contributor Author

5eraph commented Apr 30, 2020

I think to test it properly we need two endpoints

I guess we can just test lo and eth0 and call it a day

Ok, I am going to check out what we can do with it using nc -v -n .

@5eraph
Copy link
Contributor Author

5eraph commented May 1, 2020

@AkihiroSuda can you please take a look at outbound-addr test? It should be sufficient for now.

I wasn't able to test ipv6. All ipv6 requests failed with network unreachable error. I tried both fe80::2 and fd00::2. Also there is no ipv6 test I could use as reference.

@5eraph 5eraph force-pushed the master branch 2 times, most recently from d8777d5 to cf1c473 Compare May 1, 2020 09:42
Dockerfile.tests Outdated Show resolved Hide resolved
@AkihiroSuda
Copy link
Member

Almost looks good except a couple of nits. The IPv6 tests can be added later.
Also, please squash and sigh the commits.

@5eraph 5eraph force-pushed the master branch 6 times, most recently from be5cbf9 to cbfb579 Compare May 2, 2020 09:56
main.c Outdated Show resolved Hide resolved
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

LGTM except a typo, thanks

@AkihiroSuda
Copy link
Member

@giuseppe @rhatdan PTAL

Signed-off-by: Bohumil Cervenka <5eraph@protonmail.com>
Copy link
Collaborator

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@AkihiroSuda AkihiroSuda merged commit 56e0b81 into rootless-containers:master May 5, 2020
This was referenced May 27, 2020
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.

Use specific outgoing IP
3 participants