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
5525a08a
Commit
5525a08a
authored
Jul 14, 2017
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
interfaces.inc, fix mtu setup for vlans, for
https://github.com/opnsense/core/issues/1709
parent
8236ddcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
53 deletions
+15
-53
interfaces.inc
src/etc/inc/interfaces.inc
+15
-53
No files found.
src/etc/inc/interfaces.inc
View file @
5525a08a
...
...
@@ -2517,37 +2517,6 @@ function interface_virtual_create($interface)
}
}
function
interface_vlan_adapt_mtu
(
$vlanifs
,
$mtu
)
{
global
$config
;
if
(
!
is_array
(
$vlanifs
))
{
return
;
}
/* All vlans need to use the same mtu value as their parent. */
foreach
(
$vlanifs
as
$vlan
)
{
$assignedport
=
convert_real_interface_to_friendly_interface_name
(
$vlan
[
'vlanif'
]);
if
(
!
empty
(
$assignedport
))
{
if
(
!
empty
(
$config
[
'interfaces'
][
$assignedport
][
'mtu'
]))
{
/*
* XXX: This is really never going to happen just keep the code for safety and readbility.
* It never happens since interface_vlan_mtu_configured finds the biggest mtu on vlans.
* Also if it has a lower mtu configured just respect user choice.
*/
if
(
intval
(
$config
[
'interfaces'
][
$assignedport
][
'mtu'
])
>
$mtu
)
{
legacy_interface_mtu
(
$vlan
[
'vlanif'
],
$mtu
);
}
}
else
{
if
(
legacy_interface_stats
(
$vlan
[
'vlanif'
])[
'mtu'
]
!=
$mtu
)
{
legacy_interface_mtu
(
$vlan
[
'vlanif'
],
$mtu
);
}
}
}
elseif
(
legacy_interface_stats
(
$vlan
[
'vlanif'
])[
'mtu'
]
!=
$mtu
)
{
legacy_interface_mtu
(
$vlan
[
'vlanif'
],
$mtu
);
}
}
}
function
interface_configure
(
$interface
=
'wan'
,
$reloadall
=
false
,
$linkupevent
=
false
,
$verbose
=
false
)
{
...
...
@@ -2701,34 +2670,27 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
break
;
}
}
$intf_stats
=
legacy_interface_stats
();
if
(
!
empty
(
$wancfg
[
'mtu'
]))
{
if
(
stristr
(
$realif
,
"_vlan"
))
{
$assignedparent
=
convert_real_interface_to_friendly_interface_name
(
$realhwif
);
if
(
!
empty
(
$assignedparent
)
&&
!
empty
(
$config
[
'interfaces'
][
$assignedparent
][
'mtu'
]))
{
$parentmtu
=
$config
[
'interfaces'
][
$assignedparent
][
'mtu'
];
}
else
{
$parentmtu
=
interface_vlan_mtu_configured
(
$realhwif
,
$wancfg
[
'mtu'
]);
// max mtu to parent
$mtu
=
$wancfg
[
'mtu'
]
<
$intf_stats
[
$realhwif
][
'mtu'
]
?
$wancfg
[
'mtu'
]
:
$intf_stats
[
$realhwif
][
'mtu'
];
if
(
$mtu
!=
$intf_stats
[
$realif
][
'mtu'
])
{
legacy_interface_mtu
(
$realif
,
$mtu
);
}
}
elseif
(
$wancfg
[
'mtu'
]
!=
$intf_stats
[
'mtu'
])
{
legacy_interface_mtu
(
$realhwif
,
$wancfg
[
'mtu'
]);
}
}
if
(
$wancfg
[
'mtu'
]
>
$parentmtu
)
{
if
(
legacy_interface_stats
(
$realhwif
)[
'mtu'
]
!=
$wancfg
[
'mtu'
])
{
legacy_interface_mtu
(
$realhwif
,
$wancfg
[
'mtu'
]);
}
/* All vlans need to use the same mtu value as their parent. */
interface_vlan_adapt_mtu
(
link_interface_to_vlans
(
$realhwif
),
$wancfg
[
'mtu'
]);
}
else
{
legacy_interface_mtu
(
$realif
,
$wancfg
[
'mtu'
]);
}
}
else
{
if
(
$wancfg
[
'mtu'
]
!=
legacy_interface_stats
(
$realhwif
)[
'mtu'
])
{
legacy_interface_mtu
(
$realhwif
,
$wancfg
[
'mtu'
]);
// in case this interface has vlan's configured, make sure none of them has an mtu set higher than it's parent
if
(
!
empty
(
$config
[
'vlans'
][
'vlan'
]))
{
$intf_stats
=
legacy_interface_stats
();
foreach
(
$config
[
'vlans'
][
'vlan'
]
as
$vlan
)
{
if
(
$realhwif
==
$vlan
[
'if'
]
&&
$intf_stats
[
$realhwif
][
'mtu'
]
<
$intf_stats
[
$vlan
[
'vlanif'
]][
'mtu'
])
{
legacy_interface_mtu
(
$vlan
[
'vlanif'
],
$intf_stats
[
$realhwif
][
'mtu'
]);
}
/* This case is needed when the parent of vlans is being configured */
interface_vlan_adapt_mtu
(
link_interface_to_vlans
(
$realif
),
$wancfg
[
'mtu'
]);
}
/* XXX: What about gre/gif/lagg/.. ? */
}
if
(
does_interface_exist
(
$wancfg
[
'if'
]))
{
...
...
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