One part of my application is in charge of modifying the network configuration through the SystemConfiguration library. More specifically, I temporarily add entries under
State:/Network/Service/Temp/DNS
State:/Network/Service/Temp/IPv4
State:/Network/Service/Temp/IPv6
I have noticed (at least in macOS Catalina) that the Default IPv6 route does not get properly restored if I do this. I can get it back by turning Off and On the network adapter, but I believe that should normally not be necessary.
The steps to reproduce this are:
1) Configure a manual IPv6 address for the network adapter, for example:
Code Block Router: 2001:db8:abcd:12::1 Address: 2001:db8:abcd:12::7 Prefix Length: 64
2) Check that the default IPv6 route is present through 'netsat -nr'
Code Block language Internet6: Destination Gateway Flags Netif Expire default 2001:db8:abcd:12::1 UGc en0 default fe80::%utun0 UGcI utun0 default fe80::%utun1 UGcI utun1
3) Add an IPv6 entry using scutil
Code Block language d.init d.add Addresses * 2001:db8:abcd:12::7 d.add InterfaceName en0 d.add PrefixLength * 64 d.add Router 2001:db8:abcd:12::1 set State:/Network/Service/Temp/IPv6
4) Default IPv6 route is still present
Code Block language Internet6: Destination Gateway Flags Netif Expire default 2001:db8:abcd:12::1 UGc en0 default fe80::%utun0 UGcI utun0 default fe80::%utun1 UGcI utun1
5) Remove Temp entry
Code Block language remove State:/Network/Service/Temp/IPv6
6) Default IPv6 route is gone
Code Block language Internet6: Destination Gateway Flags Netif Expire default fe80::%utun0 UGcI utun0 default fe80::%utun1 UGcI utun1
7) Restart network adapter
8) Default IPv6 route reappears
Code Block language Internet6: Destination Gateway Flags Netif Expire default 2001:db8:abcd:12::1 UGc en0 default fe80::%utun0 UGcI utun0 default fe80::%utun1 UGcI utun1
So, I wanted to know if I'm correctly assuming that the default route should not disappear after removing the IPv6 entry, and if there's any workaround I could use from within my application other than manually restarting the network adapter.
Thanks!