Skip to content

Commit

Permalink
Merge d40203a into fe37a68
Browse files Browse the repository at this point in the history
  • Loading branch information
gfr10598 committed Mar 2, 2020
2 parents fe37a68 + d40203a commit 7561d60
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions inetdiag/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ type InetDiagMsg struct {
IDiagTimer uint8 `csv:"IDM.Timer"`
IDiagRetrans uint8 `csv:"IDM.Retrans"`
// The ID is handled separately for both CSV and BigQuery, so they are tagged with "-"
ID LinuxSockID `csv:"-" bigquery:"-"`
// See TCPRow.SockID in tcpinfo repo.
// Field also suppressed in json, for use in BQ load exports.
ID LinuxSockID `csv:"-" bigquery:"-" json:"-"`
IDiagExpires uint32 `csv:"IDM.Expires"`
IDiagRqueue uint32 `csv:"IDM.Rqueue"`
IDiagWqueue uint32 `csv:"IDM.Wqueue"`
Expand All @@ -256,7 +258,7 @@ type InetDiagMsg struct {
}

const (
// This previously came from syscall, but explicit here to work on Darwin.
// RTA_ALIGNTO previously came from syscall, but explicit here to work on Darwin.
RTA_ALIGNTO = 4
)

Expand All @@ -268,6 +270,7 @@ func rtaAlignOf(attrlen int) int {
// RawInetDiagMsg holds the []byte representation of an InetDiagMsg
type RawInetDiagMsg []byte

// SplitInetDiagMsg pulls the InetDiagMsg out, and returns the msg and the remaining data slice.
func SplitInetDiagMsg(data []byte) (RawInetDiagMsg, []byte) {
// TODO - why using rtaAlign on InetDiagMsg ???
align := rtaAlignOf(int(unsafe.Sizeof(InetDiagMsg{})))
Expand All @@ -280,6 +283,7 @@ func SplitInetDiagMsg(data []byte) (RawInetDiagMsg, []byte) {
return RawInetDiagMsg(data[:align]), data[align:]
}

// ErrParseFailed is returned if InetDiagMsg parsing fails.
var ErrParseFailed = errors.New("Unable to parse InetDiagMsg")

// Parse returns the InetDiagMsg itself
Expand Down

0 comments on commit 7561d60

Please sign in to comment.