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 r a via no longer works #45

Closed arekm closed 11 months ago

arekm commented 2 years ago

1.4.1:

# ip r a 1.1.1.1 via 2.2.2.2 dev utun5
Usage: ip route list
       ip route get ADDRESS
       ip route { add | del | replace } ROUTE
       ip route flush cache
       ip route flush table main
ROUTE := NODE_SPEC [ INFO_SPEC ]
NODE_SPEC := [ TYPE ] PREFIX
INFO_SPEC := NH
TYPE := { blackhole }
NH := { via ADDRESS | gw ADDRESS | nexthop ADDRESS | dev STRING }

I think it worked before.

brona commented 2 years ago

Thanks for reporting the issue, I don't think this worked before. The implemented logic as-is, allows either IP address nexthop or dev nexthop, not both.

I can look into it, but probably not anytime soon. Out of curiosity why do you have to specify both in your setup?

arekm commented 2 years ago

Did bisect. It worked until

commit 4bd9c42dbf58bb5bc4edc46088cdc2901a086f86 (refs/bisect/bad)
Author: Brona <brona@robenek.me>
Date:   Sun Mar 20 21:57:14 2022 +0100

    Fix blackhole routes and minor clean up

but "worked" means it didn't throw error only

% ./src/ip.py r a 1.1.1.1 via 2.2.2.2 dev xxx
Executing: /usr/bin/sudo /sbin/route add 1.1.1.1 2.2.2.2

I don't need this on this setup (and didn't notice that dev xxx was just ignored earlier). I was using this on Linux commonly though.

(such way can be needed when the same IP is reachable thru multiple interfaces)

brona commented 11 months ago

Fixed in 228e3e0, will be part of the next release.