这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/etc/inc/system.inc
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ function system_resolvconf_generate($dynupdate = false) {
$resolvconf .= "options edns0\n";
}

// Add options
if (isset($config['system']['resolvconfoptions']) && !empty($config['system']['resolvconfoptions'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty() already checks if variable is set, you can remove isset() call from here

$resolvconf .= base64_decode($config['system']['resolvconfoptions']);
}

$dnslock = lock('resolvconf', LOCK_EX);

$fd = fopen("{$g['etc_path']}/resolv.conf", "w");
Expand Down
20 changes: 20 additions & 0 deletions src/usr/local/www/system_advanced_network.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
$pconfig['disablesegmentationoffloading'] = isset($config['system']['disablesegmentationoffloading']);
$pconfig['disablelargereceiveoffloading'] = isset($config['system']['disablelargereceiveoffloading']);
$pconfig['ip_change_kill_states'] = isset($config['system']['ip_change_kill_states']) ? $config['system']['ip_change_kill_states'] : null;
$pconfig['resolvconfoptions'] = isset($config['system']['resolvconfoptions']) ? base64_decode($config['system']['resolvconfoptions']) : '';

if ($_POST) {

Expand Down Expand Up @@ -173,6 +174,13 @@
unset($config['system']['ip_change_kill_states']);
}

if (!empty(trim($_POST['resolvconfoptions']))) {
$config['system']['resolvconfoptions'] = base64_encode(trim($_POST['resolvconfoptions']));
} else {
unset($config['system']['resolvconfoptions']);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block indentation is wrong. Please use hard tabs with size 8



Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add lines with only spaces like 182 and 183

setup_microcode();

// Write out configuration (config.xml)
Expand Down Expand Up @@ -406,6 +414,18 @@
}

$form->add($section);

// section resolv.conf options
$section = new Form_Section('Add persistent resolv.conf configuration options');

$section->addInput(new Form_Textarea(
'resolvconfoptions',
'Add configuration options',
$pconfig['resolvconfoptions']
))->setHelp('You can add persistent configuration options here.<br/>Lines will be added at the end of the /etc/resolv.conf file.<br/>Example (<a href="https://www.freebsd.org/cgi/man.cgi?query=resolv.conf" target="_new" title="FreeBSD man" >man resolv.conf</a>): <br/>options timeout:1<br/>options attempts:1');

$form->add($section);

print $form;
?>

Expand Down