Revert "[netstack] Route table re-architecture"

This reverts commit 52059d0841223d5c3001d1204d37e511f747cb28.

Reason for revert: breaks global integration

Original change's description:
> [netstack] Route table re-architecture
> 
> Note: Part of the code implements a soft transition in the netstack.fidl to
> avoid breaking Chromium. The soft transition copies and extends the
> NetInterface and RouteTableEntry structs as well as the functions using them.
> Once Chromium transitions away from netstack.fidl this can be removed.
> 
> The main change cleans up and improves the route table logic by doing several
> things:
> 
> 1)
> The per-interface route tables stored in netiface.NIC are removed and
> consolidated in its own route_table package and RouteTable type.
> 
> 2)
> The fuchsia.netstack.fidl RouteTableTransaction interface is simplified by
> replacing the current {Get,Set}RouteTable and Commit functions with simpler
> {Add,Del}Route ones. This also matches the {Add,Del}ForwardingEntry APIs in the
> new fuchsia.net.stack nicely.
> 
> 3)
> 
> The RouteTable type implements a sorted table of routes that carry additional
> attributes besides the standard tcpip.Route, most importantly a metric value
> that is used as a tie-breaker when sorting the table. The metric can either be
> statically chosen by the user, or dynamically chosen by tracking the metric of
> the interface the route points to. An according metric value is added to the
> netiface.NIC struct, which can be overwritten via ifconfig command. This allows
> to favor defaults routes going out a specific interface. E.g., if both WLAN and
> Ethernet ports have obtained IP addresses and gateways via DHCP, setting a
> lower metric on the WLAN interface can favor it over the Ethernet one so its
> default route is sorted above the Ethernet's.
> 
> In addition, static IPs assigned to an interface as well as their subnet routes
> are not removed anymore when the interface goes down. Rather, Netstack
> remembers whether the address was obtained dynamically (DHCP) or statically and
> only removes the dynamic one. Static IPs remain assigned, but its subnet route
> disabled via an extended route attribute, so it isn't used by gVisor Netstack.
> Eventually, this behavior should be coming from netcfg.
> 
> NET-1773 #done
> NET-1916 #done
> NET-2054 #done
> NET-1978
> NET-1223
> 
> Tested:
> - Unit-tests: fx run-test netstack_gotests
> 
> - Manual tests on device:
>   Plug eth04p into MacBook, configure static IP on MacBook:
>    sudo ifconfig en8 inet 192.168.10.2 netmask 255.255.255.0
> 
>   On Toulouse:
>    fx shell ifconfig ethp04 up
>    fx shell ifconfig ethp04
>    (should be UP, metric 100)
> 
>    fx shell ifconfig ethp04 add 192.168.10.3/24 && fx shell ifconfig ethp04 && \
>      fx shell ifconfig route show
>    (verify new IP is set, and new "192.168.10.0/24 via ethp04 metric 100" route entry in the proper place)
> 
>    ping 192.168.10.2
>     (pinging MacBook succeeds, same goes for the other direction pinging
>      192.168.10.3 from MacBook)
> 
>    fx shell ifconfig ethp04 down && fx shell ifconfig ethp04 && \
>      fx shell ifconfig route show
>     (IP address and route remain, but are disabled)
> 
>    ping 192.168.10.2
>     (Pinging either direction doesn't work)
> 
>    fx shell ifconfig ethp04 up && fx shell ifconfig ethp04 up && \
>      fx shell ifconfig ethp04 && fx shell ifconfig route show
>     (IP and route still there, re-enabled)
> 
>    ping 192.168.10.2
>     (pinging works again in both directions)
> 
>    fx shell ifconfig ethp04 metric 50 && fx shell ifconfig ethp04 && \
>      fx shell ifconfig route show
>     (if and route metric changed to 50, route moved up one spot)
> 
>    fx shell ifconfig route add 192.168.20.0/24 iface ethp04 && \
>      fx shell ifconfig ethp04 && fx shell ifconfig route show
>     (Route is added to the table, no gateway, metric is 50 from ethp04)
> 
>    fx shell ifconfig route add 192.168.30.0/24 iface ethp04 gateway \
>      192.168.30.1 metric 150 && fx shell ifconfig ethp04 && \
>      fx shell ifconfig route show
>     (Route is added, with gateway, metric is 150, not tracking ethp04, sorted
>     below the other routes on ethp04 due to higher metric)
> 
>    fx shell ifconfig route add 0.0.0.0/0 iface ethp04 gateway 192.168.30.1 \
>      metric 110 && fx shell ifconfig ethp04 && fx shell ifconfig route show
>     (Default is added, with gateway 192.168.30.1, metric 110 not tracking
>     ethp04, sorted below other default routes due to higher metric)
> 
>    fx shell ifconfig ethp04 metric 200 && fx shell ifconfig ethp04 && \
>      fx shell ifconfig route show
>     (all routes tracking ethp04's are updated to metric=200 and the table is
>     resorted)
> 
>     fx shell ifconfig route del 0.0.0.0/0 iface ethp04 && \
>       fx shell ifconfig ethp04 && fx shell ifconfig route show
>     (Removes default route on ethp04)
> 
>    fx shell ifconfig route del 192.168.30.0/24 && fx shell ifconfig ethp04 && \
>      fx shell ifconfig route show
> 
>    fx shell ifconfig route del 192.168.20.0/24 && fx shell ifconfig ethp04 && \
>      fx shell ifconfig route show
>     (Removes 192.168.{30,20}/24 routes)
> 
>    fx shell ifconfig ethp04 del 192.168.10.3/24 && fx shell ifconfig ethp04 && \
>      fx shell ifconfig route show
>     (IP and route are removed)
> 
> Change-Id: Id6b4232986493ec313d29d4f236461c491eeda2e

TBR=stijlist@google.com,tamird@google.com,eyalsoha@google.com,brunodalbo@google.com,ckuiper@google.com

Change-Id: I70843342680d315447b29db62de4b83f6bb7754c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
25 files changed
tree: 8959253443d81b91d4a6d390aaecb6df4404bf6e
  1. boards/
  2. build/
  3. buildtools/
  4. bundles/
  5. docs/
  6. garnet/
  7. peridot/
  8. products/
  9. scripts/
  10. sdk/
  11. src/
  12. zircon/
  13. .clang-format
  14. .dir-locals.el
  15. .gitattributes
  16. .gitignore
  17. AUTHORS
  18. CODE_OF_CONDUCT.md
  19. CONTRIBUTING.md
  20. LICENSE
  21. OWNERS
  22. PATENTS
  23. README.md
  24. rustfmt.toml
README.md

Fuchsia

Pink + Purple == Fuchsia (a new operating system)

What is Fuchsia?

Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.

Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See the documentation.