Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

weaveworks / weave / #7201

20 Sep 2016 - 16:03 coverage decreased (-0.1%) to 73.98%
#7201

Pull #2501

circleci

7de8841b37903eead0e0bb4d567e9454?size=18&default=identiconbrb
Update weaveworks/mesh submodule
Pull Request #2501: Reject empty peers

6616 of 8943 relevant lines covered (73.98%)

121129.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0
/net/ethtool.go
1
package net
2

3
import "fmt"
4
import "syscall"
5
import "unsafe"
6

7
const (
8
        SIOCETHTOOL     = 0x8946     // linux/sockios.h
9
        ETHTOOL_STXCSUM = 0x00000017 // linux/ethtool.h
10
        IFNAMSIZ        = 16         // linux/if.h
11
)
12

13
// linux/if.h 'struct ifreq'
14
type IFReqData struct {
15
        Name [IFNAMSIZ]byte
16
        Data uintptr
17
}
18

19
// linux/ethtool.h 'struct ethtool_value'
20
type EthtoolValue struct {
21
        Cmd  uint32
22
        Data uint32
23
}
24

25
// Disable TX checksum offload on specified interface
26
func EthtoolTXOff(name string) error {
!
27
        if len(name)+1 > IFNAMSIZ {
!
28
                return fmt.Errorf("name too long")
!
29
        }
!
30

31
        value := EthtoolValue{ETHTOOL_STXCSUM, 0}
!
UNCOV
32
        request := IFReqData{Data: uintptr(unsafe.Pointer(&value))}
!
UNCOV
33

!
UNCOV
34
        copy(request.Name[:], name)
!
35

!
36
        socket, err := syscall.Socket(syscall.AF_INET, syscall.SOCK_DGRAM, 0)
!
37
        if err != nil {
!
38
                return err
!
UNCOV
39
        }
!
40
        defer syscall.Close(socket)
!
41

!
42
        _, _, errno := syscall.RawSyscall(syscall.SYS_IOCTL,
!
43
                uintptr(socket),
!
44
                uintptr(SIOCETHTOOL),
!
45
                uintptr(unsafe.Pointer(&request)))
!
46

!
47
        if errno != 0 {
!
48
                return errno
!
49
        }
!
50

51
        return nil
!
52
}
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2022 Coveralls, Inc