Commit graph

662 commits

Author SHA1 Message Date
Brian Goff
116f200737
Fix gosec complaints in libnetwork
These were purposefully ignored before but this goes ahead and "fixes"
most of them.
Note that none of the things gosec flagged are problematic, just
quieting the linter here.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-25 18:02:03 +02:00
yalpul
967ec6f2e8 Fix typo in macvlan_setup.go
Signed-off-by: yalpul <yalpul@gmail.com>
2021-06-19 11:36:16 +03:00
Sebastiaan van Stijn
76640e5d39
drivers/bridge: format comments
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-10 18:06:07 +02:00
Sebastiaan van Stijn
da0a006b14
drivers/bridge: dont use types.ParseCIDR() for fixed value
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-10 18:06:04 +02:00
Sebastiaan van Stijn
508a0979d9
bridge: remove unused "others" argument from isolateNetwork()
This argument was used to detect conflicts, but was later removed in
1c73b1c99c14d7f048a2318a3caf589865c76fad.

However, it was never removed, and we were still getting a list
of all networks, without using the results.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-09 22:23:38 +02:00
Brian Goff
4b981436fe Fixup libnetwork lint errors
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 23:48:32 +00:00
Brian Goff
00b2c13a1b Fix some windows issues in libnetwork tests
Fix build constraints for linux-only network drivers

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 23:48:23 +00:00
Brian Goff
20fd1dd7d2 Skip some windows network driver tests
These are failing in CI because something is not enabled.
Its not clear that these tests ever worked because they were not
actually running while in the libnetwork repo, which was only testing
Linux.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 22:15:10 +00:00
Brian Goff
72c4a7b496 Fix issues running libnetwork tests.
libnetwork does different stuff depending on if you are running the
tests in a container or not... without telling it we are in a container
a bunch of the tests actually fail.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 22:14:41 +00:00
Brian Goff
a0a473125b Fix libnetwork imports
After moving libnetwork to this repo, we need to update all the import
paths for libnetwork to point to docker/docker/libnetwork instead of
docker/libnetwork.
This change implements that.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-06-01 21:51:23 +00:00
Akihiro Suda
325668315c fix port forwarding with ipv6.disable=1
Make `docker run -p 80:80` functional again on environments with kernel boot parameter `ipv6.disable=1`.

Fix moby/moby issue 42288

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-04-27 15:46:07 +09:00
Arko Dasgupta
5d3b0102f7 Use hostIP to decide on Portmapper version
Use HostIP to decide which portmapper object to store the binding
in consistently in the allocate and release method (b506539e9c/drivers/bridge/port_mapping.go (L208))

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2021-01-23 12:00:46 -08:00
Arko Dasgupta
4f9af99194 Fix regression in docker-proxy
Allow proxying IPv6 traffic to the container's IPv4 interface
if `--ipv6` is disabled and the container does not have a
IPv6 address, when the docker-proxy / `userland-proxy` is enabled
on `dockerd`

Relates to https://github.com/moby/libnetwork/issues/2607

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2021-01-14 17:51:09 -08:00
Arko Dasgupta
33a82a26a8 Fix IPv6 Port Forwarding for the Bridge Driver
1. Allocate either a IPv4 and/or IPv6 Port Binding (HostIP, HostPort, ContainerIP,
ContainerPort) based on the input and system parameters
2. Update the userland proxy as well as dummy proxy (inside port mapper) to
specifically listen on either the IPv4 or IPv6 network

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2020-12-14 18:46:22 -08:00
Arko Dasgupta
09be71b900 Merge pull request #2603 from bboehmke/ipv6_portmapper_chain
Fixed IPv6 portmapper iptables chain initialization
2020-12-11 10:39:35 -08:00
Benjamin Böhmke
06308f4d37 setup IPv4 and IPv6 iptables chain
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-12-11 11:12:41 +01:00
Arko Dasgupta
b7c663c2ec Make sure IPv6 is enabled for IP6tables
Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2020-12-11 00:39:42 -08:00
Arko Dasgupta
dc6cbb55b4 Merge pull request #2572 from bboehmke/ipv6_nat
Enable IPv6 NAT (rebase of #2023)
2020-10-29 14:13:58 -07:00
Tibor Vass
20c88eb92f Merge pull request #2583 from thaJeztah/update_docker_alt
vendor: update docker to 7ca355652f and reduce dependency graph
2020-09-17 13:29:33 -07:00
Sebastiaan van Stijn
3e1e9e878c vendor: gotest.tools v3.0.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-12 03:22:18 +02:00
Sebastiaan van Stijn
bf28003c99 Replace use of deprecated functions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-12 01:49:42 +02:00
Sebastiaan van Stijn
6dde6cb0b0 drivers/macvlan: skip kernel version check
All distros that are supported by Docker now have at least
kernel version 3.10, so this check should no longer be needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-31 20:45:02 +02:00
Sebastiaan van Stijn
02d313ca15 drivers/bridge: skip kernel version check
All distros that are supported by Docker now have at least
kernel version 3.10, so this check should no longer be needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-08-31 20:44:51 +02:00
Benjamin Böhmke
34f4706174 added TODOs for open IPv6 point
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-23 16:52:40 +02:00
Benjamin Böhmke
648d891827 reworked allocatePorts
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-22 15:43:02 +02:00
Benjamin Böhmke
1e1408f421 additional EnableIPTables check in isolateNetwork
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-22 15:06:19 +02:00
Benjamin Böhmke
a4fcced708 enabled ipv6 parameter in TestSetupIPForwarding
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-22 15:05:51 +02:00
Benjamin Böhmke
4d1c92c155 resorted EnableIP6Tables in driver configure
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-21 18:50:03 +02:00
Benjamin Böhmke
9bc2f88f04 isolateNetwork for both IP version
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-21 18:14:19 +02:00
Benjamin Böhmke
ccad03a139 split setupIPTables into setupIP4Tables and setupIP6Tables
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-21 18:14:07 +02:00
Benjamin Böhmke
9cf5335269 default DROP policy on firewall reload also for IPv6
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-21 15:24:20 +02:00
Benjamin Böhmke
ec7df93731 replace string.Contains* with net.IP.To4() check
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-21 15:23:33 +02:00
Benjamin Böhmke
3475f006b7 moved some ipv6 config to setupIPForwarding
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-19 16:17:02 +02:00
Benjamin Böhmke
dfd1925ed1 Renamed driver config variable to EnableIP6Tables
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-19 16:17:02 +02:00
Billy Ridgway
8dbb5b5a7d Implement NAT IPv6 to fix the issue https://github.com/moby/moby/issues/25407
Signed-off-by: Billy Ridgway <wrridgwa@us.ibm.com>
Signed-off-by: Benjamin Böhmke <benjamin@boehmke.net>
2020-07-19 16:16:51 +02:00
Sebastiaan van Stijn
27345e8f8f log error instead if disabling IPv6 router advertisement failed
Previously, failing to disable IPv6 router advertisement prevented the daemon to
start.

An issue was reported by a user that started docker using `systemd-nspawn "machine"`,
which produced an error;

    failed to start daemon: Error initializing network controller:
    Error creating default "bridge" network: libnetwork:
    Unable to disable IPv6 router advertisement:
    open /proc/sys/net/ipv6/conf/docker0/accept_ra: read-only file system

This patch changes the error to a log-message instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-06-12 19:32:18 +02:00
Samuel Karp
e65003a722 bridge: disable IPv6 router advertisements
Signed-off-by: Samuel Karp <skarp@amazon.com>
(cherry picked from commit 9489546c44d94d37337191c263879a7ac075a331)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-06-02 12:06:39 +02:00
Arko Dasgupta
e49ee8266d Merge pull request #2460 from moby/revert-2450-iptables-policy
Revert "Always configure iptables forward policy"
2020-03-18 11:22:47 -07:00
Sebastiaan van Stijn
d846c2b1ab vendor: update vishvananda/netlink v1.1.0
full diff: https://github.com/vishvananda/netlink/compare/v1.0.0...v1.1.0

also updated moby/ipvs, which is compatible with this version of netlink,
and update vishvananda/netns to current master (which added go.mod)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-12 18:25:54 +01:00
elangovan sivanandam
c485bbf754 Merge pull request #2523 from arkodg/seperate-internal-empty-parent
Macvlan: Separate empty parent and internal
2020-03-05 15:26:57 -05:00
Arko Dasgupta
76b5905cbe Macvlan: Separate empty parent and internal
https://github.com/docker/libnetwork/pull/2419 and
https://github.com/docker/libnetwork/pull/2407
attempted to seperate out empty parent and internal for
macvlan and ipvlan networks

However it didnt pass the integration tests in moby
https://github.com/moby/moby/pull/40596 and exposed some
more plumbing that needed to be done to make sure
we separate the two things

If the -o parent is empty we create a dummylink
and if internal is set we dont add a default gateway
and make sure north-south communication cannot take place
(only east-west / container-container can)

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2020-03-04 13:24:10 -08:00
Wang Yumu
41a91e9a5d fix InhibitIPv4 nil panic
Signed-off-by: Wang Yumu <37442693@qq.com>
2020-03-02 23:38:13 +08:00
Arko Dasgupta
68f261bfff Merge pull request #2407 from lemrouch/2406-fix
Macvlan internal network should not change default gateway
2020-02-26 09:28:30 -08:00
Pavel Matěja
c7f8bfa001 Fix internal ipvlan network to work in swarm
Using dummy interface allows communication beween containers only if
they are running on the same node in swarm.

Signed-off-by: Pavel Matěja <pavel@verotel.cz>
2020-02-20 19:33:48 +00:00
Pavel Matěja
b0bce9159e Fix internal macvlan network to work in swarm
Using dummy interface allows communication beween containers only if
they are running on the same node in swam.

Signed-off-by: Pavel Matěja <pavel@verotel.cz>
2020-02-20 19:33:48 +00:00
Pavel Matěja
76bccc5ad4 Ipvlan internal network should not change gw
Since docker container can be connected to combination of several
internal and external networks change of default gateway of the internal
ones breaks communication via the external ones.

This fixes only ipvlan network type

Signed-off-by: Pavel Matěja <pavel@verotel.cz>
2020-02-20 17:49:42 +00:00
Arko Dasgupta
b8b9d67d1a Merge pull request #2454 from arkodg/add-host-ip-snat
Support for com.docker.network.host_ipv4 driver label
2020-02-15 08:32:56 -08:00
Arko Dasgupta
b5b12d8bec Merge pull request #2317 from gsomlo/gls-bridge-inhibit-ipv4
Allow bridge net driver to skip IPv4 configuration of bridge interface
2020-02-14 14:47:24 -08:00
elangovan sivanandam
e2c0d868ab Merge pull request #2380 from liskin/bridge-atomic-hwaddr
bridge: Fix hwaddr set race between us and udev
2019-12-31 19:30:42 -05:00
Arko Dasgupta
cd864b50a2 Fix panic in drivers/overlay/encryption.go
Issue - "index out of range" panic in drivers/overlay/encryption.go:539
due to a mismatch in indices between curKeys and spis due to
case where updateKeys might bail out due to an error and
not update the spis

Fix - Reconfigure keys when there is a key update failure

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
2019-10-31 12:59:41 -07:00