commit | 7705b57b0545b7bb07c05fd400a5b22befaacbe6 | [log] [tgz] |
---|---|---|
author | Nicolas Sylvain <nsylvain@google.com> | Tue Feb 12 06:04:39 2019 +0000 |
committer | CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org> | Tue Feb 12 06:04:53 2019 +0000 |
tree | 8959253443d81b91d4a6d390aaecb6df4404bf6e | |
parent | e7277fa66ae349257cc9fbfc79fd97976e1b35ae [diff] |
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
Pink + Purple == Fuchsia (a new operating system)
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.
See Getting Started.
See the documentation.