brona / iproute2mac

CLI wrapper for basic network utilites on Mac OS X inspired with iproute2 on Linux systems - ip command.
MIT License
898 stars 73 forks source link

`ip route flush cache` deletes routes on Mac #38

Closed brona closed 2 years ago

brona commented 2 years ago

ip route flush cache triggers route -n flush which deletes all the routes on Mac, while the linux command would only delete routes from cache (which doesn't exist in Linux for quite some time for quite some time).

The current behavior is dangerous as it can break connection as it deletes default route.

See http://linux-ip.net/html/tools-ip-route.html#tools-ip-route-flush-cache for the cache behavior, and http://linux-ip.net/html/tools-ip-route.html#tools-ip-route-flush for the normal behavior.

Since there is no equivalent of route cache on Mac, I suggest:

  1. Convert ip route flush cache to no-op, it will only print it did nothing.
  2. ip route flush will print "ip route flush" requires arguments..
  3. ip route flush table main will do route -n flush
  4. Other arguments will be unsupported for now

This buggy behavior was introduced in #29 by @npeters, do you have any details for your use-case?

brona commented 2 years ago

@npeters do you have any details for your use-case?