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
1887fd78
Commit
1887fd78
authored
Apr 27, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interfaces: fix numerous iterators
(cherry picked from commit
7bf795b1
)
parent
d549f747
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
interfaces.inc
src/etc/inc/interfaces.inc
+22
-22
No files found.
src/etc/inc/interfaces.inc
View file @
1887fd78
...
@@ -373,9 +373,8 @@ function interfaces_qinq_configure()
...
@@ -373,9 +373,8 @@ function interfaces_qinq_configure()
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
echo
gettext
(
"Configuring QinQ interfaces..."
);
echo
gettext
(
"Configuring QinQ interfaces..."
);
}
}
if
(
isset
(
$config
[
'qinqs'
][
'qinqentry'
])
&&
is_array
(
$config
[
'qinqs'
][
'qinqentry'
])
)
{
if
(
isset
(
$config
[
'qinqs'
][
'qinqentry'
]))
{
foreach
(
$config
[
'qinqs'
][
'qinqentry'
]
as
$qinq
)
{
foreach
(
$config
[
'qinqs'
][
'qinqentry'
]
as
$qinq
)
{
/* XXX: Maybe we should report any errors?! */
interface_qinq_configure
(
$qinq
);
interface_qinq_configure
(
$qinq
);
}
}
}
}
...
@@ -447,7 +446,7 @@ function interfaces_create_wireless_clones()
...
@@ -447,7 +446,7 @@ function interfaces_create_wireless_clones()
}
}
}
}
if
(
isset
(
$config
[
'wireless'
][
'clone'
])
&&
is_array
(
$config
[
'wireless'
][
'clone'
])
&&
count
(
$config
[
'wireless'
][
'clone'
])
)
{
if
(
isset
(
$config
[
'wireless'
][
'clone'
]))
{
foreach
(
$config
[
'wireless'
][
'clone'
]
as
$clone
)
{
foreach
(
$config
[
'wireless'
][
'clone'
]
as
$clone
)
{
if
(
empty
(
$clone
[
'cloneif'
]))
{
if
(
empty
(
$clone
[
'cloneif'
]))
{
continue
;
continue
;
...
@@ -802,7 +801,7 @@ function interfaces_gre_configure($checkparent = 0, $realif = "")
...
@@ -802,7 +801,7 @@ function interfaces_gre_configure($checkparent = 0, $realif = "")
{
{
global
$config
;
global
$config
;
if
(
isset
(
$config
[
'gres'
][
'gre'
])
&&
is_array
(
$config
[
'gres'
][
'gre'
])
)
{
if
(
isset
(
$config
[
'gres'
][
'gre'
]))
{
foreach
(
$config
[
'gres'
][
'gre'
]
as
$i
=>
$gre
)
{
foreach
(
$config
[
'gres'
][
'gre'
]
as
$i
=>
$gre
)
{
if
(
empty
(
$gre
[
'greif'
]))
{
if
(
empty
(
$gre
[
'greif'
]))
{
$gre
[
'greif'
]
=
"gre
{
$i
}
"
;
$gre
[
'greif'
]
=
"gre
{
$i
}
"
;
...
@@ -904,7 +903,7 @@ function interfaces_gif_configure($checkparent = 0, $realif = "")
...
@@ -904,7 +903,7 @@ function interfaces_gif_configure($checkparent = 0, $realif = "")
{
{
global
$config
;
global
$config
;
if
(
isset
(
$config
[
'gifs'
][
'gif'
])
&&
count
(
$config
[
'gifs'
][
'gif'
])
)
{
if
(
isset
(
$config
[
'gifs'
][
'gif'
]))
{
foreach
(
$config
[
'gifs'
][
'gif'
]
as
$i
=>
$gif
)
{
foreach
(
$config
[
'gifs'
][
'gif'
]
as
$i
=>
$gif
)
{
if
(
empty
(
$gif
[
'gifif'
]))
{
if
(
empty
(
$gif
[
'gifif'
]))
{
$gre
[
'gifif'
]
=
"gif
{
$i
}
"
;
$gre
[
'gifif'
]
=
"gif
{
$i
}
"
;
...
@@ -1397,7 +1396,7 @@ function interfaces_ptpid_used($ptpid)
...
@@ -1397,7 +1396,7 @@ function interfaces_ptpid_used($ptpid)
{
{
global
$config
;
global
$config
;
if
(
is
_array
(
$config
[
'ppps'
][
'ppp'
]))
{
if
(
is
set
(
$config
[
'ppps'
][
'ppp'
]))
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
&
$settings
)
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
&
$settings
)
{
if
(
$ptpid
==
$settings
[
'ptpid'
])
{
if
(
$ptpid
==
$settings
[
'ptpid'
])
{
return
true
;
return
true
;
...
@@ -1424,7 +1423,8 @@ function getMPDCRONSettings($pppif)
...
@@ -1424,7 +1423,8 @@ function getMPDCRONSettings($pppif)
global
$config
;
global
$config
;
$cron_cmd_file
=
"/var/etc/pppoe_restart_
{
$pppif
}
"
;
$cron_cmd_file
=
"/var/etc/pppoe_restart_
{
$pppif
}
"
;
if
(
isset
(
$config
[
'cron'
][
'item'
])
&&
is_array
(
$config
[
'cron'
][
'item'
]))
{
if
(
isset
(
$config
[
'cron'
][
'item'
]))
{
foreach
(
$config
[
'cron'
][
'item'
]
as
$i
=>
$item
)
{
foreach
(
$config
[
'cron'
][
'item'
]
as
$i
=>
$item
)
{
if
(
stripos
(
$item
[
'command'
],
$cron_cmd_file
)
!==
false
)
{
if
(
stripos
(
$item
[
'command'
],
$cron_cmd_file
)
!==
false
)
{
return
array
(
"ID"
=>
$i
,
"ITEM"
=>
$item
);
return
array
(
"ID"
=>
$i
,
"ITEM"
=>
$item
);
...
@@ -1545,7 +1545,7 @@ function interface_ppps_configure($interface)
...
@@ -1545,7 +1545,7 @@ function interface_ppps_configure($interface)
symlink
(
'/usr/local/sbin/mpd.script'
,
'/var/etc/mpd.script'
);
symlink
(
'/usr/local/sbin/mpd.script'
,
'/var/etc/mpd.script'
);
}
}
if
(
isset
(
$config
[
'ppps'
][
'ppp'
])
&&
is_array
(
$config
[
'ppps'
][
'ppp'
])
)
{
if
(
isset
(
$config
[
'ppps'
][
'ppp'
]))
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
$pppid
=>
$ppp
)
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
$pppid
=>
$ppp
)
{
if
(
$ifcfg
[
'if'
]
==
$ppp
[
'if'
])
{
if
(
$ifcfg
[
'if'
]
==
$ppp
[
'if'
])
{
break
;
break
;
...
@@ -1980,7 +1980,7 @@ function interface_proxyarp_configure($interface = '')
...
@@ -1980,7 +1980,7 @@ function interface_proxyarp_configure($interface = '')
}
}
$paa
=
array
();
$paa
=
array
();
if
(
isset
(
$config
[
'virtualip'
][
'vip'
])
&&
is_array
(
$config
[
'virtualip'
][
'vip'
])
)
{
if
(
isset
(
$config
[
'virtualip'
][
'vip'
]))
{
/* group by interface */
/* group by interface */
foreach
(
$config
[
'virtualip'
][
'vip'
]
as
$vipent
)
{
foreach
(
$config
[
'virtualip'
][
'vip'
]
as
$vipent
)
{
if
(
$vipent
[
'mode'
]
===
"proxyarp"
)
{
if
(
$vipent
[
'mode'
]
===
"proxyarp"
)
{
...
@@ -2700,7 +2700,7 @@ EOD;
...
@@ -2700,7 +2700,7 @@ EOD;
if
(
does_interface_exist
(
interface_get_wireless_clone
(
$baseif
)))
{
if
(
does_interface_exist
(
interface_get_wireless_clone
(
$baseif
)))
{
$clone_list
[]
=
interface_get_wireless_clone
(
$baseif
);
$clone_list
[]
=
interface_get_wireless_clone
(
$baseif
);
}
}
if
(
isset
(
$config
[
'wireless'
][
'clone'
])
&&
is_array
(
$config
[
'wireless'
][
'clone'
])
)
{
if
(
isset
(
$config
[
'wireless'
][
'clone'
]))
{
foreach
(
$config
[
'wireless'
][
'clone'
]
as
$clone
)
{
foreach
(
$config
[
'wireless'
][
'clone'
]
as
$clone
)
{
if
(
$clone
[
'if'
]
==
$baseif
)
{
if
(
$clone
[
'if'
]
==
$baseif
)
{
$clone_list
[]
=
$clone
[
'cloneif'
];
$clone_list
[]
=
$clone
[
'cloneif'
];
...
@@ -2811,7 +2811,7 @@ function interface_vlan_mtu_configured($realhwif, $mtu)
...
@@ -2811,7 +2811,7 @@ function interface_vlan_mtu_configured($realhwif, $mtu)
{
{
global
$config
;
global
$config
;
if
(
isset
(
$config
[
'vlans'
][
'vlan'
])
&&
is_array
(
$config
[
'vlans'
][
'vlan'
])
)
{
if
(
isset
(
$config
[
'vlans'
][
'vlan'
]))
{
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlan
)
{
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlan
)
{
if
(
$vlan
[
'if'
]
!=
$realhwif
)
{
if
(
$vlan
[
'if'
]
!=
$realhwif
)
{
continue
;
continue
;
...
@@ -2839,7 +2839,7 @@ function interface_virtual_create($interface)
...
@@ -2839,7 +2839,7 @@ function interface_virtual_create($interface)
}
elseif
(
substr
(
$interface
,
0
,
3
)
==
"gif"
)
{
}
elseif
(
substr
(
$interface
,
0
,
3
)
==
"gif"
)
{
interfaces_gif_configure
(
0
,
$interface
);
interfaces_gif_configure
(
0
,
$interface
);
}
elseif
(
substr
(
$interface
,
0
,
5
)
==
"ovpns"
)
{
}
elseif
(
substr
(
$interface
,
0
,
5
)
==
"ovpns"
)
{
if
(
is
_array
(
$config
[
'openvpn'
])
&&
is_array
(
$config
[
'openvpn'
][
'openvpn-server'
]))
{
if
(
is
set
(
$config
[
'openvpn'
][
'openvpn-server'
]))
{
foreach
(
$config
[
'openvpn'
][
'openvpn-server'
]
as
$server
)
{
foreach
(
$config
[
'openvpn'
][
'openvpn-server'
]
as
$server
)
{
if
(
$interface
==
"ovpns
{
$server
[
'vpnid'
]
}
"
)
{
if
(
$interface
==
"ovpns
{
$server
[
'vpnid'
]
}
"
)
{
log_error
(
"OpenVPN: Resync server
{
$server
[
'description'
]
}
"
);
log_error
(
"OpenVPN: Resync server
{
$server
[
'description'
]
}
"
);
...
@@ -2849,7 +2849,7 @@ function interface_virtual_create($interface)
...
@@ -2849,7 +2849,7 @@ function interface_virtual_create($interface)
unset
(
$server
);
unset
(
$server
);
}
}
}
elseif
(
substr
(
$interface
,
0
,
5
)
==
"ovpnc"
)
{
}
elseif
(
substr
(
$interface
,
0
,
5
)
==
"ovpnc"
)
{
if
(
is
_array
(
$config
[
'openvpn'
])
&&
is_array
(
$config
[
'openvpn'
][
'openvpn-client'
]))
{
if
(
is
set
(
$config
[
'openvpn'
][
'openvpn-client'
]))
{
foreach
(
$config
[
'openvpn'
][
'openvpn-client'
]
as
$client
)
{
foreach
(
$config
[
'openvpn'
][
'openvpn-client'
]
as
$client
)
{
if
(
$interface
==
"ovpnc
{
$client
[
'vpnid'
]
}
"
)
{
if
(
$interface
==
"ovpnc
{
$client
[
'vpnid'
]
}
"
)
{
log_error
(
"OpenVPN: Resync server
{
$client
[
'description'
]
}
"
);
log_error
(
"OpenVPN: Resync server
{
$client
[
'description'
]
}
"
);
...
@@ -2977,7 +2977,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
...
@@ -2977,7 +2977,7 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
* All vlans need to spoof their parent mac address, too. see
* All vlans need to spoof their parent mac address, too. see
* ticket #1514: http://cvstrac.pfsense.com/tktview?tn=1514,33
* ticket #1514: http://cvstrac.pfsense.com/tktview?tn=1514,33
*/
*/
if
(
isset
(
$config
[
'vlans'
][
'vlan'
])
&&
is_array
(
$config
[
'vlans'
][
'vlan'
])
)
{
if
(
isset
(
$config
[
'vlans'
][
'vlan'
]))
{
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlan
)
{
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlan
)
{
if
(
$vlan
[
'if'
]
==
$realhwif
)
{
if
(
$vlan
[
'if'
]
==
$realhwif
)
{
mwexec
(
"/sbin/ifconfig "
.
escapeshellarg
(
$vlan
[
'vlanif'
])
.
mwexec
(
"/sbin/ifconfig "
.
escapeshellarg
(
$vlan
[
'vlanif'
])
.
...
@@ -4253,7 +4253,7 @@ function get_parent_interface($interface, $avoidrecurse = false)
...
@@ -4253,7 +4253,7 @@ function get_parent_interface($interface, $avoidrecurse = false)
case
"pptp"
:
case
"pptp"
:
case
"l2tp"
:
case
"l2tp"
:
if
(
empty
(
$parents
))
{
if
(
empty
(
$parents
))
{
if
(
is
_array
(
$config
[
'ppps'
][
'ppp'
]))
{
if
(
is
set
(
$config
[
'ppps'
][
'ppp'
]))
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
$pppidx
=>
$ppp
)
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
$pppidx
=>
$ppp
)
{
if
(
$ifcfg
[
'if'
]
==
$ppp
[
'if'
])
{
if
(
$ifcfg
[
'if'
]
==
$ppp
[
'if'
])
{
$ports
=
explode
(
','
,
$ppp
[
'ports'
]);
$ports
=
explode
(
','
,
$ppp
[
'ports'
]);
...
@@ -4271,7 +4271,7 @@ function get_parent_interface($interface, $avoidrecurse = false)
...
@@ -4271,7 +4271,7 @@ function get_parent_interface($interface, $avoidrecurse = false)
default
:
default
:
// Handle _vlans
// Handle _vlans
if
(
stristr
(
$realif
,
"_vlan"
))
{
if
(
stristr
(
$realif
,
"_vlan"
))
{
if
(
is
_array
(
$config
[
'vlans'
][
'vlan'
]))
{
if
(
is
set
(
$config
[
'vlans'
][
'vlan'
]))
{
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlanidx
=>
$vlan
)
{
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlanidx
=>
$vlan
)
{
if
(
$ifcfg
[
'if'
]
==
$vlan
[
'vlanif'
])
{
if
(
$ifcfg
[
'if'
]
==
$vlan
[
'vlanif'
])
{
$parents
[
0
]
=
$vlan
[
'if'
];
$parents
[
0
]
=
$vlan
[
'if'
];
...
@@ -4718,7 +4718,7 @@ function ip_in_interface_alias_subnet($interface, $ipalias)
...
@@ -4718,7 +4718,7 @@ function ip_in_interface_alias_subnet($interface, $ipalias)
if
(
empty
(
$interface
)
||
!
is_ipaddr
(
$ipalias
))
{
if
(
empty
(
$interface
)
||
!
is_ipaddr
(
$ipalias
))
{
return
false
;
return
false
;
}
}
if
(
is
_array
(
$config
[
'virtualip'
][
'vip'
]))
{
if
(
is
set
(
$config
[
'virtualip'
][
'vip'
]))
{
foreach
(
$config
[
'virtualip'
][
'vip'
]
as
$vip
)
{
foreach
(
$config
[
'virtualip'
][
'vip'
]
as
$vip
)
{
switch
(
$vip
[
'mode'
])
{
switch
(
$vip
[
'mode'
])
{
case
"ipalias"
:
case
"ipalias"
:
...
@@ -4773,7 +4773,7 @@ function get_interface_ipv6($interface = "wan", $flush = false)
...
@@ -4773,7 +4773,7 @@ function get_interface_ipv6($interface = "wan", $flush = false)
* NOTE: On the case when only the prefix is requested,
* NOTE: On the case when only the prefix is requested,
* the communication on WAN will be done over link-local.
* the communication on WAN will be done over link-local.
*/
*/
if
(
is
_array
(
$config
[
'interfaces'
][
$interface
]))
{
if
(
is
set
(
$config
[
'interfaces'
][
$interface
]))
{
switch
(
$config
[
'interfaces'
][
$interface
][
'ipaddr'
])
{
switch
(
$config
[
'interfaces'
][
$interface
][
'ipaddr'
])
{
case
'pppoe'
:
case
'pppoe'
:
case
'l2tp'
:
case
'l2tp'
:
...
@@ -5043,7 +5043,7 @@ function interfaces_staticarp_configure($if)
...
@@ -5043,7 +5043,7 @@ function interfaces_staticarp_configure($if)
if
(
isset
(
$config
[
'dhcpd'
][
$if
][
'staticarp'
]))
{
if
(
isset
(
$config
[
'dhcpd'
][
$if
][
'staticarp'
]))
{
mwexecf
(
'/sbin/ifconfig %s staticarp'
,
array
(
$ifcfg
[
'if'
]));
mwexecf
(
'/sbin/ifconfig %s staticarp'
,
array
(
$ifcfg
[
'if'
]));
mwexecf
(
'/usr/sbin/arp -d -i %s -a > /dev/null 2>&1'
,
array
(
$ifcfg
[
'if'
]));
mwexecf
(
'/usr/sbin/arp -d -i %s -a > /dev/null 2>&1'
,
array
(
$ifcfg
[
'if'
]));
if
(
is
_array
(
$config
[
'dhcpd'
][
$if
][
'staticmap'
]))
{
if
(
is
set
(
$config
[
'dhcpd'
][
$if
][
'staticmap'
]))
{
foreach
(
$config
[
'dhcpd'
][
$if
][
'staticmap'
]
as
$arpent
)
{
foreach
(
$config
[
'dhcpd'
][
$if
][
'staticmap'
]
as
$arpent
)
{
if
(
isset
(
$arpent
[
'ipaddr'
]))
{
if
(
isset
(
$arpent
[
'ipaddr'
]))
{
mwexecf
(
mwexecf
(
...
@@ -5076,13 +5076,13 @@ function get_failover_interface($interface, $family = "all")
...
@@ -5076,13 +5076,13 @@ function get_failover_interface($interface, $family = "all")
global
$config
;
global
$config
;
/* shortcut to get_real_interface if we find it in the config */
/* shortcut to get_real_interface if we find it in the config */
if
(
isset
(
$config
[
'interfaces'
][
$interface
])
&&
is_array
(
$config
[
'interfaces'
][
$interface
])
)
{
if
(
isset
(
$config
[
'interfaces'
][
$interface
]))
{
return
get_real_interface
(
$interface
,
$family
);
return
get_real_interface
(
$interface
,
$family
);
}
}
/* compare against gateway groups */
/* compare against gateway groups */
$a_groups
=
return_gateway_groups_array
();
$a_groups
=
return_gateway_groups_array
();
if
(
isset
(
$a_groups
[
$interface
])
&&
is_array
(
$a_groups
[
$interface
])
)
{
if
(
isset
(
$a_groups
[
$interface
]))
{
/* we found a gateway group, fetch the interface or vip */
/* we found a gateway group, fetch the interface or vip */
if
(
$a_groups
[
$interface
][
0
][
'vip'
]
<>
""
)
{
if
(
$a_groups
[
$interface
][
0
][
'vip'
]
<>
""
)
{
return
$a_groups
[
$interface
][
0
][
'vip'
];
return
$a_groups
[
$interface
][
0
][
'vip'
];
...
@@ -5206,7 +5206,7 @@ function get_interface_info($ifdescr)
...
@@ -5206,7 +5206,7 @@ function get_interface_info($ifdescr)
$ifinfo
[
'status'
]
=
"down"
;
$ifinfo
[
'status'
]
=
"down"
;
}
}
if
(
is
_array
(
$config
[
'ppps'
][
'ppp'
])
&&
coun
t
(
$config
[
'ppps'
][
'ppp'
]))
{
if
(
is
se
t
(
$config
[
'ppps'
][
'ppp'
]))
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
$pppid
=>
$ppp
)
{
foreach
(
$config
[
'ppps'
][
'ppp'
]
as
$pppid
=>
$ppp
)
{
if
(
$config
[
'interfaces'
][
$ifdescr
][
'if'
]
==
$ppp
[
'if'
])
{
if
(
$config
[
'interfaces'
][
$ifdescr
][
'if'
]
==
$ppp
[
'if'
])
{
break
;
break
;
...
...
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