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
90daae43
Commit
90daae43
authored
Jul 07, 2015
by
Ad Schellevis
Committed by
Franco Fichtner
Jul 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) some more code fixes
parent
4ea0d90d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
46 deletions
+56
-46
filter.inc
src/etc/inc/filter.inc
+5
-4
openvpn.inc
src/etc/inc/openvpn.inc
+3
-2
rrd.inc
src/etc/inc/rrd.inc
+1
-1
services.inc
src/etc/inc/services.inc
+21
-18
system.inc
src/etc/inc/system.inc
+6
-6
util.inc
src/etc/inc/util.inc
+1
-1
rc.newwanip
src/etc/rc.newwanip
+19
-14
No files found.
src/etc/inc/filter.inc
View file @
90daae43
...
...
@@ -1716,7 +1716,7 @@ function filter_nat_rules_generate() {
$natrules
.=
filter_nat_rules_generate_if
(
$a_out
[
'interface'
],
$a_out
[
'source'
][
'network'
],
$a_out
[
'sourceport'
],
$a_out
[
'destination'
][
'address'
]
,
isset
(
$a_out
[
'destination'
][
'address'
])
?
$a_out
[
'destination'
][
'address'
]
:
null
,
$a_out
[
'dstport'
],
$a_out
[
'target'
],
$a_out
[
'natport'
],
...
...
@@ -2254,12 +2254,12 @@ function filter_generate_user_rule($rule)
}
/* check for unresolvable aliases */
if
(
$rule
[
'source'
][
'address'
]
&&
!
alias_expand
(
$rule
[
'source'
][
'address'
]))
{
if
(
isset
(
$rule
[
'source'
][
'address'
])
&&
!
alias_expand
(
$rule
[
'source'
][
'address'
]))
{
$error_text
=
"Unresolvable source alias '
{
$rule
[
'source'
][
'address'
]
}
' for rule '
{
$rule
[
'descr'
]
}
'"
;
file_notice
(
"Filter_Reload"
,
$error_text
);
return
"#
{
$error_text
}
"
;
}
if
(
$rule
[
'destination'
][
'address'
]
&&
!
alias_expand
(
$rule
[
'destination'
][
'address'
]))
{
if
(
isset
(
$rule
[
'destination'
][
'address'
])
&&
!
alias_expand
(
$rule
[
'destination'
][
'address'
]))
{
$error_text
=
"Unresolvable destination alias '
{
$rule
[
'destination'
][
'address'
]
}
' for rule '
{
$rule
[
'descr'
]
}
'"
;
file_notice
(
"Filter_Reload"
,
$error_text
);
return
"#
{
$error_text
}
"
;
...
...
@@ -2370,6 +2370,7 @@ function filter_generate_user_rule($rule)
default
:
$aline
[
'dscp'
]
=
" dscp "
.
$rule
[
'dscp'
]
.
" "
;
break
;
}
}
$aline
[
'allowopts'
]
=
""
;
if
(
$type
==
"pass"
)
{
if
(
isset
(
$rule
[
'allowopts'
]))
$aline
[
'allowopts'
]
=
" allow-opts "
;
...
...
@@ -2858,7 +2859,7 @@ EOD;
}
break
;
default
:
if
(
(
is_array
(
$config
[
'dhcpdv6'
][
$on
])
&&
isset
(
$config
[
'dhcpdv6'
][
$on
][
'enable'
])
)
||
isset
(
$oc
[
'track6-interface'
])
if
(
isset
(
$config
[
'dhcpdv6'
][
$on
][
'enable'
]
)
||
isset
(
$oc
[
'track6-interface'
])
||
(
is_array
(
$config
[
'dhcrelay6'
])
&&
!
empty
(
$config
[
'dhcrelay6'
][
'interface'
])
&&
in_array
(
$on
,
explode
(
','
,
$config
[
'dhcrelay6'
][
'interface'
]))))
{
$ipfrules
.=
<<<EOD
# allow access to DHCPv6 server on {$oc['descr']}
...
...
src/etc/inc/openvpn.inc
View file @
90daae43
...
...
@@ -953,8 +953,9 @@ function openvpn_resync_all($interface = '')
openvpn_create_dirs
();
if
(
!
is_array
(
$config
[
'openvpn'
]))
$config
[
'openvpn'
]
=
array
();
if
(
!
isset
(
$config
[
'openvpn'
])
||
!
is_array
(
$config
[
'openvpn'
]))
{
return
;
}
if
(
$interface
<>
""
)
log_error
(
"Resyncing OpenVPN instances for interface "
.
convert_friendly_interface_to_friendly_descr
(
$interface
)
.
"."
);
...
...
src/etc/inc/rrd.inc
View file @
90daae43
...
...
@@ -368,7 +368,7 @@ function enable_rrd_graphing()
$rrdupdatesh
.=
"END {print b4pi
\"
:
\"
b4po
\"
:
\"
b4bi
\"
:
\"
b4bo
\"
:
\"
b6pi
\"
:
\"
b6po
\"
:
\"
b6bi
\"
:
\"
b6bo};'`
\n
"
;
/* WIRELESS, set up the rrd file */
if
(
$config
[
'interfaces'
][
$ifname
][
'wireless'
][
'mode'
]
==
"bss"
)
{
if
(
isset
(
$config
[
'interfaces'
][
$ifname
][
'wireless'
][
'mode'
])
&&
$config
[
'interfaces'
][
$ifname
][
'wireless'
][
'mode'
]
==
"bss"
)
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$wireless
"
))
{
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$wireless
--step
$rrdwirelessinterval
"
;
$rrdcreate
.=
"DS:snr:GAUGE:
$wirelessvalid
:0:1000 "
;
...
...
src/etc/inc/services.inc
View file @
90daae43
...
...
@@ -1376,7 +1376,7 @@ function services_igmpproxy_configure() {
/* kill any running igmpproxy */
killbyname
(
"igmpproxy"
);
if
(
!
is_array
(
$config
[
'igmpproxy'
][
'igmpentry'
])
||
(
count
(
$config
[
'igmpproxy'
][
'igmpentry'
])
==
0
))
if
(
!
is
set
(
$config
[
'igmpproxy'
][
'igmpentry'
])
||
!
is
_array
(
$config
[
'igmpproxy'
][
'igmpentry'
])
||
(
count
(
$config
[
'igmpproxy'
][
'igmpentry'
])
==
0
))
return
1
;
$iflist
=
get_configured_interface_list
();
...
...
@@ -1727,24 +1727,27 @@ function services_dyndns_configure($int = '')
{
global
$config
,
$g
;
$dyndnscfg
=
$config
[
'dyndnses'
][
'dyndns'
];
$gwgroups
=
return_gateway_groups_array
();
if
(
is_array
(
$dyndnscfg
))
{
if
(
file_exists
(
"/var/run/booting"
))
echo
gettext
(
"Starting DynDNS clients..."
);
foreach
(
$dyndnscfg
as
$dyndns
)
{
if
((
empty
(
$int
))
||
(
$int
==
$dyndns
[
'interface'
])
||
(
is_array
(
$gwgroups
[
$dyndns
[
'interface'
]])))
{
$dyndns
[
'verboselog'
]
=
isset
(
$dyndns
[
'verboselog'
]);
$dyndns
[
'curl_ipresolve_v4'
]
=
isset
(
$dyndns
[
'curl_ipresolve_v4'
]);
$dyndns
[
'curl_ssl_verifypeer'
]
=
isset
(
$dyndns
[
'curl_ssl_verifypeer'
]);
services_dyndns_configure_client
(
$dyndns
);
sleep
(
1
);
if
(
isset
(
$config
[
'dyndnses'
][
'dyndns'
]))
{
$dyndnscfg
=
$config
[
'dyndnses'
][
'dyndns'
];
$gwgroups
=
return_gateway_groups_array
();
if
(
is_array
(
$dyndnscfg
))
{
if
(
file_exists
(
"/var/run/booting"
))
echo
gettext
(
"Starting DynDNS clients..."
);
foreach
(
$dyndnscfg
as
$dyndns
)
{
if
((
empty
(
$int
))
||
(
$int
==
$dyndns
[
'interface'
])
||
(
is_array
(
$gwgroups
[
$dyndns
[
'interface'
]])))
{
$dyndns
[
'verboselog'
]
=
isset
(
$dyndns
[
'verboselog'
]);
$dyndns
[
'curl_ipresolve_v4'
]
=
isset
(
$dyndns
[
'curl_ipresolve_v4'
]);
$dyndns
[
'curl_ssl_verifypeer'
]
=
isset
(
$dyndns
[
'curl_ssl_verifypeer'
]);
services_dyndns_configure_client
(
$dyndns
);
sleep
(
1
);
}
}
}
if
(
file_exists
(
"/var/run/booting"
))
echo
gettext
(
"done."
)
.
"
\n
"
;
if
(
file_exists
(
"/var/run/booting"
))
echo
gettext
(
"done."
)
.
"
\n
"
;
}
}
return
0
;
...
...
@@ -2157,7 +2160,7 @@ function services_dnsupdate_process($int = '', $updatehost = '', $forced = false
global
$config
,
$g
;
/* Dynamic DNS updating active? */
if
(
is_array
(
$config
[
'dnsupdates'
][
'dnsupdate'
]))
{
if
(
is
set
(
$config
[
'dnsupdates'
][
'dnsupdate'
])
&&
is
_array
(
$config
[
'dnsupdates'
][
'dnsupdate'
]))
{
$notify_text
=
""
;
foreach
(
$config
[
'dnsupdates'
][
'dnsupdate'
]
as
$i
=>
$dnsupdate
)
{
if
(
!
isset
(
$dnsupdate
[
'enable'
]))
...
...
src/etc/inc/system.inc
View file @
90daae43
...
...
@@ -111,7 +111,7 @@ function system_resolvconf_generate($dynupdate = false)
$resolvconf
.=
"nameserver
$nameserver
\n
"
;
}
}
if
(
is_array
(
$syscfg
[
'dnsserver'
]))
{
if
(
is
set
(
$syscfg
[
'dnsserver'
])
&&
is
_array
(
$syscfg
[
'dnsserver'
]))
{
foreach
(
$syscfg
[
'dnsserver'
]
as
$ns
)
{
if
(
$ns
)
$resolvconf
.=
"nameserver
$ns
\n
"
;
...
...
@@ -276,7 +276,7 @@ function system_hosts_generate()
}
if
(
isset
(
$dnsmasqcfg
[
'enable'
]))
{
if
(
!
is_array
(
$dnsmasqcfg
[
'hosts'
]))
if
(
!
is
set
(
$dnsmasqcfg
[
'hosts'
])
||
!
is
_array
(
$dnsmasqcfg
[
'hosts'
]))
$dnsmasqcfg
[
'hosts'
]
=
array
();
foreach
(
$dnsmasqcfg
[
'hosts'
]
as
$host
)
{
...
...
@@ -1328,7 +1328,7 @@ function system_ntp_configure($start_ntpd = true)
@
mkdir
(
$statsdir
,
0755
);
if
(
!
is_array
(
$config
[
'ntpd'
]))
{
if
(
!
is
set
(
$config
[
'ntpd'
])
||
!
is
_array
(
$config
[
'ntpd'
]))
{
$config
[
'ntpd'
]
=
array
();
}
...
...
@@ -1387,7 +1387,7 @@ function system_ntp_configure($start_ntpd = true)
/* End PPS configuration */
/* Add GPS configuration */
if
(
!
empty
(
$config
[
'ntpd'
][
'gps'
]
&&
!
empty
(
$config
[
'ntpd'
][
'gps'
][
'port'
])
)
if
(
isset
(
$config
[
'ntpd'
][
'gps'
][
'port'
]
)
&&
file_exists
(
'/dev/'
.
$config
[
'ntpd'
][
'gps'
][
'port'
])
&&
system_ntp_setup_gps
(
$config
[
'ntpd'
][
'gps'
][
'port'
]))
{
$ntpcfg
.=
"
\n
"
;
...
...
@@ -1462,8 +1462,8 @@ function system_ntp_configure($start_ntpd = true)
/* foreach through ntp servers and write out to ntpd.conf */
foreach
(
explode
(
' '
,
$config
[
'system'
][
'timeservers'
])
as
$ts
)
{
$ntpcfg
.=
"server
{
$ts
}
iburst maxpoll 9"
;
if
(
substr_count
(
$config
[
'ntpd'
][
'prefer'
],
$ts
))
$ntpcfg
.=
' prefer'
;
if
(
substr_count
(
$config
[
'ntpd'
][
'noselect'
],
$ts
))
$ntpcfg
.=
' noselect'
;
if
(
isset
(
$config
[
'ntpd'
][
'prefer'
])
&&
substr_count
(
$config
[
'ntpd'
][
'prefer'
],
$ts
))
$ntpcfg
.=
' prefer'
;
if
(
isset
(
$config
[
'ntpd'
][
'noselect'
])
&&
substr_count
(
$config
[
'ntpd'
][
'noselect'
],
$ts
))
$ntpcfg
.=
' noselect'
;
$ntpcfg
.=
"
\n
"
;
}
unset
(
$ts
);
...
...
src/etc/inc/util.inc
View file @
90daae43
...
...
@@ -1388,7 +1388,7 @@ function mute_kernel_msgs()
{
global
$config
;
if
(
$config
[
'system'
][
'enableserial'
]
)
{
if
(
isset
(
$config
[
'system'
][
'enableserial'
])
)
{
return
;
}
...
...
src/etc/rc.newwanip
View file @
90daae43
...
...
@@ -45,8 +45,11 @@ if (file_exists('/var/run/booting')) {
}
/* Interface IP address has changed */
$argument
=
str_replace
(
"
\n
"
,
""
,
$argv
[
1
]);
if
(
isset
(
$argv
[
1
]))
{
$argument
=
str_replace
(
"
\n
"
,
""
,
$argv
[
1
]);
}
else
{
$argument
=
null
;
}
log_error
(
"rc.newwanip: Informational is starting
{
$argument
}
."
);
if
(
empty
(
$argument
))
{
...
...
@@ -128,21 +131,23 @@ if (!empty($bridgetmp))
system_hosts_generate
();
/* check tunneled IPv6 interface tracking */
switch
(
$config
[
'interfaces'
][
$interface
][
'ipaddrv6'
])
{
case
"6to4"
:
interface_6to4_configure
(
$interface
,
$config
[
'interfaces'
][
$interface
]);
break
;
case
"6rd"
:
interface_6rd_configure
(
$interface
,
$config
[
'interfaces'
][
$interface
]);
break
;
case
"dhcp6"
:
if
(
isset
(
$config
[
'interfaces'
][
$interface
][
'dhcp6usev4iface'
]))
interface_dhcpv6_configure
(
$interface
,
$config
[
'interfaces'
][
$interface
]);
break
;
if
(
isset
(
$config
[
'interfaces'
][
$interface
][
'ipaddrv6'
]))
{
switch
(
$config
[
'interfaces'
][
$interface
][
'ipaddrv6'
])
{
case
"6to4"
:
interface_6to4_configure
(
$interface
,
$config
[
'interfaces'
][
$interface
]);
break
;
case
"6rd"
:
interface_6rd_configure
(
$interface
,
$config
[
'interfaces'
][
$interface
]);
break
;
case
"dhcp6"
:
if
(
isset
(
$config
[
'interfaces'
][
$interface
][
'dhcp6usev4iface'
]))
interface_dhcpv6_configure
(
$interface
,
$config
[
'interfaces'
][
$interface
]);
break
;
}
}
/* Check Gif tunnels */
if
(
is_array
(
$config
[
'gifs'
][
'gif'
])){
if
(
is
set
(
$config
[
'gifs'
][
'gif'
])
&&
is
_array
(
$config
[
'gifs'
][
'gif'
])){
foreach
(
$config
[
'gifs'
][
'gif'
]
as
$gif
)
{
if
(
$gif
[
'if'
]
==
$interface
)
{
foreach
(
$config
[
'interfaces'
]
as
$ifname
=>
$ifparent
)
{
...
...
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