Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
75e7e0e4
Commit
75e7e0e4
authored
Sep 15, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup carp_status.php
parent
51aec445
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
40 deletions
+33
-40
interfaces.inc
src/etc/inc/interfaces.inc
+5
-0
carp_status.php
src/www/carp_status.php
+28
-40
No files found.
src/etc/inc/interfaces.inc
View file @
75e7e0e4
...
...
@@ -1918,6 +1918,11 @@ function interface_carp_configure(&$vip)
return
;
}
// when CARP is temporary disabled, don't try to configure on any interface-up events
if
(
get_single_sysctl
(
'net.inet.carp.allow'
)
==
'0'
)
{
return
;
}
/* NOTE: Maybe its useless nowdays */
$realif
=
get_real_interface
(
$vip
[
'interface'
]);
if
(
!
does_interface_exist
(
$realif
))
{
...
...
src/www/carp_status.php
View file @
75e7e0e4
...
...
@@ -30,28 +30,6 @@
require_once
(
"guiconfig.inc"
);
require_once
(
"interfaces.inc"
);
function
interfaces_carp_set_maintenancemode
(
$carp_maintenancemode
)
{
global
$config
;
if
(
isset
(
$config
[
"virtualip_carp_maintenancemode"
])
&&
$carp_maintenancemode
==
false
)
{
unset
(
$config
[
"virtualip_carp_maintenancemode"
]);
write_config
(
"Leave CARP maintenance mode"
);
}
elseif
(
!
isset
(
$config
[
"virtualip_carp_maintenancemode"
])
&&
$carp_maintenancemode
==
true
)
{
$config
[
"virtualip_carp_maintenancemode"
]
=
true
;
write_config
(
"Enter CARP maintenance mode"
);
}
if
(
isset
(
$config
[
'virtualip'
][
'vip'
]))
{
$viparr
=
&
$config
[
'virtualip'
][
'vip'
];
foreach
(
$viparr
as
$vip
)
{
if
(
$vip
[
'mode'
]
==
'carp'
)
{
interface_carp_configure
(
$vip
);
}
}
}
}
// init $config['virtualip']['vip']
if
(
!
isset
(
$config
[
'virtualip'
][
'vip'
])
||
!
is_array
(
$config
[
'virtualip'
][
'vip'
]))
{
$config
[
'virtualip'
][
'vip'
]
=
array
();
...
...
@@ -59,35 +37,45 @@ if ( !isset($config['virtualip']['vip']) || !is_array($config['virtualip']['vip'
$a_vip
=
&
$config
[
'virtualip'
][
'vip'
];
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
$act
=
null
;
if
(
!
empty
(
$_POST
[
'carp_maintenancemode'
]))
{
interfaces_carp_set_maintenancemode
(
!
isset
(
$config
[
"virtualip_carp_maintenancemode"
]));
$act
=
"maintenance"
;
if
(
isset
(
$config
[
"virtualip_carp_maintenancemode"
]))
{
unset
(
$config
[
"virtualip_carp_maintenancemode"
]);
write_config
(
"Leave CARP maintenance mode"
);
}
else
{
$config
[
"virtualip_carp_maintenancemode"
]
=
true
;
write_config
(
"Enter CARP maintenance mode"
);
}
}
elseif
(
!
empty
(
$_POST
[
'disablecarp'
]))
{
if
(
get_single_sysctl
(
'net.inet.carp.allow'
)
>
0
)
{
$carp_counter
=
0
;
$act
=
"disable"
;
$savemsg
=
gettext
(
"All virtual IPs have been disabled. Please note that disabling does not survive a reboot."
);
set_single_sysctl
(
'net.inet.carp.allow'
,
'0'
);
foreach
(
$a_vip
as
$vip
)
{
switch
(
$vip
[
'mode'
])
{
case
"carp"
:
interface_vip_bring_down
(
$vip
);
$carp_counter
++
;
sleep
(
1
);
break
;
}
}
$savemsg
=
sprintf
(
gettext
(
"%s IPs have been disabled. Please note that disabling does not survive a reboot."
),
$carp_counter
);
}
else
{
$act
=
"enable"
;
$savemsg
=
gettext
(
"CARP has been enabled."
);
interfaces_carp_setup
();
set_single_sysctl
(
'net.inet.carp.allow'
,
'1'
);
}
foreach
(
$a_vip
as
$vip
)
{
switch
(
$vip
[
'mode'
])
{
case
"carp"
:
if
(
$vip
[
'mode'
]
==
'carp'
)
{
switch
(
$act
)
{
case
'maintenance'
:
interface_carp_configure
(
$vip
);
break
;
case
'disable'
:
interface_vip_bring_down
(
$vip
);
break
;
case
'enable'
:
interface_carp_configure
(
$vip
);
sleep
(
1
);
break
;
default
:
break
;
}
}
interfaces_carp_setup
();
set_single_sysctl
(
'net.inet.carp.allow'
,
'1'
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment