26.03 Diagnostics, Arp Table, WOL button links. colons replaced by percent 3A, not accepted by WOL page
-
hi , did a quick search to look for a duplicate forum post
Under Diagnostics, Arp Table,
in the Actions column, the WOL button links,are not working On Plus 26.03-RELEASE (sg-5100)
The mac address' colons are replaced with percent encoding
href linkslook like
https://172.16.3.253/services_wol.php?if=lan&mac=11%3A22%3A33%3A9b%3A9b%3A72The WOL page errors out with
A valid MAC address must be specified.
with the percent encoded string in the the mac address field,
instead of a colon seprated mac address.The wol buttons are working in
Community edition 2.8.1-RELEASE (amd64)
and Plus 25.07.1-RELEASE
with href link of format like
https://192.168.60.1/services_wol.php?if=lan&mac=00:11:22:21:0f:b0 -
@ay On 25.07 what is the full URL you see when on the /services_wol.php page? On 26.03 /services_wol.php shows the error but the URL does not have the querystring...I am wondering if a GET was changed to POST (upon clicking the link on /diag_arp.php) and the field on /services_wol.php is not decoded before processing.
The states view page was changed at one point, GET to POST, and as a result one can't right click and open the link in a new tab, because it's not arriving as a POST.
-
Looks like the way various other pages send the MAC to the WOL page was handled inconsistently and it wasn't being encoded/decoded the same way depending on where the WOL links were.
This patch should fix it up:
diff --git a/src/usr/local/www/services_wol.php b/src/usr/local/www/services_wol.php index 83014d78a1..f6d14828c9 100644 --- a/src/usr/local/www/services_wol.php +++ b/src/usr/local/www/services_wol.php @@ -69,7 +69,7 @@ if ($_POST['Submit'] || $_POST['mac']) { if ($_POST['mac']) { /* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ - $mac = strtolower(str_replace("-", ":", $_POST['mac'])); + $mac = strtolower(str_replace("-", ":", urldecode($_POST['mac']))); $if = $_POST['if']; } @@ -193,7 +193,7 @@ print $form; <?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($wolent['interface']));?> </td> <td> - <a href="?mac=<?=$wolent['mac'];?>&if=<?=urlencode($wolent['interface']);?>" usepost><?=strtolower($wolent['mac']);?></a> + <a href="?mac=<?=urlencode($wolent['mac']);?>&if=<?=urlencode($wolent['interface']);?>" usepost><?=strtolower($wolent['mac']);?></a> </td> <td> <?=htmlspecialchars($wolent['descr']);?> @@ -201,7 +201,7 @@ print $form; <td> <a class="fa-solid fa-pencil" title="<?=gettext('Edit Device')?>" href="services_wol_edit.php?id=<?=$i?>"></a> <a class="fa-solid fa-trash-can" title="<?=gettext('Delete Device')?>" href="services_wol.php?act=del&id=<?=$i?>" usepost></a> - <a class="fa-solid fa-power-off" title="<?=gettext('Wake Device')?>" href="?mac=<?=$wolent['mac'];?>&if=<?=urlencode($wolent['interface']);?>" usepost></a> + <a class="fa-solid fa-power-off" title="<?=gettext('Wake Device')?>" href="?mac=<?=urlencode($wolent['mac']);?>&if=<?=urlencode($wolent['interface']);?>" usepost></a> </td> </tr> <?php endforeach?> diff --git a/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php b/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php index 252fc9ad51..3a9f28e556 100644 --- a/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php +++ b/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php @@ -129,7 +129,7 @@ if (count($wolcomputers) > 0): <?php endif; ?> </td> <td> - <a href="services_wol.php?mac=<?= $wolent['mac'] ?>&if=<?= urlencode($wolent['interface']) ?>" usepost> + <a href="services_wol.php?mac=<?= urlencode($wolent['mac']) ?>&if=<?= urlencode($wolent['interface']) ?>" usepost> <i class="fa-solid fa-power-off" data-toggle="tooltip" title="<?= gettext("Wake up!") ?>"></i> </a> </td> -
@jimp I just tested this - and yup seems to clear it up.. WOL button now works from Arp Table in 26.03