Use gateway specified on command line "docker network create"#5
Use gateway specified on command line "docker network create"#5vladwing wants to merge 2 commits into
Conversation
setting up the network inside the container
There was a problem hiding this comment.
Two general points:
-
can you modify the
entities_testanddriver_testto take into account your changes? It should be as easy as adding agateway: <whatever structure we settle on>here:and something likeLine 29 in 0e8de0b
IPv4Data: []*network.IPAMData{{ Gateway: fmt.Sprintf(<whatever logic to represent the value we settled on>), }},here:Line 163 in 0e8de0b
-
is it possible to provide an integration test that highlights what wasn't working before and works now? You said
Because of that, if you add another network to a container - for example a bridge, docker will see that the dwgd network doesn't provide a default route and will create a default route via the other network.
Maybe a copy-paste of this one with more than one network would be enough?
And of course thanks a lot for sending this!!!
| if len(r.IPv4Data) > 0 { | ||
| TraceLog.Printf("ParseCIDR: %+v\n", r.IPv4Data[0].Gateway) | ||
| gateway, _, err := net.ParseCIDR(r.IPv4Data[0].Gateway) | ||
| if err == nil && gateway != nil { |
There was a problem hiding this comment.
both here and on the IPv6 handling below I would fail if there is an error and return the error, to keep consistency on how it is done in the function.
|
Give me a bit of time to update the PR with the requested changes. |
| route string | ||
| ifname string | ||
| id string | ||
| endpoint *net.UDPAddr |
There was a problem hiding this comment.
@leomos I would like to update this to a string in a future PR. Thoughts?
There was a problem hiding this comment.
it's a good idea to keep consistency with what we agreed over the gateway{_v6} fields.
If you can change it in this PR it's great, otherwise no problem in doing that later.
There was a problem hiding this comment.
What I have in mind is a slightly bigger change. Right now the daemon saves an IP address, which is not even the IP address at the moment of the tunnel creation. I think this should be an FQDN which is resolved at tunnel creation. It will still not solve all the problems the wg-quick solves, but it's a step in that direction and we can iterate over it. We can start by changing the endpoint to a string in this patch and continue with the complicated stuff in a later PR.
Currently dwgd doesn't set a default route and when it does set it using
dwgd.routeoption, docker gets confused. Allow setting a default route usingdocker network create ... --gateway <IP>.Copying from Issue #4, for context