diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php index 7404eb43f..61132dcca 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php @@ -75,6 +75,21 @@ class InterfaceController extends ApiControllerBase return $arptable; } + /** + * retrieve system arp table contents + * @return array + */ + public function flushArpAction() + { + if ($this->request->isPost()) { + $backend = new Backend(); + $response = $backend->configdpRun("interface flush arp"); + return $response; + } else { + return array("message" => "error"); + } + } + /** * retrieve system ndp table contents * @return array diff --git a/src/opnsense/mvc/app/views/OPNsense/Diagnostics/arp.volt b/src/opnsense/mvc/app/views/OPNsense/Diagnostics/arp.volt index 49ef1c10f..ba37c7fa6 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Diagnostics/arp.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Diagnostics/arp.volt @@ -61,7 +61,28 @@ POSSIBILITY OF SUCH DAMAGE. } ); } - + + $("#flushModal").click(function(event){ + BootstrapDialog.show({ + type:BootstrapDialog.TYPE_DANGER, + title: "= gettext("Flush ARP Table");?>", + message: "=gettext("If an IP of a host is changed you've probably got that the host has no network connectivity for a period of time. The router has cached the old MAC address (ethernet hardware address) associated with the host's IP address. This cache will persist on the gateway network device until the ARP cache on the gateway network device expires. You can also flush it manually.");?>", + buttons: [{ + label: "= gettext("Close");?>", + action: function(dialogRef) { + dialogRef.close(); + }}, { + label: "= gettext("Flush ARP Table");?>", + action: function(dialogRef) { + ajaxCall(url = "/api/diagnostics/interface/flushArp", + sendData = {}, callback = function (data, status) { + $("#refresh").click(); + }); + } + }] + }); // end BootstrapDialog.show + }); // end .click(function(event) + // initial fetch $("#refresh").click(updateARP); $("#refresh").click(); @@ -96,6 +117,10 @@ POSSIBILITY OF SUCH DAMAGE.