pfsense/pfsense — pull request #626 by phil-davis (2013-05-07 10:26:30+00:00)
Title: Restore default route after HOTPLUG linkup

When a HOTPLUG linkup event happens, rc.linkup runs. But it was calling interface_configure with parameters that meant system_routing_configure never got called and the default route (and probably other static routes defined to that link and other related stuff) was not set. (The default route seems to be removed somewhere by the kernel if the corresponding interface is physically unplugged.)
This fixes bug #2892 - but I am surprised that it seems such a simple fix and the issue would have been around for a long time (since 2010 or before when the parameters in the interface_configure() call were changed in rc.linkup maybe), so someone who knows more about how all this fits together please think and test in case there are unexpected side-effects.
Note: The way I have changed this call causes interface_configure to execute all the following things when a linkup happens:
if ($reloadall == true) {
/* reconfigure static routes (kernel may have deleted them) */
system_routing_configure($interface);
/* reload ipsec tunnels */
vpn_ipsec_configure();
/* restart dnsmasq */
services_dnsmasq_configure();
/* update dyndns */
send_event("service reload dyndns {$interface}");
/* reload captive portal */
captiveportal_init_rules();
}

It looks to me to be reasonable to do all these on a linkup event - but maybe it should be made to do minimal change and just call system_routing_configure in this case?
I discovered that some of these routines were in modules that needed to be included - hence the additions to interfaces.inc