Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaser committed Sep 18, 2024
1 parent 7719051 commit 0db99bc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

function applyGRO() {
function applyGRO()
{
$ip_route = json_decode(implode(run_command('ip -j route get 8.8.8.8')), true);

// Check if a device was returned
if(!isset($ip_route[0]['dev'])) {
if ( ! isset($ip_route[0]['dev'])) {
logmsg("Default interface could not be detected.");
return;
}
Expand All @@ -13,11 +14,11 @@ function applyGRO() {

$ethtool = json_decode(implode(run_command("ethtool --json -k {$dev}")), true)[0];

if(isset($ethtool['rx-udp-gro-forwarding']) && !$ethtool['rx-udp-gro-forwarding']['active']) {
if (isset($ethtool['rx-udp-gro-forwarding']) && ! $ethtool['rx-udp-gro-forwarding']['active']) {
run_command("ethtool -K {$dev} rx-udp-gro-forwarding on");
}

if(isset($ethtool['rx-gro-list']) && $ethtool['rx-gro-list']['active']) {
if (isset($ethtool['rx-gro-list']) && $ethtool['rx-gro-list']['active']) {
run_command("ethtool -K {$dev} rx-gro-list off");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ function logmsg($message, $priority = LOG_INFO)
$timestamp = date('Y/m/d H:i:s');
$filename = basename($_SERVER['PHP_SELF']);
file_put_contents("/var/log/tailscale-utils.log", "{$timestamp} {$filename}: {$message}" . PHP_EOL, FILE_APPEND);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ function run_command($command, $alwaysShow = false, $show = true)
}

return $output;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

applyGRO();
applyGRO();
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

applyGRO();
applyGRO();
2 changes: 1 addition & 1 deletion src/usr/local/emhttp/plugins/tailscale/pre-startup.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

foreach (glob("{$docroot}/plugins/tailscale/include/pre-startup/*.php") as $file) {
logmsg("Executing {$file}");
try {
try {
require_once $file;
} catch (Throwable $e) {
logmsg("Caught exception in {$file} : " . $e->getMessage());
Expand Down

0 comments on commit 0db99bc

Please sign in to comment.