Added Link Settings (GLINKSETTINGS/SLINKSETTINGS) Support #102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix #82 #33
Added Link Settings (GLINKSETTINGS/SLINKSETTINGS) Support
This change introduces support for the
ETHTOOL_GLINKSETTINGS
andETHTOOL_SLINKSETTINGS
ioctls, providing a more modern and comprehensive way to configure network interface Link Settings compared to the olderETHTOOL_GSET
/SSET
.Main Functions
GetLinkSettings(intfName string) (*LinkSettings, error)
:intfName
).ETHTOOL_GLINKSETTINGS
ioctl to get extended Link Settings.GLINKSETTINGS
(returns anEOPNOTSUPP
error), it automatically falls back to calling the olderCmdGet()
(usingETHTOOL_GSET
) and converts the result to the newLinkSettings
struct before returning.LinkSettings
struct containing the detailed Link Settings.SetLinkSettings(intfName string, settings LinkSettings) error
:intfName
) using the providedsettings
struct.GLINKSETTINGS
interface.ETHTOOL_SLINKSETTINGS
ioctl to apply the settings.EOPNOTSUPP
error), it attempts to fall back to calling the olderCmdSet()
(usingETHTOOL_SSET
).SSET
, it checks if the requested Link Modes insettings
exceed the capabilities of the old interface (e.g., setting modes beyond bit 31). If they do, an error is returned because the old interface cannot fulfill the request.