build(deps): bump the golang group across 1 directory with 7 updates

Bumps the golang group with 6 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [github.com/Microsoft/hcsshim](https://github.com/Microsoft/hcsshim) | `0.12.7` | `0.12.9` |
| [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) | `2.20.2` | `2.22.0` |
| [github.com/onsi/gomega](https://github.com/onsi/gomega) | `1.34.2` | `1.36.0` |
| [github.com/opencontainers/selinux](https://github.com/opencontainers/selinux) | `1.11.0` | `1.11.1` |
| [github.com/safchain/ethtool](https://github.com/safchain/ethtool) | `0.4.1` | `0.5.9` |
| [sigs.k8s.io/knftables](https://github.com/kubernetes-sigs/knftables) | `0.0.17` | `0.0.18` |



Updates `github.com/Microsoft/hcsshim` from 0.12.7 to 0.12.9
- [Release notes](https://github.com/Microsoft/hcsshim/releases)
- [Commits](https://github.com/Microsoft/hcsshim/compare/v0.12.7...v0.12.9)

Updates `github.com/onsi/ginkgo/v2` from 2.20.2 to 2.22.0
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.20.2...v2.22.0)

Updates `github.com/onsi/gomega` from 1.34.2 to 1.36.0
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.34.2...v1.36.0)

Updates `github.com/opencontainers/selinux` from 1.11.0 to 1.11.1
- [Release notes](https://github.com/opencontainers/selinux/releases)
- [Commits](https://github.com/opencontainers/selinux/compare/v1.11.0...v1.11.1)

Updates `github.com/safchain/ethtool` from 0.4.1 to 0.5.9
- [Release notes](https://github.com/safchain/ethtool/releases)
- [Commits](https://github.com/safchain/ethtool/compare/v0.4.1...v0.5.9)

Updates `golang.org/x/sys` from 0.26.0 to 0.27.0
- [Commits](https://github.com/golang/sys/compare/v0.26.0...v0.27.0)

Updates `sigs.k8s.io/knftables` from 0.0.17 to 0.0.18
- [Changelog](https://github.com/kubernetes-sigs/knftables/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kubernetes-sigs/knftables/compare/v0.0.17...v0.0.18)

---
updated-dependencies:
- dependency-name: github.com/Microsoft/hcsshim
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: golang
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang
- dependency-name: github.com/opencontainers/selinux
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: golang
- dependency-name: github.com/safchain/ethtool
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang
- dependency-name: sigs.k8s.io/knftables
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: golang
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2024-12-02 02:02:42 +00:00
committed by Casey Callendrello
parent 6de8a9853c
commit 3ffc42cdfd
167 changed files with 20766 additions and 1075 deletions

View File

@@ -1,11 +1,15 @@
linters:
disable:
- gosimple
- unused
enable:
- gosimple
- gci
- gofmt
- misspell
- goimports
- staticcheck
- errcheck
- govet
- misspell
- gocritic
linters-settings:
gci:
sections:

View File

@@ -55,12 +55,14 @@ const (
// CMD supported
ETHTOOL_GSET = 0x00000001 /* Get settings. */
ETHTOOL_SSET = 0x00000002 /* Set settings. */
ETHTOOL_GWOL = 0x00000005 /* Get wake-on-lan options. */
ETHTOOL_SWOL = 0x00000006 /* Set wake-on-lan options. */
ETHTOOL_GDRVINFO = 0x00000003 /* Get driver info. */
ETHTOOL_GMSGLVL = 0x00000007 /* Get driver message level */
ETHTOOL_SMSGLVL = 0x00000008 /* Set driver msg level. */
/* Get link status for host, i.e. whether the interface *and* the
* physical port (if there is one) are up (ethtool_value). */
// Get link status for host, i.e. whether the interface *and* the
// physical port (if there is one) are up (ethtool_value).
ETHTOOL_GLINK = 0x0000000a
ETHTOOL_GCOALESCE = 0x0000000e /* Get coalesce config */
ETHTOOL_SCOALESCE = 0x0000000f /* Set coalesce config */
@@ -207,23 +209,55 @@ type Coalesce struct {
RateSampleInterval uint32
}
// WoL options
const (
SOF_TIMESTAMPING_TX_HARDWARE = (1 << 0)
SOF_TIMESTAMPING_TX_SOFTWARE = (1 << 1)
SOF_TIMESTAMPING_RX_HARDWARE = (1 << 2)
SOF_TIMESTAMPING_RX_SOFTWARE = (1 << 3)
SOF_TIMESTAMPING_SOFTWARE = (1 << 4)
SOF_TIMESTAMPING_SYS_HARDWARE = (1 << 5)
SOF_TIMESTAMPING_RAW_HARDWARE = (1 << 6)
SOF_TIMESTAMPING_OPT_ID = (1 << 7)
SOF_TIMESTAMPING_TX_SCHED = (1 << 8)
SOF_TIMESTAMPING_TX_ACK = (1 << 9)
SOF_TIMESTAMPING_OPT_CMSG = (1 << 10)
SOF_TIMESTAMPING_OPT_TSONLY = (1 << 11)
SOF_TIMESTAMPING_OPT_STATS = (1 << 12)
SOF_TIMESTAMPING_OPT_PKTINFO = (1 << 13)
SOF_TIMESTAMPING_OPT_TX_SWHW = (1 << 14)
SOF_TIMESTAMPING_BIND_PHC = (1 << 15)
WAKE_PHY = 1 << 0
WAKE_UCAST = 1 << 1
WAKE_MCAST = 1 << 2
WAKE_BCAST = 1 << 3
WAKE_ARP = 1 << 4
WAKE_MAGIC = 1 << 5
WAKE_MAGICSECURE = 1 << 6 // only meaningful if WAKE_MAGIC
)
var WoLMap = map[uint32]string{
WAKE_PHY: "p", // Wake on PHY activity
WAKE_UCAST: "u", // Wake on unicast messages
WAKE_MCAST: "m", // Wake on multicast messages
WAKE_BCAST: "b", // Wake on broadcast messages
WAKE_ARP: "a", // Wake on ARP
WAKE_MAGIC: "g", // Wake on MagicPacket™
WAKE_MAGICSECURE: "s", // Enable SecureOn™ password for MagicPacket™
// f Wake on filter(s)
// d Disable (wake on nothing). This option clears all previous options.
}
// WakeOnLan contains WoL config for an interface
type WakeOnLan struct {
Cmd uint32 // ETHTOOL_GWOL or ETHTOOL_SWOL
Supported uint32 // r/o bitmask of WAKE_* flags for supported WoL modes
Opts uint32 // Bitmask of WAKE_* flags for enabled WoL modes
}
// Timestamping options
// see: https://www.kernel.org/doc/Documentation/networking/timestamping.txt
const (
SOF_TIMESTAMPING_TX_HARDWARE = (1 << 0) /* Request tx timestamps generated by the network adapter. */
SOF_TIMESTAMPING_TX_SOFTWARE = (1 << 1) /* Request tx timestamps when data leaves the kernel. */
SOF_TIMESTAMPING_RX_HARDWARE = (1 << 2) /* Request rx timestamps generated by the network adapter. */
SOF_TIMESTAMPING_RX_SOFTWARE = (1 << 3) /* Request rx timestamps when data enters the kernel. */
SOF_TIMESTAMPING_SOFTWARE = (1 << 4) /* Report any software timestamps when available. */
SOF_TIMESTAMPING_SYS_HARDWARE = (1 << 5) /* This option is deprecated and ignored. */
SOF_TIMESTAMPING_RAW_HARDWARE = (1 << 6) /* Report hardware timestamps. */
SOF_TIMESTAMPING_OPT_ID = (1 << 7) /* Generate a unique identifier along with each packet. */
SOF_TIMESTAMPING_TX_SCHED = (1 << 8) /* Request tx timestamps prior to entering the packet scheduler. */
SOF_TIMESTAMPING_TX_ACK = (1 << 9) /* Request tx timestamps when all data in the send buffer has been acknowledged. */
SOF_TIMESTAMPING_OPT_CMSG = (1 << 10) /* Support recv() cmsg for all timestamped packets. */
SOF_TIMESTAMPING_OPT_TSONLY = (1 << 11) /* Applies to transmit timestamps only. */
SOF_TIMESTAMPING_OPT_STATS = (1 << 12) /* Optional stats that are obtained along with the transmit timestamps. */
SOF_TIMESTAMPING_OPT_PKTINFO = (1 << 13) /* Enable the SCM_TIMESTAMPING_PKTINFO control message for incoming packets with hardware timestamps. */
SOF_TIMESTAMPING_OPT_TX_SWHW = (1 << 14) /* Request both hardware and software timestamps for outgoing packets when SOF_TIMESTAMPING_TX_HARDWARE and SOF_TIMESTAMPING_TX_SOFTWARE are enabled at the same time. */
SOF_TIMESTAMPING_BIND_PHC = (1 << 15) /* Bind the socket to a specific PTP Hardware Clock. */
)
const (
@@ -279,6 +313,7 @@ const (
HWTSTAMP_FILTER_NTP_ALL /* NTP, UDP, all versions and packet modes */
)
// TimestampingInformation contains PTP timetstapming information
type TimestampingInformation struct {
Cmd uint32
SoTimestamping uint32 /* SOF_TIMESTAMPING_* bitmask */
@@ -349,6 +384,7 @@ type Pause struct {
TxPause uint32
}
// Ethtool is a struct that contains the file descriptor for the ethtool
type Ethtool struct {
fd int
}
@@ -357,7 +393,7 @@ type Ethtool struct {
func goString(s []byte) string {
strEnd := bytes.IndexByte(s, 0)
if strEnd == -1 {
return string(s[:])
return string(s)
}
return string(s[:strEnd])
}
@@ -496,6 +532,31 @@ func (e *Ethtool) PermAddr(intf string) (string, error) {
), nil
}
// GetWakeOnLan returns the WoL config for the given interface name.
func (e *Ethtool) GetWakeOnLan(intf string) (WakeOnLan, error) {
wol := WakeOnLan{
Cmd: ETHTOOL_GWOL,
}
if err := e.ioctl(intf, uintptr(unsafe.Pointer(&wol))); err != nil {
return WakeOnLan{}, err
}
return wol, nil
}
// SetWakeOnLan sets the WoL config for the given interface name and
// returns the new WoL config.
func (e *Ethtool) SetWakeOnLan(intf string, wol WakeOnLan) (WakeOnLan, error) {
wol.Cmd = ETHTOOL_SWOL
if err := e.ioctl(intf, uintptr(unsafe.Pointer(&wol))); err != nil {
return WakeOnLan{}, err
}
return wol, nil
}
func (e *Ethtool) ioctl(intf string, data uintptr) error {
var name [IFNAMSIZ]byte
copy(name[:], []byte(intf))
@@ -672,6 +733,7 @@ func isFeatureBitSet(blocks [MAX_FEATURE_BLOCKS]ethtoolGetFeaturesBlock, index u
return (blocks)[index/32].active&(1<<(index%32)) != 0
}
// FeatureState contains the state of a feature.
type FeatureState struct {
Available bool
Requested bool
@@ -893,7 +955,7 @@ func (e *Ethtool) UpdatePrivFlags(intf string, config map[string]bool) error {
return e.ioctl(intf, uintptr(unsafe.Pointer(&update)))
}
// Get state of a link.
// LinkState get the state of a link.
func (e *Ethtool) LinkState(intf string) (uint32, error) {
x := ethtoolLink{
cmd: ETHTOOL_GLINK,
@@ -964,7 +1026,7 @@ func (e *Ethtool) Close() {
// NewEthtool returns a new ethtool handler
func NewEthtool() (*Ethtool, error) {
fd, err := unix.Socket(unix.AF_INET, unix.SOCK_DGRAM, unix.IPPROTO_IP)
fd, err := unix.Socket(unix.AF_INET, unix.SOCK_DGRAM|unix.SOCK_CLOEXEC, unix.IPPROTO_IP)
if err != nil {
return nil, err
}

View File

@@ -33,7 +33,9 @@ import (
"golang.org/x/sys/unix"
)
type EthtoolCmd struct { /* ethtool.c: struct ethtool_cmd */
// EthtoolCmd is the Go version of the Linux kerne ethtool_cmd struct
// see ethtool.c
type EthtoolCmd struct {
Cmd uint32
Supported uint32
Advertising uint32
@@ -102,10 +104,6 @@ func (f *EthtoolCmd) reflect(retv *map[string]uint64) {
default:
(*retv)[typeField.Name+"_unknown_type"] = 0
}
// tag := typeField.Tag
// fmt.Printf("Field Name: %s,\t Field Value: %v,\t Tag Value: %s\n",
// typeField.Name, valueField.Interface(), tag.Get("tag_name"))
}
}
@@ -198,6 +196,7 @@ func (e *Ethtool) CmdGetMapped(intf string) (map[string]uint64, error) {
return result, nil
}
// CmdGetMapped returns the interface settings in a map
func CmdGetMapped(intf string) (map[string]uint64, error) {
e, err := NewEthtool()
if err != nil {