Skip to content

Commit

Permalink
feat: support setting alias for links (#242)
Browse files Browse the repository at this point in the history
To make it a bit more symmetric with retrieving information.

Note: this only works for `.Set()`, not `.New()`.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira authored Dec 16, 2024
1 parent ec4117e commit 2d6e9f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions link.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ func (a *LinkAttributes) encode(ae *netlink.AttributeEncoder) error {
ae.String(unix.IFLA_IFNAME, a.Name)
}

if a.Alias != nil {
ae.String(unix.IFLA_IFALIAS, *a.Alias)
}

if a.Type != 0 {
ae.Uint32(unix.IFLA_LINK, a.Type)
}
Expand Down

0 comments on commit 2d6e9f8

Please sign in to comment.