summaryrefslogtreecommitdiff
path: root/libnetwork/netutils/utils_linux.go
Commit message (Collapse)AuthorAgeFilesLines
* libnetwork/netutils: drop ElectInterfaceAddressesCory Snider2023-01-261-41/+0
| | | | | | | | The function references global shared, mutable state and is no longer needed. Deleting it brings us one step closer to getting rid of that pesky shared state. Signed-off-by: Cory Snider <csnider@mirantis.com>
* libnetwork/netutils: clean up GenerateIfaceNameBjorn Neergaard2023-01-241-3/+2
| | | | | | | | | | | netlink offers the netlink.LinkNotFoundError type, which we can use with errors.As() to detect a unused link name. Additionally, early return if GenerateRandomName fails, as reading random bytes should be a highly reliable operation, and otherwise the error would be swallowed by the fall-through return. Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
* Merge pull request #44239 from thaJeztah/resolvconf_refactor_step2Tianon Gravi2022-12-221-7/+5
|\ | | | | libnetwork: simplify handling of reading resolv.conf
| * libnetwork/netutils: FindAvailableNetwork(): simplify reading of resolv.confSebastiaan van Stijn2022-11-291-7/+5
| | | | | | | | | | | | | | We only need the content here, not the checksum, so simplifying the code by just using os.ReadFile(). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | libnetwork: stop caching global netlink handleCory Snider2022-11-081-0/+1
|/ | | | | | | | | | | | | | The global netlink handle ns.NlHandle() is indirectly cached for the life of the process by the netutils.CheckRouteOverlaps() function. This caching behaviour is a problem for the libnetwork unit tests as the global netlink handle changes every time testutils.SetupTestOSContext() is called, i.e. at the start of nearly every test case. Route overlaps can be checked for in the wrong network namespace, causing spurious test failures e.g. when running the same test twice in a row with -count=2. Stop the netlink handle from being cached by shadowing the package-scope variable with a function-scoped one. Signed-off-by: Cory Snider <csnider@mirantis.com>
* libnetwork: drop InitOSContext()Cory Snider2022-10-251-3/+0
| | | | | | The function is a no-op on all platforms. Signed-off-by: Cory Snider <csnider@mirantis.com>
* Merge pull request #42777 from thaJeztah/update_go_1.17Sebastiaan van Stijn2021-08-261-0/+2
|\ | | | | Update to Go 1.17.0
| * Update to Go 1.17.0, and gofmt with Go 1.17Sebastiaan van Stijn2021-08-241-0/+2
| | | | | | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | Only check if route overlaps routes with scope: LINKAlex Nordlund2021-08-251-1/+1
|/ | | | Signed-off-by: Alex Nordlund <alexander.nordlund@nasdaq.com>
* netutils: minor cleanupsSebastiaan van Stijn2021-06-171-4/+1
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Fix libnetwork importsBrian Goff2021-06-011-5/+5
| | | | | | | | | 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>
* Use errors.Wrap to preserve original errorSebastiaan van Stijn2019-04-011-2/+2
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Improve error if auto-selecting IP-range failed.qudongfang2018-11-281-2/+4
| | | | Signed-off-by: qudongfang <qudongfang@gmail.com>
* Global Default Address Pool supportselansen2018-08-161-2/+2
| | | | | | | | | | | This change brings global default address pool feature into libnetwork. Idea is to reuse same code flow and functions that were implemented for local scope default address pool. Function InitNetworks carries most of the changes. local scope default address pool init should always happen only once. But Global scope default address pool can be initialized multiple times. Signed-off-by: selansen <elango.siva@docker.com>
* Fix issue for `--fixed-cidr` when bridge has multiple addressesYong Tang2016-10-211-10/+11
| | | | | | | | | | | | | | | | This fix tries to address the issue raised in: https://github.com/docker/docker/issues/26341 where multiple addresses in a bridge may cause `--fixed-cidr` to not have the correct addresses. The issue is that `netutils.ElectInterfaceAddresses(bridgeName)` only returns the first IPv4 address. This fix changes `ElectInterfaceAddresses()` and `addresses()` so that all IPv4 addresses are returned. This will allow the possibility of selectively choose the address needed. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* fix typosbin liu2016-06-221-2/+2
| | | | Signed-off-by: bin liu <liubin0329@gmail.com>
* Migrate libnetwork to use netlink.HandleAlessandro Boch2016-06-081-7/+15
| | | | Signed-off-by: Alessandro Boch <aboch@docker.com>
* Remove all netlink/osl deps from ipam/ipamutilsJana Radhakrishnan2016-04-101-0/+67
| | | | | | | | | | Currently ipam/ipamutils has a bunch of dependencies in osl and netlink which makes the ipam/ipamutils harder to use independently with other applications. This PR modularizes ipam/ipamutils into a standalone package with no OS level dependencies. Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
* Multi-Arch SupportDave Tucker2015-11-251-0/+50
Compile the dnet tool for Linux (x86, amd64 and arm) and Windows (x86 and amd64) - Moved installation of dependencies into `Dockerfile.build` - Remove `start-services` from Makefile - That's the responsibility of Docker or build environment - Removed utils depending on `netlink` from `netutils/utils.go` Unable to add `make cross` to CircleCI just yet as there are some issues to solve that are unrelated to this PR Also fix `.gitignore` which was not updated after changing the build image name in #667 Signed-off-by: Dave Tucker <dt@docker.com>