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
2149c897
Commit
2149c897
authored
Mar 03, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) probe network hardware settings before applying.
parent
3a47f554
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
7 deletions
+56
-7
interfaces.inc
src/etc/inc/interfaces.inc
+3
-7
interfaces.lib.inc
src/etc/inc/interfaces.lib.inc
+53
-0
No files found.
src/etc/inc/interfaces.inc
View file @
2149c897
...
...
@@ -272,7 +272,7 @@ function interface_vlan_configure(&$vlan)
}
}
// disable/enable hardware vlan tags, will be skipped when "Leave default" (option 2) is selected
// disable/enable hardware vlan tags, will be skipped when "Leave default" (option 2) is selected
if
(
!
isset
(
$config
[
'system'
][
'disablevlanhwfilter'
])
||
$config
[
'system'
][
'disablevlanhwfilter'
]
==
1
)
{
foreach
(
$members
as
$member
)
{
// set one tag at a time to avoid driver issues
...
...
@@ -3030,12 +3030,8 @@ function interface_configure($interface = 'wan', $reloadall = false, $linkupeven
}
mwexec
(
$cmd
);
}
$options
=
pfSense_get_interface_addresses
(
$realhwif
);
/* skip vlans for checksumming and polling */
if
(
!
stristr
(
$realif
,
"_vlan"
)
&&
is_array
(
$options
))
{
legacy_interface_flags
(
$realhwif
,
interface_override_flags
(),
false
);
}
// apply interface hardware settings (tso, lro, ..)
configure_interface_hardware
(
$realhwif
);
$tunnelif
=
substr
(
$realif
,
0
,
3
);
switch
(
$wancfg
[
'ipaddr'
])
{
...
...
src/etc/inc/interfaces.lib.inc
View file @
2149c897
...
...
@@ -182,6 +182,7 @@ function legacy_interface_details($intf)
{
$result
=
array
();
$result
[
"capabilities"
]
=
array
();
$result
[
"options"
]
=
array
();
$process
=
proc_open
(
'/sbin/ifconfig -m '
.
escapeshellarg
(
$intf
),
array
(
array
(
"pipe"
,
"r"
),
array
(
"pipe"
,
"w"
)),
$pipes
);
if
(
is_resource
(
$process
))
{
$ifconfig_data
=
stream_get_contents
(
$pipes
[
1
]);
...
...
@@ -192,7 +193,14 @@ function legacy_interface_details($intf)
foreach
(
explode
(
','
,
$capabilities
)
as
$capability
)
{
$result
[
"capabilities"
][]
=
strtolower
(
trim
(
$capability
));
}
}
elseif
(
strpos
(
trim
(
$line
),
'options='
)
!==
false
)
{
// parse options
$capabilities
=
substr
(
$line
,
strpos
(
$line
,
'<'
)
+
1
,
-
1
);
foreach
(
explode
(
','
,
$capabilities
)
as
$capability
)
{
$result
[
"options"
][]
=
strtolower
(
trim
(
$capability
));
}
}
}
fclose
(
$pipes
[
1
]);
proc_close
(
$process
);
...
...
@@ -214,3 +222,48 @@ function legacy_netgraph_rename($tmpifs, $ifs)
{
mwexecf
(
'/usr/sbin/ngctl name %s: %s'
,
array
(
$tmpifs
,
$ifs
));
}
/**
* configure interface hardware settings
* @param string $ifs interface name
*/
function
configure_interface_hardware
(
$ifs
)
{
global
$config
;
$intf_details
=
legacy_interface_details
(
$ifs
);
/* skip vlans for checksumming and polling */
if
(
!
stristr
(
$ifs
,
"_vlan"
)
&&
is_array
(
$intf_details
))
{
// get current settings
$csum_set
=
in_array
(
'rxcsum'
,
$intf_details
[
'options'
])
||
in_array
(
'txcsum'
,
$intf_details
[
'options'
]);
$tso_set
=
in_array
(
'tso4'
,
$intf_details
[
'options'
])
||
in_array
(
'tso6'
,
$intf_details
[
'options'
]);
$lro_set
=
in_array
(
'lro'
,
$intf_details
[
'options'
]);
$polling_set
=
in_array
(
'polling'
,
$intf_details
[
'options'
]);
// hardware checksum offloading offloading
if
(
isset
(
$config
[
'system'
][
'disablechecksumoffloading'
])
&&
$csum_set
)
{
legacy_interface_flags
(
$ifs
,
'-txcsum -rxcsum'
,
false
);
}
elseif
(
!
isset
(
$config
[
'system'
][
'disablechecksumoffloading'
])
&&
!
$csum_set
)
{
legacy_interface_flags
(
$ifs
,
'txcsum rxcsum'
,
false
);
}
// TCP segmentation offloading
if
(
isset
(
$config
[
'system'
][
'disablesegmentationoffloading'
])
&&
$tso_set
)
{
legacy_interface_flags
(
$ifs
,
'-tso'
,
false
);
}
elseif
(
!
isset
(
$config
[
'system'
][
'disablesegmentationoffloading'
])
&&
!
$tso_set
)
{
legacy_interface_flags
(
$ifs
,
'tso'
,
false
);
}
// large receive offload
if
(
isset
(
$config
[
'system'
][
'disablelargereceiveoffloading'
])
&&
$lro_set
)
{
legacy_interface_flags
(
$ifs
,
'-lro'
,
false
);
}
elseif
(
!
isset
(
$config
[
'system'
][
'disablelargereceiveoffloading'
])
&&
!
$lro_set
)
{
legacy_interface_flags
(
$ifs
,
'lro'
,
false
);
}
// polling
if
(
isset
(
$config
[
'system'
][
'polling'
])
&&
!
$polling_set
)
{
legacy_interface_flags
(
$ifs
,
'polling'
,
false
);
}
elseif
(
!
isset
(
$config
[
'system'
][
'polling'
])
&&
$polling_set
)
{
legacy_interface_flags
(
$ifs
,
'-polling'
,
false
);
}
}
}
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