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
749cde1c
Commit
749cde1c
authored
Apr 07, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: more tweaks / fixes for #1524
parent
1be6437c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
19 deletions
+18
-19
rc.newwanip
src/etc/rc.newwanip
+6
-8
rc.newwanipv6
src/etc/rc.newwanipv6
+12
-11
No files found.
src/etc/rc.newwanip
View file @
749cde1c
...
@@ -48,7 +48,8 @@ if (isset($argv[1])) {
...
@@ -48,7 +48,8 @@ if (isset($argv[1])) {
}
else
{
}
else
{
$argument
=
null
;
$argument
=
null
;
}
}
log_error
(
"rc.newwanip: Informational is starting
{
$argument
}
."
);
log_error
(
"Informational is starting '
{
$argument
}
'"
);
if
(
empty
(
$argument
))
{
if
(
empty
(
$argument
))
{
$interface
=
"wan"
;
$interface
=
"wan"
;
...
@@ -61,11 +62,8 @@ if (empty($argument)) {
...
@@ -61,11 +62,8 @@ if (empty($argument)) {
$interface_descr
=
convert_friendly_interface_to_friendly_descr
(
$interface
);
$interface_descr
=
convert_friendly_interface_to_friendly_descr
(
$interface
);
/* If the interface is configured and not enabled, bail. We do not need to change settings for disabled interfaces. #3313 */
/* If the interface is configured and not enabled, bail. We do not need to change settings for disabled interfaces. #3313 */
if
(
is_array
(
$config
[
'interfaces'
][
$interface
])
&&
!
isset
(
$config
[
'interfaces'
][
$interface
][
'enable'
]))
{
if
(
!
isset
(
$config
[
'interfaces'
][
$interface
][
'enable'
]))
{
log_error
(
"Interface is disabled, nothing to do."
);
log_error
(
"Interface is disabled or empty, nothing to do."
);
return
;
}
elseif
(
empty
(
$interface
))
{
log_error
(
"Interface is empty, nothing to do."
);
return
;
return
;
}
}
...
@@ -78,7 +76,7 @@ if (empty($argument)) {
...
@@ -78,7 +76,7 @@ if (empty($argument)) {
}
}
}
}
log_error
(
"
rc.newwanip: o
n (IP address:
{
$curwanip
}
) (interface:
{
$interface_descr
}
[
{
$interface
}
]) (real interface:
{
$interface_real
}
)."
);
log_error
(
"
O
n (IP address:
{
$curwanip
}
) (interface:
{
$interface_descr
}
[
{
$interface
}
]) (real interface:
{
$interface_real
}
)."
);
/*
/*
* NOTE: Take care of openvpn, no-ip or similar interfaces if you generate the event to reconfigure an interface.
* NOTE: Take care of openvpn, no-ip or similar interfaces if you generate the event to reconfigure an interface.
...
@@ -87,7 +85,7 @@ log_error("rc.newwanip: on (IP address: {$curwanip}) (interface: {$interface_des
...
@@ -87,7 +85,7 @@ log_error("rc.newwanip: on (IP address: {$curwanip}) (interface: {$interface_des
if
(
$curwanip
==
"0.0.0.0"
||
!
is_ipaddr
(
$curwanip
))
{
if
(
$curwanip
==
"0.0.0.0"
||
!
is_ipaddr
(
$curwanip
))
{
if
(
substr
(
$interface_real
,
0
,
4
)
!=
"ovpn"
)
{
if
(
substr
(
$interface_real
,
0
,
4
)
!=
"ovpn"
)
{
if
(
!
empty
(
$config
[
'interfaces'
][
$interface
][
'ipaddr'
]))
{
if
(
!
empty
(
$config
[
'interfaces'
][
$interface
][
'ipaddr'
]))
{
log_error
(
"
rc.newwanip:
Failed to update
{
$interface
}
IP, restarting..."
);
log_error
(
"Failed to update
{
$interface
}
IP, restarting..."
);
configd_run
(
"interface reconfigure
{
$interface
}
"
);
configd_run
(
"interface reconfigure
{
$interface
}
"
);
return
;
return
;
}
}
...
...
src/etc/rc.newwanipv6
View file @
749cde1c
...
@@ -37,10 +37,15 @@ require_once("util.inc");
...
@@ -37,10 +37,15 @@ require_once("util.inc");
require_once
(
"system.inc"
);
require_once
(
"system.inc"
);
require_once
(
"interfaces.inc"
);
require_once
(
"interfaces.inc"
);
// Do not process while booting
if
(
file_exists
(
'/var/run/booting'
))
{
return
;
}
/* Interface IP address has changed */
/* Interface IP address has changed */
$argument
=
trim
(
$argv
[
1
],
"
\n\t
"
);
$argument
=
trim
(
$argv
[
1
],
"
\n\t
"
);
log_error
(
"
rc.newwanipv6: Informational is starting
{
$argument
}
.
"
);
log_error
(
"
Informational is starting '
{
$argument
}
'
"
);
if
(
empty
(
$argument
))
{
if
(
empty
(
$argument
))
{
$interface
=
"wan"
;
$interface
=
"wan"
;
...
@@ -54,13 +59,9 @@ if (empty($argument)) {
...
@@ -54,13 +59,9 @@ if (empty($argument)) {
$interface_descr
=
convert_friendly_interface_to_friendly_descr
(
$interface
);
$interface_descr
=
convert_friendly_interface_to_friendly_descr
(
$interface
);
if
(
empty
(
$interface
))
{
/* If the interface is configured and not enabled, bail. We do not need to change settings for disabled interfaces. #3313 */
filter_configure
();
if
(
!
isset
(
$config
[
'interfaces'
][
$interface
][
'enable'
]))
{
return
;
log_error
(
"Interface is disabled or empty, nothing to do."
);
}
//Do not process while booting
if
(
file_exists
(
"/var/run/booting"
)
&&
$config
[
'interfaces'
][
$interface
][
'ipaddrv6'
]
!=
"dhcp6"
)
{
return
;
return
;
}
}
...
@@ -69,7 +70,7 @@ if (file_exists("/var/run/booting") && $config['interfaces'][$interface]['ipaddr
...
@@ -69,7 +70,7 @@ if (file_exists("/var/run/booting") && $config['interfaces'][$interface]['ipaddr
* i.e. OpenVPN might be in tap mode and not have an ip.
* i.e. OpenVPN might be in tap mode and not have an ip.
*/
*/
if
((
empty
(
$curwanipv6
)
||
!
is_ipaddrv6
(
$curwanipv6
))
&&
substr
(
$interface_real
,
0
,
4
)
!=
"ovpn"
)
{
if
((
empty
(
$curwanipv6
)
||
!
is_ipaddrv6
(
$curwanipv6
))
&&
substr
(
$interface_real
,
0
,
4
)
!=
"ovpn"
)
{
log_error
(
"
rc.newwanipv6:
Failed to detect IPv6 for
{
$interface_descr
}
[
{
$interface
}
]"
);
log_error
(
"Failed to detect IPv6 for
{
$interface_descr
}
[
{
$interface
}
]"
);
return
;
return
;
}
}
...
@@ -96,7 +97,7 @@ if (is_ipaddrv6($curwanipv6)) {
...
@@ -96,7 +97,7 @@ if (is_ipaddrv6($curwanipv6)) {
@
file_put_contents
(
"/var/db/
{
$interface
}
_ipv6"
,
$curwanipv6
);
@
file_put_contents
(
"/var/db/
{
$interface
}
_ipv6"
,
$curwanipv6
);
}
}
log_error
(
"
rc.newwanipv6: o
n (IP address:
{
$curwanipv6
}
) (interface:
{
$interface
}
) (real interface:
{
$interface_real
}
)."
);
log_error
(
"
O
n (IP address:
{
$curwanipv6
}
) (interface:
{
$interface
}
) (real interface:
{
$interface_real
}
)."
);
$oldipv6
=
@
file_get_contents
(
"/var/db/
{
$interface
}
_cacheipv6"
);
$oldipv6
=
@
file_get_contents
(
"/var/db/
{
$interface
}
_cacheipv6"
);
...
@@ -123,7 +124,7 @@ if (!is_ipaddr($oldipv6) || $curwanipv6 != $oldipv6 || !is_ipaddrv6($config['int
...
@@ -123,7 +124,7 @@ if (!is_ipaddr($oldipv6) || $curwanipv6 != $oldipv6 || !is_ipaddrv6($config['int
}
}
}
}
if
(
is_ipaddrv6
(
$curwanip
))
{
if
(
is_ipaddrv6
(
$curwanip
v6
))
{
@
file_put_contents
(
"/var/db/
{
$interface
}
_cacheipv6"
,
$curwanipv6
);
@
file_put_contents
(
"/var/db/
{
$interface
}
_cacheipv6"
,
$curwanipv6
);
}
}
...
...
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