Commit Graph

2 Commits

Author SHA1 Message Date
Kevin Krakauer 45884ba639 Internal change
PiperOrigin-RevId: 372166050
2021-05-05 11:15:26 -07:00
Kevin Krakauer 36dbd3b97d Automatically enforce limited netstack dependencies
Netstack is supposed to be somewhat independent of the rest of gVisor, and
others should be able to use it without pulling in excessive dependencies.
Currently, there is no way to fight dependency creep besides careful code
review.

This change introduces a test rule `netstack_deps_check` that ensures the target
only relies on gVisor targets and a short allowlist of external dependencies.
Users who add a dependency will see an error and have to manually update the
allowlist.

The set of packages to test comes from //runsc, as it uses packages we would
expect users to commonly rely on. It was generated via:
$ find ./runsc -name BUILD | xargs grep tcpip | awk '{print $2}' | sort | uniq

(Note: We considered giving //pkg/tcpip it's own go.mod, but this breaks go
tooling.)

PiperOrigin-RevId: 368456711
2021-04-14 10:26:02 -07:00