get_interface_ip() returns first IP on interface, not necessarily primary IP
In some circumstances, IPs can be added/removed from an interface in such ways that an interface's primary IP is no longer the first IP in ifconfig output. This leads to issues as described in #3811 and #2495 for instance.
Ermal's long since fixed most of these possibilities by ensuring consistency in IP change/add/remove. There are circumstances where this fails catastrophically though.
assigning to myself for further testing and analysis. Ermal, if you can add thoughts here it'd be appreciated.
Ticket #3997, teach code to track carp through uniqids(). Missing carp GUI changes and upgrade code
#8 Updated by Mike Noordermeer about 5 years ago
Interfaces config, slightly censored: https://gist.github.com/MikeN123/009bc5fb76347663e448
Virtual IP config, slightly censored as well: https://gist.github.com/MikeN123/86fd05a7fb4b3c1f75de
Please let me know if you need any additional information.
#9 Updated by Mike Noordermeer about 5 years ago
Oh, and bridges and gateway config: https://gist.github.com/MikeN123/22d50fa3d37834b9659a
#14 Updated by Chris Buechler about 4 years ago
This happens with bridges during boot because in interfaces_configure, interfaces_vips_configure is run before the interface_configure of the bridge interface, which leaves the IP alias first. There are a variety of catch 22s there with dynamic interface types (GRE, gif at least) because they may be dependent on VIPs, and the bridge may be dependent on them.
It works upon applying changes on interfaces.php because that uses interface_reconfigure rather than interface_configure, the process of which removes the IP aliases and adds them back so their order is correct.
#15 Updated by Chris Buechler about 4 years ago
- Status changed from Confirmed to Feedback
what I just pushed fixes the bridge issue.
The subject issue still exists and is difficult because FreeBSD has no concept of a primary IP on an interface. The bridge scenario should be the only circumstance that was still an issue in 2.2.x and 2.3, as the remainder of interface types are all handled correctly in that regard to ensure appropriate order of IPs.
Leaving to feedback for a bit more testing.